From 3682e47e5cec528bc9ba1e487f1002fa1a6f786e Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Fri, 2 Sep 2022 13:33:46 +0300 Subject: add info toasts if server status is changed --- src/components/Mixins/BVToastMixin.js | 4 ++-- src/components/_sila/AppHeader/AppHeader.vue | 16 ++++++++++++++++ src/locales/en-US.json | 4 +++- src/locales/ru-RU.json | 4 +++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/Mixins/BVToastMixin.js b/src/components/Mixins/BVToastMixin.js index a04ef438..e7f480ab 100644 --- a/src/components/Mixins/BVToastMixin.js +++ b/src/components/Mixins/BVToastMixin.js @@ -47,8 +47,8 @@ const BVToastMixin = { this.$root.$bvToast.toast(body, { title, variant, - autoHideDelay: 10000, //auto hide in milliseconds - noAutoHide: variant !== 'success', + autoHideDelay: 5000, //auto hide in milliseconds + noAutoHide: variant === 'danger', isStatus: true, solid: true, }); diff --git a/src/components/_sila/AppHeader/AppHeader.vue b/src/components/_sila/AppHeader/AppHeader.vue index 315136e1..04b72c26 100644 --- a/src/components/_sila/AppHeader/AppHeader.vue +++ b/src/components/_sila/AppHeader/AppHeader.vue @@ -246,6 +246,8 @@ export default { data() { return { isNavigationOpen: false, + isRefreshClicked: false, + isFirstStatusLoad: true, altLogo: process.env.VUE_APP_COMPANY_NAME || 'Built on OpenBMC', }; }, @@ -317,6 +319,19 @@ export default { }); } }, + serverStatus(value) { + if (!this.isRefreshClicked && !this.isFirstStatusLoad) { + this.infoToast( + `${this.$t('global.toast.serverDescription')}: ${value}`, + { + title: this.$t('global.toast.serverTitle'), + } + ); + } else { + this.isRefreshClicked = false; + } + this.isFirstStatusLoad = false; + }, }, created() { // Reset auth state to check if user is authenticated based @@ -356,6 +371,7 @@ export default { this.$store.dispatch('global/getBmcTime'); }, refresh() { + this.isRefreshClicked = true; this.$emit('refresh'); }, logout() { diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 84fa2168..318a8e6c 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -84,7 +84,9 @@ }, "toast": { "unAuthTitle": "Unauthorized", - "unAuthDescription": "The attempted action is not accessible from the logged in account. Contact your system administrator to check your privilege role." + "unAuthDescription": "The attempted action is not accessible from the logged in account. Contact your system administrator to check your privilege role.", + "serverTitle": "Server error", + "serverDescription": "Server status changed" }, "datePicker": { "lastHour": "Last hour", diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 0b4edc14..c33dacb6 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -84,7 +84,9 @@ }, "toast": { "unAuthTitle": "Недоступно", - "unAuthDescription": "Действие недоступно из текущей учётной записи. Свяжитесь с Вашим системным администратором для проверки прав доступа." + "unAuthDescription": "Действие недоступно из текущей учётной записи. Свяжитесь с Вашим системным администратором для проверки прав доступа.", + "serverTitle": "Статус сервера", + "serverDescription": "Изменен статус сервера" }, "datePicker": { "lastHour": "Последний час", -- cgit v1.2.3