fix(UI): notifications timeout anomalies

This commit is contained in:
Fabio Di Stasio 2021-11-24 16:59:07 +01:00
parent fe8435531e
commit cc99491fe4
2 changed files with 12 additions and 10 deletions

View File

@ -13,6 +13,7 @@ module.exports = {
// Tools // Tools
processesList: true, processesList: true,
// Structure // Structure
schemas: true,
tables: true, tables: true,
views: true, views: true,
triggers: true, triggers: true,

View File

@ -40,17 +40,15 @@ export default {
} }
}, },
watch: { watch: {
notifications: { 'notifications.length': function (val) {
deep: true, if (val > 0) {
handler: function (notification) { const nUid = this.notifications[0].uid;
if (notification.length) { this.timeouts[nUid] = setTimeout(() => {
this.timeouts[notification[0].uid] = setTimeout(() => { this.removeNotification(nUid);
this.removeNotification(notification[0].uid); delete this.timeouts[nUid];
delete this.timeouts[notification.uid];
}, this.notificationsTimeout * 1000); }, this.notificationsTimeout * 1000);
} }
} }
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({
@ -63,11 +61,14 @@ export default {
} }
}, },
rearmTimeouts () { rearmTimeouts () {
const delay = 50;
let i = this.notifications.length * delay;
for (const notification of this.notifications) { for (const notification of this.notifications) {
this.timeouts[notification.uid] = setTimeout(() => { this.timeouts[notification.uid] = setTimeout(() => {
this.removeNotification(notification.uid); this.removeNotification(notification.uid);
delete this.timeouts[notification.uid]; delete this.timeouts[notification.uid];
}, this.notificationsTimeout * 1000); }, (this.notificationsTimeout * 1000) + i);
i = i > delay ? i - delay : 0;
} }
} }
} }