Sitic has submitted this change and it was merged. Change subject: Show error messages one after another ......................................................................
Show error messages one after another Bugfix, only show one error message at a time, wait until the user has clicked on close. Change-Id: I44639e4a1d84111e42cd58302662e1c5126576b3 --- M frontend/src/app/runBlock.js 1 file changed, 26 insertions(+), 22 deletions(-) Approvals: Sitic: Verified; Looks good to me, approved diff --git a/frontend/src/app/runBlock.js b/frontend/src/app/runBlock.js index 4c50a9b..39dfe37 100644 --- a/frontend/src/app/runBlock.js +++ b/frontend/src/app/runBlock.js @@ -63,36 +63,23 @@ dataService.diffResponseHandler(data) } else if (data.msgtype === 'loginerror') { $log.error('login failed with: ' + data.errorinfo); - $translate(['OAUTH_FAILURE_TITLE', 'OAUTH_FAILURE_CONTENT', 'CLOSE'], {error: data.errorinfo}) .then(function (translations) { - var alert = $mdDialog.alert({ + registerAlert({ title: translations['OAUTH_FAILURE_TITLE'], content: translations['OAUTH_FAILURE_CONTENT'], ok: translations['CLOSE'] - }); - - $mdDialog - .show( alert ) - .finally(function() { - alert = undefined; }); }); } else if (data.msgtype === 'apierror') { $log.error('API error: ' + data.errorinfo); $translate(['SERVER_ERROR_TITLE', 'API_ERROR_CONTENT', 'CLOSE'], {errorcode: data.errorcode, errorinfo: data.errorinfo}) .then(function (translations) { - var alert = $mdDialog.alert({ + registerAlert({ title: translations['SERVER_ERROR_TITLE'], content: translations['API_ERROR_CONTENT'], ok: translations['CLOSE'] }); - - $mdDialog - .show(alert) - .finally(function () { - alert = undefined; - }); }); } else { $log.error("Unhandled message: %o", data); @@ -110,18 +97,35 @@ if (connectionError) { $log.warn('No websocket message after 20 seconds.'); $translate(['SERVER_ERROR_TITLE', 'SERVER_ERROR_CONTENT', 'CLOSE']).then(function (translations) { - var alert = $mdDialog.alert({ + registerAlert({ title: translations['SERVER_ERROR_TITLE'], content: translations['SERVER_ERROR_CONTENT'], ok: translations['CLOSE'] }); - - $mdDialog - .show(alert) - .finally(function () { - alert = undefined; - }); }); } } + + var currentAlert = false; + var alerts = []; + /** + * Register an $mdDialog alert and schedules it to be shown + * @param arg paramter for $mdDialog.alert() + */ + function registerAlert (arg) { + var alert = $mdDialog.alert(arg); + alerts.push(alert); + showAlert(); + } + function showAlert () { + if (!currentAlert && alerts.length) { + currentAlert = alerts.shift(); + $mdDialog + .show(currentAlert) + .finally(function () { + currentAlert = false; + showAlert(); + }); + } + } } -- To view, visit https://gerrit.wikimedia.org/r/225714 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I44639e4a1d84111e42cd58302662e1c5126576b3 Gerrit-PatchSet: 1 Gerrit-Project: labs/tools/crosswatch Gerrit-Branch: master Gerrit-Owner: Sitic <jan.leb...@online.de> Gerrit-Reviewer: Sitic <jan.leb...@online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits