summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-09-02 13:33:46 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-09-02 13:33:46 +0300
commit3682e47e5cec528bc9ba1e487f1002fa1a6f786e (patch)
tree501ea107fbef6e5d9a2bbcc1f1085c69d8b158c7
parent05bdca11621aadc480ccf4c131bf57ab1a0919f1 (diff)
downloadwebui-vue-3682e47e5cec528bc9ba1e487f1002fa1a6f786e.tar.xz
add info toasts if server status is changed
-rw-r--r--src/components/Mixins/BVToastMixin.js4
-rw-r--r--src/components/_sila/AppHeader/AppHeader.vue16
-rw-r--r--src/locales/en-US.json4
-rw-r--r--src/locales/ru-RU.json4
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": "Последний час",