Add Toast Notification to ServerLED page

- Added Toast notification when Server LED turning On/Off.

Signed-off-by: Suren Neware <sneware9@in.ibm.com>
Change-Id: I8dda963275f7083ae5c8804831c1bb676d7bbcc4
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 8b80233..f239058 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -390,7 +390,13 @@
   },
   "pageServerLed": {
     "serverLedSubTitle": "Server indicator LED",
-    "serverLedTitle": "LED light control"
+    "serverLedTitle": "LED light control",
+    "toast": {
+      "errorServerLedOff": "Error turning LED off.",
+      "errorServerLedOn": "Error turning LED on.",
+      "successServerLedOff": "Server LED successfully turned off.",
+      "successServerLedOn": "Server LED successfully turned on."
+    }
   },
   "pageServerPowerOperations": {
     "currentStatus": "Current status",
diff --git a/src/store/modules/Control/ServerLedStore.js b/src/store/modules/Control/ServerLedStore.js
index 54faf59..6ea0473 100644
--- a/src/store/modules/Control/ServerLedStore.js
+++ b/src/store/modules/Control/ServerLedStore.js
@@ -1,4 +1,5 @@
 import api from '../../api';
+import i18n from '@/i18n';
 
 const ServerLedStore = {
   namespaced: true,
@@ -15,7 +16,7 @@
   },
   actions: {
     async getIndicatorValue({ commit }) {
-      await api
+      return await api
         .get('/redfish/v1/Systems/system')
         .then(response => {
           commit('setIndicatorValue', response.data.IndicatorLED);
@@ -23,12 +24,24 @@
         .catch(error => console.log(error));
     },
     async saveIndicatorLedValue({ commit }, payload) {
-      await api
+      return await api
         .patch('/redfish/v1/Systems/system', { IndicatorLED: payload })
         .then(() => {
           commit('setIndicatorValue', payload);
+          if (payload === 'Lit') {
+            return i18n.t('pageServerLed.toast.successServerLedOn');
+          } else {
+            return i18n.t('pageServerLed.toast.successServerLedOff');
+          }
         })
-        .catch(error => console.log(error));
+        .catch(error => {
+          console.log(error);
+          if (payload === 'Lit') {
+            throw new Error(i18n.t('pageServerLed.toast.errorServerLedOn'));
+          } else {
+            throw new Error(i18n.t('pageServerLed.toast.errorServerLedOff'));
+          }
+        });
     }
   }
 };
diff --git a/src/views/Control/ServerLed/ServerLed.vue b/src/views/Control/ServerLed/ServerLed.vue
index 0e5bf50..5b99e07 100644
--- a/src/views/Control/ServerLed/ServerLed.vue
+++ b/src/views/Control/ServerLed/ServerLed.vue
@@ -27,15 +27,16 @@
 </template>
 
 <script>
-import PageTitle from '../../../components/Global/PageTitle';
-import PageSection from '../../../components/Global/PageSection';
+import PageTitle from '@/components/Global/PageTitle';
+import PageSection from '@/components/Global/PageSection';
+import BVToastMixin from '@/components/Mixins/BVToastMixin';
 
 import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
 
 export default {
   name: 'ServerLed',
   components: { PageTitle, PageSection },
-  mixins: [LoadingBarMixin],
+  mixins: [LoadingBarMixin, BVToastMixin],
   computed: {
     indicatorLED: {
       get() {
@@ -43,7 +44,10 @@
       },
       set(newValue) {
         if (newValue) {
-          this.$store.dispatch('serverLed/saveIndicatorLedValue', newValue);
+          this.$store
+            .dispatch('serverLed/saveIndicatorLedValue', newValue)
+            .then(message => this.successToast(message))
+            .catch(({ message }) => this.errorToast(message));
         }
       }
     }