From 3682e47e5cec528bc9ba1e487f1002fa1a6f786e Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Fri, 2 Sep 2022 13:33:46 +0300
Subject: add info toasts if server status is changed

---
 src/components/_sila/AppHeader/AppHeader.vue | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'src/components/_sila/AppHeader/AppHeader.vue')

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() {
-- 
cgit v1.2.3

