summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorDerick Montague <derick.montague@ibm.com>2021-02-15 04:21:44 +0300
committerDerick Montague <derick.montague@ibm.com>2021-03-09 21:29:59 +0300
commitda9f0a6e62ff0f70cb8e82d8489369003826f502 (patch)
tree6dba8feae0567e0965a2ff6fb076df5ad0f8ddae /src/store
parent8943eef40d9920be02f3dfb44f6d4ce43cf8edbd (diff)
downloadwebui-vue-da9f0a6e62ff0f70cb8e82d8489369003826f502.tar.xz
Add factory reset page
This new page will be included in the Control section of the primary navigation. The user will be able to choose between two different reset actions. The user can make the following calls: - /redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios - /redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: I32a10dbce27a03fb84e24d7eae7c44eef9cffea5
Diffstat (limited to 'src/store')
-rw-r--r--src/store/index.js2
-rw-r--r--src/store/modules/Control/FactoryResetStore.js32
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;