diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-12-02 03:38:47 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-12-02 22:47:36 +0300 |
commit | 11bafca85ee2c3f4d4fac5f2ea6b874059099211 (patch) | |
tree | cedac65385022d1c5fb9475995de67c1d1e63ad6 /src | |
parent | 6483544a7be8f86b37ce817b6cb7ac93db6e322a (diff) | |
download | webui-vue-11bafca85ee2c3f4d4fac5f2ea6b874059099211.tar.xz |
Fix server LED switch value on error
Add error state handling in the ServerLed store to make sure the
UI accurately reflects the state if there is an error.
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I7f3647df9f5a32e241005eb7058a7cda1e0ba36a
Diffstat (limited to 'src')
-rw-r--r-- | src/store/modules/Control/ServerLedStore.js | 3 | ||||
-rw-r--r-- | src/views/Control/ServerLed/ServerLed.vue | 4 | ||||
-rw-r--r-- | src/views/Overview/OverviewQuickLinks.vue | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/src/store/modules/Control/ServerLedStore.js b/src/store/modules/Control/ServerLedStore.js index d7c12344..a8903e2a 100644 --- a/src/store/modules/Control/ServerLedStore.js +++ b/src/store/modules/Control/ServerLedStore.js @@ -27,12 +27,12 @@ const ServerLedStore = { .catch((error) => console.log(error)); }, async saveIndicatorLedActiveState({ commit }, payload) { + commit('setIndicatorLedActiveState', payload); return await api .patch('/redfish/v1/Systems/system', { LocationIndicatorActive: payload, }) .then(() => { - commit('setIndicatorLedActiveState', payload); if (payload) { return i18n.t('pageServerLed.toast.successServerLedOn'); } else { @@ -41,6 +41,7 @@ const ServerLedStore = { }) .catch((error) => { console.log(error); + commit('setIndicatorLedActiveState', !payload); if (payload) { throw new Error(i18n.t('pageServerLed.toast.errorServerLedOn')); } else { diff --git a/src/views/Control/ServerLed/ServerLed.vue b/src/views/Control/ServerLed/ServerLed.vue index e5c6dac8..72726bab 100644 --- a/src/views/Control/ServerLed/ServerLed.vue +++ b/src/views/Control/ServerLed/ServerLed.vue @@ -64,9 +64,7 @@ export default { indicatorLedActiveState ) .then((message) => this.successToast(message)) - .catch(({ message }) => { - this.errorToast(message); - }); + .catch(({ message }) => this.errorToast(message)); }, }, }; diff --git a/src/views/Overview/OverviewQuickLinks.vue b/src/views/Overview/OverviewQuickLinks.vue index 82975f57..1b84ce7a 100644 --- a/src/views/Overview/OverviewQuickLinks.vue +++ b/src/views/Overview/OverviewQuickLinks.vue @@ -92,9 +92,7 @@ export default { indicatorLedActiveState ) .then((message) => this.successToast(message)) - .catch(({ message }) => { - this.errorToast(message); - }); + .catch(({ message }) => this.errorToast(message)); }, }, }; |