diff options
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/index.js | 2 | ||||
-rw-r--r-- | src/store/modules/Control/FactoryResetStore.js | 32 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/store/index.js b/src/store/index.js index fd8b1fcf..93386b1a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -24,6 +24,7 @@ import ChassisStore from './modules/Health/ChassisStore'; import BmcStore from './modules/Health/BmcStore'; import ProcessorStore from './modules/Health/ProcessorStore'; import SecuritySettingsStore from './modules/Configuration/SecuritySettingsStore'; +import FactoryResetStore from './modules/Control/FactoryResetStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; import DateTimeStore from './modules/Configuration/DateTimeSettingsStore'; @@ -61,6 +62,7 @@ export default new Vuex.Store({ processors: ProcessorStore, virtualMedia: VirtualMediaStore, securitySettings: SecuritySettingsStore, + factoryReset: FactoryResetStore, }, plugins: [WebSocketPlugin], }); diff --git a/src/store/modules/Control/FactoryResetStore.js b/src/store/modules/Control/FactoryResetStore.js new file mode 100644 index 00000000..8118cf7f --- /dev/null +++ b/src/store/modules/Control/FactoryResetStore.js @@ -0,0 +1,32 @@ +import api from '@/store/api'; +import i18n from '@/i18n'; + +const FactoryResetStore = { + namespaced: true, + actions: { + async resetToDefaults() { + return await api + .post('/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults', { + ResetToDefaultsType: 'ResetAll', + }) + .then(() => i18n.t('pageFactoryReset.toast.resetToDefaultsSuccess')) + .catch((error) => { + console.log('Factory Reset: ', error); + throw new Error( + i18n.t('pageFactoryReset.toast.resetToDefaultsError') + ); + }); + }, + async resetBios() { + return await api + .post('/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios') + .then(() => i18n.t('pageFactoryReset.toast.resetBiosSuccess')) + .catch((error) => { + console.log('Factory Reset: ', error); + throw new Error(i18n.t('pageFactoryReset.toast.resetBiosError')); + }); + }, + }, +}; + +export default FactoryResetStore; |