Univention Bugzilla – Attachment 6087 Details for
Bug 35815
[Basic settings] exceptions after finishing saving
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
setup.js patch
setup.patch (text/plain), 4.67 KB, created by
Florian Best
on 2014-09-04 09:24:57 CEST
(
hide
)
Description:
setup.js patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2014-09-04 09:24:57 CEST
Size:
4.67 KB
patch
obsolete
>Index: umc/js/setup.js >=================================================================== >--- umc/js/setup.js (Revision 53215) >+++ umc/js/setup.js (Arbeitskopie) >@@ -363,13 +363,9 @@ > > load: function() { > // get settings from server >- this.standby(true); >- return this.umcpCommand('setup/load').then(lang.hitch(this, function(data) { >+ return this.standbyDuring(this.umcpCommand('setup/load')).then(lang.hitch(this, function(data) { > // update setup pages with loaded values > this.setValues(data.result); >- this.standby(false); >- }), lang.hitch(this, function() { >- this.standby(false); > })); > }, > >@@ -501,7 +497,7 @@ > }; > > // function to locally validate the pages >- var _localValidation = function() { >+ var _localValidation = lang.hitch(this, function() { > var allValid = true; > var validationMessage = '<p>' + _('The following entries could not be validated:') + '</p><ul style="max-height:200px; overflow:auto;">'; > array.forEach(this._pages, function(ipage) { >@@ -525,10 +521,10 @@ > _alert(validationMessage); > throw new Error('Validation failed!'); > } >- }; >+ }); > > // function to confirm changes >- var _confirmChanges = function(values, summaries) { >+ var _confirmChanges = lang.hitch(this, function(values, summaries) { > // first see which message needs to be displayed for the confirmation message > tools.forIn(values, function(ikey) { > array.forEach(summaries, function(idesc) { >@@ -560,10 +556,10 @@ > throw new CancelDialogException(); > } > })); >- }; >+ }); > > // function for server side validation of user changes >- var _remoteValidation = function(values, summaries) { >+ var _remoteValidation = lang.hitch(this, function(values, summaries) { > this.standby(true); > return this.umcpCommand('setup/validate', { values: values }).then(lang.hitch(this, function(data) { > var allValid = true; >@@ -606,10 +602,10 @@ > _alert(validationMessage); > throw new Error('Validation failed!'); > })); >- }; >+ }); > > // function to save data >- var _save = function(values, umc_url) { >+ var _save = lang.hitch(this, function(values, umc_url) { > var deferred = new Deferred(); > > // send save command to server >@@ -639,22 +635,22 @@ > return deferred.then(lang.hitch(this, function() { > this.standby(false); > })); >- }; >+ }); > > // ask user whether UMC server components shall be restarted or not >- var _restart = function() { >+ var _restart = lang.hitch(this, function() { > libServer.askRestart(_('The changes have been applied successfully.')); > this.load(); // sets 'standby(false)' >- }; >+ }); > > // notify user that saving was successful >- var _success = function() { >+ var _success = lang.hitch(this, function() { > this.addNotification(_('The changes have been applied successfully.')); > this.load(); // sets 'standby(false)' >- }; >+ }); > > // tell user that saving was not successful (has to confirm) >- var _failure = function(errorHtml) { >+ var _failure = lang.hitch(this, function(errorHtml) { > var msg = _('Not all changes could be applied successfully:') + errorHtml; > var choices = [{ > name: 'apply', >@@ -664,10 +660,10 @@ > return dialog.confirm(msg, choices).then(lang.hitch(this, function() { > this.load(); // sets 'standby(false)' > })); >- }; >+ }); > > // show success/error message and eventually restart UMC server components >- var _checkForErrorsDuringSave = function(values) { >+ var _checkForErrorsDuringSave = lang.hitch(this, function(values) { > var errors = this._progressBar.getErrors().errors; > if (errors.length) { > // errors have occurred >@@ -696,16 +692,16 @@ > return _success(); > } > } >- }; >+ }); > > // chain all methods together > var deferred = new Deferred(); > deferred.resolve(); >- deferred = deferred.then(lang.hitch(this, _localValidation, values)); >- deferred = deferred.then(lang.hitch(this, _confirmChanges, values, summaries)); >- deferred = deferred.then(lang.hitch(this, _remoteValidation, values, summaries)); >- deferred = deferred.then(lang.hitch(this, _save, values, umc_url)); >- deferred = deferred.then(lang.hitch(this, _checkForErrorsDuringSave, values)); >+ deferred = deferred.then(lang.partial(_localValidation, values)); >+ deferred = deferred.then(lang.partial(_confirmChanges, values, summaries)); >+ deferred = deferred.then(lang.partial(_remoteValidation, values, summaries)); >+ deferred = deferred.then(lang.partial(_save, values, umc_url)); >+ deferred = deferred.then(lang.partial(_checkForErrorsDuringSave, values)); > deferred.then( > lang.hitch(this, 'standby', false), > lang.hitch(this, 'standby', false)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 35815
: 6087