From da9f0a6e62ff0f70cb8e82d8489369003826f502 Mon Sep 17 00:00:00 2001 From: Derick Montague Date: Sun, 14 Feb 2021 19:21:44 -0600 Subject: 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 Change-Id: I32a10dbce27a03fb84e24d7eae7c44eef9cffea5 --- src/components/AppNavigation/AppNavigationMixin.js | 5 + src/env/components/AppNavigation/ibm.js | 5 + src/env/router/ibm.js | 9 ++ src/locales/en-US.json | 54 ++++++++-- src/router/routes.js | 9 ++ src/store/index.js | 2 + src/store/modules/Control/FactoryResetStore.js | 32 ++++++ src/views/Control/FactoryReset/FactoryReset.vue | 117 +++++++++++++++++++++ .../Control/FactoryReset/FactoryResetModal.vue | 113 ++++++++++++++++++++ src/views/Control/FactoryReset/index.js | 2 + 10 files changed, 341 insertions(+), 7 deletions(-) create mode 100644 src/store/modules/Control/FactoryResetStore.js create mode 100644 src/views/Control/FactoryReset/FactoryReset.vue create mode 100644 src/views/Control/FactoryReset/FactoryResetModal.vue create mode 100644 src/views/Control/FactoryReset/index.js (limited to 'src') diff --git a/src/components/AppNavigation/AppNavigationMixin.js b/src/components/AppNavigation/AppNavigationMixin.js index a83b6c7f..58852197 100644 --- a/src/components/AppNavigation/AppNavigationMixin.js +++ b/src/components/AppNavigation/AppNavigationMixin.js @@ -50,6 +50,11 @@ const AppNavigationMixin = { label: this.$t('appNavigation.control'), icon: 'iconControl', children: [ + { + id: 'factory-reset', + label: this.$t('appNavigation.factoryReset'), + route: '/control/factory-reset', + }, { id: 'kvm', label: this.$t('appNavigation.kvm'), diff --git a/src/env/components/AppNavigation/ibm.js b/src/env/components/AppNavigation/ibm.js index dadb65dd..d4b8e3dc 100644 --- a/src/env/components/AppNavigation/ibm.js +++ b/src/env/components/AppNavigation/ibm.js @@ -55,6 +55,11 @@ const AppNavigationMixin = { label: this.$t('appNavigation.control'), icon: 'iconControl', children: [ + { + id: 'factory-reset', + label: this.$t('appNavigation.factoryReset'), + route: '/control/factory-reset', + }, { id: 'manage-power-usage', label: this.$t('appNavigation.managePowerUsage'), diff --git a/src/env/router/ibm.js b/src/env/router/ibm.js index 317125e2..e0586e82 100644 --- a/src/env/router/ibm.js +++ b/src/env/router/ibm.js @@ -4,6 +4,7 @@ import ClientSessions from '@/views/AccessControl/ClientSessions'; import ConsoleLayout from '@/layouts/ConsoleLayout.vue'; import DateTimeSettings from '@/views/Configuration/DateTimeSettings'; import EventLogs from '@/views/Health/EventLogs'; +import FactoryReset from '@/views/Control/FactoryReset'; import Firmware from '@/views/Configuration/Firmware'; import HardwareStatus from '@/views/Health/HardwareStatus'; import Ldap from '@/views/AccessControl/Ldap'; @@ -205,6 +206,14 @@ const routes = [ title: i18n.t('appPageTitle.securitySettings'), }, }, + { + path: '/control/factory-reset', + name: 'factory-reset', + component: FactoryReset, + meta: { + title: i18n.t('appPageTitle.factoryReset'), + }, + }, { path: '/control/reboot-bmc', name: 'reboot-bmc', diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 745fcba8..7a5175a3 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -15,6 +15,7 @@ "filter": "Filter", "refresh": "Refresh", "replace": "Replace", + "reset": "Reset", "save": "Save", "saveSettings": "Save settings", "selected": "Selected" @@ -72,7 +73,7 @@ "itemsPerPage": "Items per page", "selectAll": "Select all", "selectItem": "Select item", - "selectedItems":"%{filterCount} of %{count} items", + "selectedItems": "%{filterCount} of %{count} items", "toDate": "To date", "viewAll": "View all" }, @@ -102,6 +103,7 @@ "dateTimeSettings": "@:appPageTitle.dateTimeSettings", "dumps": "@:appPageTitle.dumps", "eventLogs": "@:appPageTitle.eventLogs", + "factoryReset": "@:appPageTitle.factoryReset", "firmware": "@:appPageTitle.firmware", "hardwareStatus": "@:appPageTitle.hardwareStatus", "health": "Health", @@ -129,6 +131,7 @@ "dateTimeSettings": "Date and time settings", "dumps": "Dumps", "eventLogs": "Event logs", + "factoryReset": "Factory reset", "firmware": "Firmware", "hardwareStatus": "Hardware status", "kvm": "KVM", @@ -160,9 +163,9 @@ "newPassword": "New password", "username": "Username" }, - "pageClientSessions" : { + "pageClientSessions": { "action": { - "disconnect" : "Disconnect" + "disconnect": "Disconnect" }, "modal": { "disconnectTitle": "Disconnect session| Disconnect sessions", @@ -260,6 +263,43 @@ "successDelete": "Successfully deleted %{count} log. | Successfully deleted %{count} logs." } }, + "pageFactoryReset": { + "description": "These functions do not perform a secure delete of any sensitive data.", + "form": { + "resetOptionsLabel": "Reset options", + "resetBiosOptionLabel": "Reset host settings only", + "resetBiosOptionHelperText": "Resets firmware settings including: Platform keystore, partition NVRAM, and partition configurations.", + "resetToDefaultsOptionLabel": "Reset BMC and host settings", + "resetToDefaultsOptionHelperText": "In addition to host settings, this option resets BMC settings, including: all BMC account data, all changed passwords, all policies, LDAP configurations, network addresses, and time of day." + }, + "modal": { + "resetBiosTitle": "Reset host settings", + "resetBiosHeader": "Do you want to reset the host settings?", + "resetBiosSubmitText": "Reset host settings", + "resetBiosSettingsList": { + "item1": "All manual settings will be deleted.", + "item2": "Partition configurations and the platform keystore may be recovered if backups exist." + }, + "resetToDefaultsTitle": "Reset BMC and host settings", + "resetToDefaultsHeader": "Do you want to reset both the BMC and host settings?", + "resetToDefaultsSubmitText": "Reset BMC and host settings", + "resetToDefaultsSettingsList": { + "item1": "All manual settings will be deleted.", + "item2": "Partition configurations and the platform keystore may be recovered if backups exist.", + "item3": "All BMC logs will be erased.", + "item4": "Currently active sessions on all network interfaces will be disconnected.", + "item5": "The BMC default account and password settings will be restored." + }, + "resetWarningMessage": "Resetting without shutting down the system might cause an unrecoverable error.", + "resetWarningCheckLabel": "Continue without shutting down the system" + }, + "toast": { + "resetBiosSuccess": "Factory reset of host settings successful.", + "resetBiosError": "Factory reset of host settings failed.", + "resetToDefaultsSuccess": "Factory reset of BMC and host settings successful.", + "resetToDefaultsError": "Factory reset of BMC and host settings failed." + } + }, "pageFirmware": { "cardActionSwitchToRunning": "Switch to running", "cardBodyVersion": "Version", @@ -579,7 +619,7 @@ "currentPolicy": "Current Policy", "description": "Configure power policy to determine how the system starts after a power disturbance.", "powerPoliciesLabel": "Power restore policies", - "policies" :{ + "policies": { "AlwaysOn": "Always on", "AlwaysOff": "Always off", "LastState": "Last state" @@ -620,8 +660,8 @@ }, "toast": { "errorIpmiDisabled": "Error disabling IPMI security setting.", - "errorIpmiEnabled":"Error enabling IPMI security setting.", - "errorSshDisabled":"Error disabling SSH security setting.", + "errorIpmiEnabled": "Error enabling IPMI security setting.", + "errorSshDisabled": "Error disabling SSH security setting.", "errorSshEnabled": "Error enabling SSH security setting.", "successIpmiDisabled": "Successfully disabled IPMI security setting.", "successIpmiEnabled": "Successfully enabled IPMI security setting.", @@ -1019,4 +1059,4 @@ "ZW": "Zimbabwe", "AX": "Ă…land Islands" } -} \ No newline at end of file +} diff --git a/src/router/routes.js b/src/router/routes.js index 533f1859..e5812e00 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -3,6 +3,7 @@ import ChangePassword from '@/views/ChangePassword'; import ConsoleLayout from '@/layouts/ConsoleLayout.vue'; import DateTimeSettings from '@/views/Configuration/DateTimeSettings'; import EventLogs from '@/views/Health/EventLogs'; +import FactoryReset from '@/views/Control/FactoryReset'; import Firmware from '@/views/Configuration/Firmware'; import HardwareStatus from '@/views/Health/HardwareStatus'; import Kvm from '@/views/Control/Kvm'; @@ -181,6 +182,14 @@ const routes = [ title: i18n.t('appPageTitle.securitySettings'), }, }, + { + path: '/control/factory-reset', + name: 'factory-reset', + component: FactoryReset, + meta: { + title: i18n.t('appPageTitle.factoryReset'), + }, + }, { path: '/control/kvm', name: 'kvm', 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; diff --git a/src/views/Control/FactoryReset/FactoryReset.vue b/src/views/Control/FactoryReset/FactoryReset.vue new file mode 100644 index 00000000..897348fc --- /dev/null +++ b/src/views/Control/FactoryReset/FactoryReset.vue @@ -0,0 +1,117 @@ + + + diff --git a/src/views/Control/FactoryReset/FactoryResetModal.vue b/src/views/Control/FactoryReset/FactoryResetModal.vue new file mode 100644 index 00000000..bf92b173 --- /dev/null +++ b/src/views/Control/FactoryReset/FactoryResetModal.vue @@ -0,0 +1,113 @@ + + diff --git a/src/views/Control/FactoryReset/index.js b/src/views/Control/FactoryReset/index.js new file mode 100644 index 00000000..eae747e0 --- /dev/null +++ b/src/views/Control/FactoryReset/index.js @@ -0,0 +1,2 @@ +import FactoryReset from './FactoryReset.vue'; +export default FactoryReset; -- cgit v1.2.3