diff options
author | SurenNeware <sneware9@in.ibm.com> | 2020-06-22 19:23:33 +0300 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2020-07-06 18:52:27 +0300 |
commit | 31bf55af576d192c116efca34675755c4c8deea2 (patch) | |
tree | 2ea1e346ac4f9bb80f090139fb0107b3e10e6602 /src/store | |
parent | 1e2d70a29c5156b844b432f93facef430205ccb4 (diff) | |
download | webui-vue-31bf55af576d192c116efca34675755c4c8deea2.tar.xz |
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
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/Control/ServerLedStore.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/store/modules/Control/ServerLedStore.js b/src/store/modules/Control/ServerLedStore.js index 54faf591..6ea0473c 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 @@ const ServerLedStore = { }, 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 @@ const ServerLedStore = { .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')); + } + }); } } }; |