Skip to content
Snippets Groups Projects
Commit 23e31f0d authored by yvesn's avatar yvesn
Browse files

SSDM-5068 : ELN config on GUI - fixing startup when settings sample does not yet exist

SVN: 38232
parent 9693c667
No related branches found
No related tags found
No related merge requests found
......@@ -24,8 +24,12 @@ function SettingsManager(serverFacade) {
if(!data[0]) {
window.alert("The item is no longer available, refresh the page, if the problem persists tell your admin that the Lucene index is probably corrupted.");
} else {
var settings = JSON.parse(data[0].properties.ELN_SETTINGS);
callback(settings);
if (data[0].properties && data[0].properties.ELN_SETTINGS) {
var settings = JSON.parse(data[0].properties.ELN_SETTINGS);
callback(settings);
} else {
callback();
}
}
}).bind(this))
}
......@@ -34,12 +38,14 @@ function SettingsManager(serverFacade) {
// Applies the settings to the profile even if they are invalid.
this.loadSettingsAndApplyToProfile = function(doneCallback) {
this.loadSettings((function(settings) {
var errors = this._validateSettings(settings);
if (errors.length > 0) {
console.log("The settings contain the following errors:");
console.log(errors);
if (settings) {
var errors = this._validateSettings(settings);
if (errors.length > 0) {
console.log("The settings contain the following errors:");
console.log(errors);
}
this.applySettingsToProfile(settings, profile);
}
this.applySettingsToProfile(settings, profile);
doneCallback();
}).bind(this));
}
......
......@@ -24,7 +24,9 @@ function SettingsFormController(mainController, settingsSample, mode) {
// apply settings to copy of profile, even if invalid, for editing
var profileToEdit = jQuery.extend(true, {}, profile);
this._settingsManager.loadSettings((function(settings) {
this._settingsManager.applySettingsToProfile(settings, profileToEdit);
if (settings) {
this._settingsManager.applySettingsToProfile(settings, profileToEdit);
}
this._settingsFormView.repaint(views, profileToEdit);
}).bind(this));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment