-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MBS-8967: Add modal to show errors when trying to change sth #46
base: master
Are you sure you want to change the base?
Conversation
Failing GHA is not related to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes part of the issue when trying to do for example things you aren't allowed to.
However, the error handling should be implemented for every webservices call, also for the permanent update polls for example. Currently, if for testing purposes I insert an exception into get_kanban_content_update
the app will just crash.
The error handling should properly handle the issue of connection loss.
Maybe it's also possible/easier to use displayException
function?
Added an alert for displaying connection loss. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments. Have not tested yet.
* @param {*} ex | ||
*/ | ||
processFail(ex) { | ||
Notification.alert(getString('error'), ex.message, getString('cancel')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alert is an async function, it needs to be called with await
@@ -217,9 +232,31 @@ export default class { | |||
boardid: state.board.id, | |||
timestamp: state.common.timestamp, | |||
}, | |||
fail: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
*/ | ||
resetUpdateFails() { | ||
this.updateFails = 0; | ||
document.querySelector('.mod_kanban_update_error').classList.add('hidden'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably want to add this to the selectors.js and use the constant defined there?
Also AFAIK CSS classes should only be used for styling. For "queryselectoring" an element a data attribute should be used.
processUpdateFail() { | ||
this.updateFails++; | ||
if (this.updateFails > 2) { | ||
document.querySelector('.mod_kanban_update_error').classList.remove('hidden'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also use the selectors constant
@@ -247,6 +284,9 @@ export default class { | |||
cardid: cardId, | |||
timestamp: timestamp, | |||
}, | |||
fail: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
@@ -276,6 +316,9 @@ export default class { | |||
cardid: cardId, | |||
timestamp: timestamp, | |||
}, | |||
fail: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
b44e867
to
5791dad
Compare
Implements #14