diff options
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/HardwareStatus/AssemblyStore.js | 33 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/BmcStore.js | 9 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/ChassisStore.js | 9 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/MemoryStore.js | 33 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/ProcessorStore.js | 33 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/SystemStore.js | 7 |
6 files changed, 89 insertions, 35 deletions
diff --git a/src/store/modules/HardwareStatus/AssemblyStore.js b/src/store/modules/HardwareStatus/AssemblyStore.js index c6ab7cf7..13cdbbc9 100644 --- a/src/store/modules/HardwareStatus/AssemblyStore.js +++ b/src/store/modules/HardwareStatus/AssemblyStore.js @@ -54,17 +54,28 @@ const AssemblyStore = { ], }; - return await api.patch(uri, updatedIdentifyLedValue).catch((error) => { - dispatch('getAssemblyInfo'); - console.log('error', error); - if (led.identifyLed) { - throw new Error(i18n.t('pageInventory.toast.errorEnableIdentifyLed')); - } else { - throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), - ); - } - }); + return await api + .patch(uri, updatedIdentifyLedValue) + .then(() => { + if (led.identifyLed) { + return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + } else { + return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + } + }) + .catch((error) => { + dispatch('getAssemblyInfo'); + console.log('error', error); + if (led.identifyLed) { + throw new Error( + i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + ); + } else { + throw new Error( + i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + ); + } + }); }, }, }; diff --git a/src/store/modules/HardwareStatus/BmcStore.js b/src/store/modules/HardwareStatus/BmcStore.js index f225e925..d96926ea 100644 --- a/src/store/modules/HardwareStatus/BmcStore.js +++ b/src/store/modules/HardwareStatus/BmcStore.js @@ -58,7 +58,14 @@ const BmcStore = { }; return await api .patch(uri, updatedIdentifyLedValue) - .then(() => dispatch('getBmcInfo')) + .then(() => { + dispatch('getBmcInfo'); + if (led.identifyLed) { + return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + } else { + return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + } + }) .catch((error) => { dispatch('getBmcInfo'); console.log('error', error); diff --git a/src/store/modules/HardwareStatus/ChassisStore.js b/src/store/modules/HardwareStatus/ChassisStore.js index 6f2d74a2..7e591ad2 100644 --- a/src/store/modules/HardwareStatus/ChassisStore.js +++ b/src/store/modules/HardwareStatus/ChassisStore.js @@ -72,7 +72,14 @@ const ChassisStore = { }; return await api .patch(uri, updatedIdentifyLedValue) - .then(() => dispatch('getChassisInfo')) + .then(() => { + dispatch('getChassisInfo'); + if (led.identifyLed) { + return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + } else { + return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + } + }) .catch((error) => { dispatch('getChassisInfo'); console.log('error', error); diff --git a/src/store/modules/HardwareStatus/MemoryStore.js b/src/store/modules/HardwareStatus/MemoryStore.js index 86b77c0a..787a0502 100644 --- a/src/store/modules/HardwareStatus/MemoryStore.js +++ b/src/store/modules/HardwareStatus/MemoryStore.js @@ -73,17 +73,28 @@ const MemoryStore = { const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, }; - return await api.patch(uri, updatedIdentifyLedValue).catch((error) => { - dispatch('getDimms'); - console.log('error', error); - if (led.identifyLed) { - throw new Error(i18n.t('pageInventory.toast.errorEnableIdentifyLed')); - } else { - throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), - ); - } - }); + return await api + .patch(uri, updatedIdentifyLedValue) + .then(() => { + if (led.identifyLed) { + return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + } else { + return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + } + }) + .catch((error) => { + dispatch('getDimms'); + console.log('error', error); + if (led.identifyLed) { + throw new Error( + i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + ); + } else { + throw new Error( + i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + ); + } + }); }, }, }; diff --git a/src/store/modules/HardwareStatus/ProcessorStore.js b/src/store/modules/HardwareStatus/ProcessorStore.js index 29fb9989..49f96208 100644 --- a/src/store/modules/HardwareStatus/ProcessorStore.js +++ b/src/store/modules/HardwareStatus/ProcessorStore.js @@ -81,17 +81,28 @@ const ProcessorStore = { const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, }; - return await api.patch(uri, updatedIdentifyLedValue).catch((error) => { - dispatch('getProcessorsInfo'); - console.log('error', error); - if (led.identifyLed) { - throw new Error(i18n.t('pageInventory.toast.errorEnableIdentifyLed')); - } else { - throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), - ); - } - }); + return await api + .patch(uri, updatedIdentifyLedValue) + .then(() => { + if (led.identifyLed) { + return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + } else { + return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + } + }) + .catch((error) => { + dispatch('getProcessorsInfo'); + console.log('error', error); + if (led.identifyLed) { + throw new Error( + i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + ); + } else { + throw new Error( + i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + ); + } + }); }, }, }; diff --git a/src/store/modules/HardwareStatus/SystemStore.js b/src/store/modules/HardwareStatus/SystemStore.js index f1382348..ea519d73 100644 --- a/src/store/modules/HardwareStatus/SystemStore.js +++ b/src/store/modules/HardwareStatus/SystemStore.js @@ -49,6 +49,13 @@ const SystemStore = { .patch('/redfish/v1/Systems/system', { LocationIndicatorActive: ledState, }) + .then(() => { + if (ledState) { + return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + } else { + return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + } + }) .catch((error) => { commit('setSystemInfo', this.state.system.systems[0]); console.log('error', error); |