From 47d71a6022bb67328ad3ffbdc404a32697d29241 Mon Sep 17 00:00:00 2001 From: axolotle Date: Sat, 10 Apr 2021 14:16:47 +0200 Subject: [PATCH] add warning modal if last ws message is a warning --- app/src/store/info.js | 11 +++++- app/src/views/_partials/ViewLockOverlay.vue | 23 ++++++++--- app/src/views/_partials/WarningDisplay.vue | 43 +++++++++++++++++++++ app/src/views/_partials/index.js | 1 + 4 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 app/src/views/_partials/WarningDisplay.vue diff --git a/app/src/store/info.js b/app/src/store/info.js index 92f1fd2c..89d1a603 100644 --- a/app/src/store/info.js +++ b/app/src/store/info.js @@ -145,11 +145,15 @@ export default { 'END_REQUEST' ({ commit }, { request, success, wait }) { let status = success ? 'success' : 'error' if (success && (request.warnings || request.errors)) { + const messages = request.messages + if (messages.length && messages[messages.length - 1].color === 'warning') { + request.showWarningMessage = true + } status = 'warning' } commit('UPDATE_REQUEST', { request, key: 'status', value: status }) - if (wait) { + if (wait && !request.showWarningMessage) { // Remove the overlay after a short delay to allow an error to display withtout flickering. setTimeout(() => { commit('SET_WAITING', false) @@ -214,6 +218,11 @@ export default { } } commit('SET_ERROR', null) + }, + + 'DISMISS_WARNING' ({ commit, state }, request) { + commit('SET_WAITING', false) + delete request.showWarningMessage } }, diff --git a/app/src/views/_partials/ViewLockOverlay.vue b/app/src/views/_partials/ViewLockOverlay.vue index 3c5fcdeb..a4f61faf 100644 --- a/app/src/views/_partials/ViewLockOverlay.vue +++ b/app/src/views/_partials/ViewLockOverlay.vue @@ -12,8 +12,7 @@ - - + @@ -21,7 +20,7 @@ diff --git a/app/src/views/_partials/index.js b/app/src/views/_partials/index.js index 950eecca..dfcda23a 100644 --- a/app/src/views/_partials/index.js +++ b/app/src/views/_partials/index.js @@ -1,4 +1,5 @@ export { default as ErrorDisplay } from './ErrorDisplay' +export { default as WarningDisplay } from './WarningDisplay' export { default as WaitingDisplay } from './WaitingDisplay' export { default as HistoryConsole } from './HistoryConsole'