diff --git a/src/assets/styles/bmc/custom/_forms.scss b/src/assets/styles/bmc/custom/_forms.scss index 07851dcd4f..d70a7df0a8 100644 --- a/src/assets/styles/bmc/custom/_forms.scss +++ b/src/assets/styles/bmc/custom/_forms.scss @@ -127,7 +127,7 @@ div[role='group'] { .form-check-input[disabled='disabled'], .form-check-input:disabled { background-color: $gray-200; - opacity: 1; + opacity: 0.5; & + .form-check-label { // Disabled label for checkbox, radio, // switch bootstrap form components diff --git a/src/router/routes.js b/src/router/routes.js index a1c6c94a07..c45a58d08a 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -26,6 +26,7 @@ import Firmware from '@/views/Operations/Firmware'; import Certificates from '@/views/SecurityAndAccess/Certificates'; import Inventory from '../views/HardwareStatus/Inventory/Inventory.vue'; import SystemParameters from '@/views/ResourceManagement/SystemParameters'; +import HardwareDeconfiguration from '../views/Settings/HardwareDeconfiguration/HardwareDeconfiguration.vue'; const roles = { administrator: 'Administrator', @@ -175,6 +176,14 @@ export const routes = [ title: i18n.global.t('appPageTitle.powerRestorePolicy'), }, }, + { + path: '/settings/hardware-deconfiguration', + name: 'hardware-deconfiguration', + component: HardwareDeconfiguration, + meta: { + title: i18n.global.t('appPageTitle.deconfigurationHardware'), + }, + }, { path: '/resource-management/power', name: 'power', diff --git a/src/store/index.js b/src/store/index.js index 700f4ba044..43b746bdb5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -29,6 +29,7 @@ import SystemParametersStore from './modules/ResourceManagement/SystemParameters import CertificatesStore from './modules/SecurityAndAccess/CertificatesStore'; import UserManagementStore from './modules/SecurityAndAccess/UserManagementStore'; import PcieTopologyStore from './modules/HardwareStatus/PcieTopologyStore.js'; +import HardwareDeconfigurationStore from './modules/Settings/HardwareDeconfigurationStore'; // ... (export use other stores) export { EventLogStore, @@ -60,5 +61,6 @@ export { SystemParametersStore, CertificatesStore, UserManagementStore, - PcieTopologyStore + PcieTopologyStore, + HardwareDeconfigurationStore, }; diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js index 1b72180b4a..37a7961e80 100644 --- a/src/store/modules/GlobalStore.js +++ b/src/store/modules/GlobalStore.js @@ -63,6 +63,8 @@ export const GlobalStore = defineStore('global', { currentUserGetter: (state) => state.currentUser, isServiceUser: (state) => state.currentUser?.RoleId === 'OemIBMServiceAgent' || !state.currentUser, + isReadOnlyUserGetter: (state) => + state.currentUser?.RoleId === 'ReadOnly' || !state.currentUser, }, actions: { async getBmcTime() { diff --git a/src/store/modules/Settings/HardwareDeconfigurationStore.js b/src/store/modules/Settings/HardwareDeconfigurationStore.js index 2746158fc9..f32d825f1c 100644 --- a/src/store/modules/Settings/HardwareDeconfigurationStore.js +++ b/src/store/modules/Settings/HardwareDeconfigurationStore.js @@ -1,222 +1,162 @@ import api from '@/store/api'; import i18n from '@/i18n'; import { REGEX_MAPPINGS } from '@/utilities/GlobalConstants'; +import { defineStore } from 'pinia'; -const HardwareDeconfigurationStore = { - namespaced: true, - state: { +export const HardwareDeconfigurationStore = defineStore('hardwareDeconfiguration', { + state: () => ({ dimms: [], cores: [], - }, + }), getters: { - dimms: (state) => state.dimms, - cores: (state) => state.cores, - }, - mutations: { - setDimms: (state, dimms) => (state.dimms = dimms), - setCores: (state, cores) => (state.cores = cores), + dimmsGetter: (state) => state.dimms, + coresGetter: (state) => state.cores, }, + actions: { async getProcessorsCollection() { return await api - .get('/redfish/v1/Systems/system/Processors') - .then(({ data: { Members } }) => - Members.map((member) => member['@odata.id']), - ) + .get('/redfish/v1/Systems/system/Processors?$expand=.($levels=2)') + .then(({ data: { Members } }) => Members) .catch((error) => console.log(error)); }, - async getProcessors({ commit, dispatch }) { - const collection = await dispatch('getProcessorsCollection'); + async getProcessors() { + let totalCores = []; + const collection = await this.getProcessorsCollection(); if (!collection) return; - await api - .all(collection.map((processor) => dispatch('getCores', processor))) - .then((response) => { - var totalCores = [].concat.apply([], response); - commit('setCores', totalCores); - }); + collection.map((processor) => + this.getCores(processor).then((response) => { + totalCores = [].concat.apply(totalCores, response); + this.cores = totalCores; + }) + ); }, - - async getCores(_, id) { - const locationCode = await api - .get(`${id}`) - .then((response) => response.data.Location.PartLocation.ServiceLabel) - .catch((error) => console.log(error)); - const procId = await api - .get(`${id}`) - .then((response) => response.data.Id) - .catch((error) => console.log(error)); + async getCores(processor) { + const locationCode = processor.Location.PartLocation.ServiceLabel; + const procId = processor.Id; const cores = await api - .get(`${id}/SubProcessors`) - .then((response) => response.data.Members) - .catch((error) => console.log(error)); + .get(`${processor['@odata.id']}/SubProcessors?$expand=.($levels=2)`) + .then((response) => response.data.Members); if (!cores) return; - const promises = cores.map((core) => { - return api.get(core['@odata.id']).catch((error) => { - console.log(error); - return error; - }); + const coreData = cores.map((data) => { + var msgArgs = 'None'; + var eventId = ''; + const conditionsArray = data.Status?.Conditions; + if (Array.isArray(conditionsArray) && conditionsArray.length) { + const messageArgsArray = conditionsArray[0].MessageArgs; + if (Array.isArray(messageArgsArray) && messageArgsArray.length) { + msgArgs = messageArgsArray[0]; + } + const logEntry = conditionsArray[0].LogEntry; + if (logEntry) { + const eventIdUrl = logEntry['@odata.id']; + const splitUrl = eventIdUrl.split('/'); + eventId = splitUrl[splitUrl.length - 1]; + } + } + return { + name: data.Name, + status: data.Status.Health, + id: data.Id, + location: locationCode, + functionalState: data.Status?.Health, + settings: data.Enabled, + uri: data['@odata.id'], + deconfigurationType: + msgArgs === 'By Association' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.byAssociation') + : msgArgs === 'Error' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.error') + : msgArgs === 'Fatal' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.fatal') + : msgArgs === 'FCO-Deconfigured' + ? i18n.global.t( + 'pageDeconfigurationHardware.table.filter.fcoDeconfigured' + ) + : msgArgs === 'Invalid' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.invalid') + : msgArgs === 'Manual' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.manual') + : msgArgs === 'None' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.none') + : msgArgs === 'Predictive' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.predictive') + : msgArgs === 'Recovered' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.recovered') + : msgArgs === 'Unknown' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.unknown') + : msgArgs, + processorId: procId, + eventID: eventId, + }; }); - return await api.all(promises).then( - api.spread((...responses) => { - const coreData = responses.map(({ data }) => { - var msgArgs = 'None'; - var eventId = ''; - const conditionsArray = data.Status?.Conditions; - if (Array.isArray(conditionsArray) && conditionsArray.length) { - const messageArgsArray = conditionsArray[0].MessageArgs; - if (Array.isArray(messageArgsArray) && messageArgsArray.length) { - msgArgs = messageArgsArray[0]; - } - const logEntry = conditionsArray[0].LogEntry; - if (logEntry) { - const eventIdUrl = logEntry['@odata.id']; - const splitUrl = eventIdUrl.split('/'); - eventId = splitUrl[splitUrl.length - 1]; - } - } - return { - name: data.Name, - status: data.Status.Health, - id: data.Id, - location: locationCode, - functionalState: data.Status?.Health, - settings: data.Enabled, - uri: data['@odata.id'], - deconfigurationType: - msgArgs === 'By Association' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.byAssociation', - ) - : msgArgs === 'Error' - ? i18n.t('pageDeconfigurationHardware.table.filter.error') - : msgArgs === 'Fatal' - ? i18n.t('pageDeconfigurationHardware.table.filter.fatal') - : msgArgs === 'FCO-Deconfigured' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.fcoDeconfigured', - ) - : msgArgs === 'Invalid' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.invalid', - ) - : msgArgs === 'Manual' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.manual', - ) - : msgArgs === 'None' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.none', - ) - : msgArgs === 'Predictive' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.predictive', - ) - : msgArgs === 'Recovered' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.recovered', - ) - : msgArgs === 'Unknown' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.unknown', - ) - : msgArgs, - processorId: procId, - eventID: eventId, - }; - }); - return coreData; - }), - ); + return coreData; }, - async getDimms({ commit }) { + async getDimms() { const dimms = await api - .get('/redfish/v1/Systems/system/Memory') + .get('/redfish/v1/Systems/system/Memory?$expand=.($levels=2)') .then((response) => response.data.Members) .catch((error) => console.log(error)); if (!dimms) return; - const promises = dimms.map((dimm) => { - return api.get(dimm['@odata.id']).catch((error) => { - console.log(error); - return error; - }); + const dimmsData = dimms.map((data) => { + var msgArgs = 'None'; + var eventId = ''; + const conditionsArray = data.Status?.Conditions; + if (Array.isArray(conditionsArray) && conditionsArray.length) { + const messageArgsArray = conditionsArray[0].MessageArgs; + if (Array.isArray(messageArgsArray) && messageArgsArray.length) { + msgArgs = messageArgsArray[0]; + } + const logEntry = conditionsArray[0].LogEntry; + if (logEntry) { + const eventIdUrl = logEntry['@odata.id']; + const splitUrl = eventIdUrl.split('/'); + eventId = splitUrl[splitUrl.length - 1]; + } + } + return { + id: data.Id, + name: data.Name, + functionalState: data.Status?.Health, + size: data.CapacityMiB, + locationCode: data.Location?.PartLocation?.ServiceLabel, + deconfigurationType: + msgArgs === 'By Association' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.byAssociation') + : msgArgs === 'Error' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.error') + : msgArgs === 'Fatal' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.fatal') + : msgArgs === 'FCO-Deconfigured' + ? i18n.global.t( + 'pageDeconfigurationHardware.table.filter.fcoDeconfigured' + ) + : msgArgs === 'Invalid' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.invalid') + : msgArgs === 'Manual' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.manual') + : msgArgs === 'None' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.none') + : msgArgs === 'Predictive' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.predictive') + : msgArgs === 'Recovered' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.recovered') + : msgArgs === 'Unknown' + ? i18n.global.t('pageDeconfigurationHardware.table.filter.unknown') + : msgArgs, + settings: data.Enabled, + uri: data['@odata.id'], + available: data.Status?.State, + eventID: eventId, + }; }); - return await api.all(promises).then( - api.spread((...responses) => { - const dimmsData = responses.map(({ data }) => { - var msgArgs = 'None'; - var eventId = ''; - const conditionsArray = data.Status?.Conditions; - if (Array.isArray(conditionsArray) && conditionsArray.length) { - const messageArgsArray = conditionsArray[0].MessageArgs; - if (Array.isArray(messageArgsArray) && messageArgsArray.length) { - msgArgs = messageArgsArray[0]; - } - const logEntry = conditionsArray[0].LogEntry; - if (logEntry) { - const eventIdUrl = logEntry['@odata.id']; - const splitUrl = eventIdUrl.split('/'); - eventId = splitUrl[splitUrl.length - 1]; - } - } - return { - id: data.Id, - name: data.Name, - functionalState: data.Status?.Health, - size: data.CapacityMiB, - locationCode: data.Location?.PartLocation?.ServiceLabel, - deconfigurationType: - msgArgs === 'By Association' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.byAssociation', - ) - : msgArgs === 'Error' - ? i18n.t('pageDeconfigurationHardware.table.filter.error') - : msgArgs === 'Fatal' - ? i18n.t('pageDeconfigurationHardware.table.filter.fatal') - : msgArgs === 'FCO-Deconfigured' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.fcoDeconfigured', - ) - : msgArgs === 'Invalid' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.invalid', - ) - : msgArgs === 'Manual' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.manual', - ) - : msgArgs === 'None' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.none', - ) - : msgArgs === 'Predictive' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.predictive', - ) - : msgArgs === 'Recovered' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.recovered', - ) - : msgArgs === 'Unknown' - ? i18n.t( - 'pageDeconfigurationHardware.table.filter.unknown', - ) - : msgArgs, - settings: data.Enabled, - uri: data['@odata.id'], - available: data.Status?.State, - eventID: eventId, - }; - }); - const dimmsDataFiltered = dimmsData.filter( - (item) => item.available !== 'Absent', - ); - commit('setDimms', dimmsDataFiltered); - }), + const dimmsDataFiltered = dimmsData.filter( + (item) => item.available !== 'Absent' ); + this.dimms = dimmsDataFiltered; }, - async updateSettingsState(_, settingsState) { + async updateSettingsState(settingsState) { const uri = settingsState.uri; const updatedSettingsValue = { Enabled: settingsState.settings, @@ -228,20 +168,20 @@ const HardwareDeconfigurationStore = { if (REGEX_MAPPINGS.resourceCannotBeDeleted.test(messageId)) { throw new Error( - i18n.t('pageDeconfigurationHardware.toast.deleteReqFailed'), + i18n.global.t('pageDeconfigurationHardware.toast.deleteReqFailed') ); } else if (settingsState.settings) { throw new Error( - i18n.t('pageDeconfigurationHardware.toast.errorEnablingSetting'), + i18n.global.t('pageDeconfigurationHardware.toast.errorEnablingSetting') ); } else { throw new Error( - i18n.t('pageDeconfigurationHardware.toast.errorDisablingSetting'), + i18n.global.t('pageDeconfigurationHardware.toast.errorDisablingSetting') ); } }); }, - async updateCoresSettingsState(_, settingsState) { + async updateCoresSettingsState(settingsState) { const uri = settingsState.uri; const updatedSettingsValue = { Enabled: settingsState.settings, @@ -253,20 +193,20 @@ const HardwareDeconfigurationStore = { if (REGEX_MAPPINGS.resourceCannotBeDeleted.test(messageId)) { throw new Error( - i18n.t('pageDeconfigurationHardware.toast.deleteReqFailed'), + i18n.global.t('pageDeconfigurationHardware.toast.deleteReqFailed') ); } else if (settingsState.settings) { throw new Error( - i18n.t('pageDeconfigurationHardware.toast.errorEnablingSetting'), + i18n.global.t('pageDeconfigurationHardware.toast.errorEnablingSetting') ); } else { throw new Error( - i18n.t('pageDeconfigurationHardware.toast.errorDisablingSetting'), + i18n.global.t('pageDeconfigurationHardware.toast.errorDisablingSetting') ); } }); }, }, -}; +}); export default HardwareDeconfigurationStore; diff --git a/src/views/Settings/HardwareDeconfiguration/HardwareDeconfiguration.vue b/src/views/Settings/HardwareDeconfiguration/HardwareDeconfiguration.vue index f6ae798937..f8c4228d61 100644 --- a/src/views/Settings/HardwareDeconfiguration/HardwareDeconfiguration.vue +++ b/src/views/Settings/HardwareDeconfiguration/HardwareDeconfiguration.vue @@ -1,23 +1,23 @@ - + - - + + {{ $t('pageDeconfigurationHardware.alert.message') }} - - + + - - + + @@ -28,32 +28,28 @@ - - + + - + - diff --git a/src/views/Settings/HardwareDeconfiguration/MemoryDimms.vue b/src/views/Settings/HardwareDeconfiguration/MemoryDimms.vue index 50d5816957..d467571f22 100644 --- a/src/views/Settings/HardwareDeconfiguration/MemoryDimms.vue +++ b/src/views/Settings/HardwareDeconfiguration/MemoryDimms.vue @@ -1,26 +1,27 @@ - - - + + + - - - - - + + + + - {{ $t('pageDeconfigurationHardware.deconfigure') }} - + - - - + + + - - + + - - + + - - - + + + - + }; + + \ No newline at end of file diff --git a/src/views/Settings/HardwareDeconfiguration/ProcessorCores.vue b/src/views/Settings/HardwareDeconfiguration/ProcessorCores.vue index 567a796d37..dde6b3bf54 100644 --- a/src/views/Settings/HardwareDeconfiguration/ProcessorCores.vue +++ b/src/views/Settings/HardwareDeconfiguration/ProcessorCores.vue @@ -1,39 +1,40 @@ - - - + + + - - - - + + + + - {{ $t('pageDeconfigurationHardware.deconfigure') }} - + - - + + - - - + + - - - + + + - - - + + + - + \ No newline at end of file