diff --git a/src/assets/styles/bmc/custom/_card.scss b/src/assets/styles/bmc/custom/_card.scss index 736ded97b5..fdb7b145cb 100644 --- a/src/assets/styles/bmc/custom/_card.scss +++ b/src/assets/styles/bmc/custom/_card.scss @@ -2,6 +2,7 @@ .bg-success { background-color: theme-color-light($success) !important; } + width: 120%; } .card-header, diff --git a/src/assets/styles/bmc/custom/_tables.scss b/src/assets/styles/bmc/custom/_tables.scss index c325f01074..91f49c5d13 100644 --- a/src/assets/styles/bmc/custom/_tables.scss +++ b/src/assets/styles/bmc/custom/_tables.scss @@ -2,6 +2,7 @@ .b-table-sticky-header { max-height: 75vh; min-height: 100px; + min-width: 116%; border: 1px solid #efefef; .table.b-table { thead { @@ -18,7 +19,6 @@ // background-color: $light; // } // } - vertical-align: middle; border-top: 1px solid $gray-300; border-bottom: 1px solid $gray-300; @@ -52,6 +52,7 @@ .table { position: relative; z-index: $zindex-dropdown; + overflow-x: visible; td { border-top: 1px solid $gray-300; diff --git a/src/components/Composables/useJumpLinkComposable.js b/src/components/Composables/useJumpLinkComposable.js index ff9104d2e5..34b6c88519 100644 --- a/src/components/Composables/useJumpLinkComposable.js +++ b/src/components/Composables/useJumpLinkComposable.js @@ -17,9 +17,25 @@ const useJumpLinkComposable = () => { behavior: 'smooth', }); }; + const scrollToOffsetInventory = (refs, event, index) => { + // Select element to scroll to + const ref = event.target.getAttribute('data-ref'); + const element = refs[ref][index].$el; + + // Set focus and tabindex on selected element + setFocus(element); + + // Set scroll offset below header + const offset = element.offsetTop + 300; + window.scroll({ + top: offset, + behavior: 'smooth', + }); + }; return { setFocus, scrollToOffset, + scrollToOffsetInventory, }; }; diff --git a/src/components/Composables/useSearchFilterComposable.js b/src/components/Composables/useSearchFilterComposable.js index 803e4aaa3a..24946b3de7 100644 --- a/src/components/Composables/useSearchFilterComposable.js +++ b/src/components/Composables/useSearchFilterComposable.js @@ -1,14 +1,18 @@ -export const searchFilter = null; +import { ref } from 'vue'; const useSearchFilterComposable = () => { - const onChangeSearchInput = (searchValue) => { - return searchValue; + let searchFilterInput = ref(''); + const onChangeSearch = (searchValue) => { + searchFilterInput.value = searchValue; + return; }; - const onClearSearchInput = () => { - return null; + const onClearSearch = () => { + searchFilterInput.value = ''; + return; }; return { - onChangeSearchInput, - onClearSearchInput, + searchFilterInput, + onChangeSearch, + onClearSearch, }; }; diff --git a/src/components/Composables/useTableRowExpandComposable.js b/src/components/Composables/useTableRowExpandComposable.js index f05b51df74..800cad0d61 100644 --- a/src/components/Composables/useTableRowExpandComposable.js +++ b/src/components/Composables/useTableRowExpandComposable.js @@ -7,10 +7,14 @@ const useTableRowExpandComposable = () => { ? i18n.global.t('global.table.collapseTableRow') : i18n.global.t('global.table.expandTableRow'); }; - + const toggleRow = (row) => { + row.item.toggleDetails = !row.item.toggleDetails; + toggleRowDetails(row); + }; return { expandRowLabel, toggleRowDetails, + toggleRow, }; }; diff --git a/src/components/Global/InfoTooltip.vue b/src/components/Global/InfoTooltip.vue index cc9cd0d453..7c502799cf 100644 --- a/src/components/Global/InfoTooltip.vue +++ b/src/components/Global/InfoTooltip.vue @@ -30,5 +30,6 @@ defineProps({ svg { vertical-align: baseline; } + overflow: visible; } diff --git a/src/components/Global/Search.vue b/src/components/Global/Search.vue index ec58134d52..230b5c226a 100644 --- a/src/components/Global/Search.vue +++ b/src/components/Global/Search.vue @@ -40,9 +40,9 @@ import IconSearch from '@carbon/icons-vue/es/search/16'; import IconClose from '@carbon/icons-vue/es/close/20'; import { useI18n } from 'vue-i18n'; -import { ref, watch, defineEmits } from 'vue'; -import eventBus from '@/eventBus'; - +import { ref, defineEmits } from 'vue'; +import i18n from '@/i18n'; +// eslint-disable-next-line vue/valid-define-emits const emit = defineEmits(); const { t } = useI18n(); @@ -50,7 +50,7 @@ const props = defineProps({ placeholder: { type: String, default: function () { - return this.t('global.form.search'); + return i18n.global.t('global.form.search'); }, }, isSearchDisabled: { diff --git a/src/router/routes.js b/src/router/routes.js index dfaf892e2d..847eb48c13 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,4 +1,5 @@ //TODO: Work Requird --> + import i18n from '@/i18n'; import LoginLayout from '@/layouts/LoginLayout.vue'; import LoginPage from '@/views/Login/Login.vue'; @@ -21,6 +22,7 @@ import IBMiServiceFunctions from '@/views/Logs/IBMiServiceFunctions'; import Notices from '@/views/Notices/Notices.vue'; import Sessions from '@/views/SecurityAndAccess/Sessions'; import Firmware from '@/views/Operations/Firmware'; +import Inventory from '../views/HardwareStatus/Inventory/Inventory.vue'; const roles = { administrator: 'Administrator', @@ -78,6 +80,14 @@ export const routes = [ component: ConcurrentMaintenance, meta: { title: i18n.global.t('appPageTitle.concurrentMaintenance'), + } + }, + { + path: '/hardware-status/inventory', + name: 'inventory', + component: Inventory, + meta: { + title: i18n.global.t('appPageTitle.inventory'), }, }, { diff --git a/src/store/index.js b/src/store/index.js index b8f62cceda..e380047aea 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,7 +18,13 @@ import AuditLogsStore from './modules/Logs/AuditLogsStore'; import SessionsStore from './modules/SecurityAndAccess/SessionsStore.js'; import LicenseStore from './modules/ResourceManagement/LicenseStore'; import BmcStore from './modules/HardwareStatus/BmcStore'; - +import ChassisStore from './modules/HardwareStatus/ChassisStore'; +import PowerSupplyStore from './modules/HardwareStatus/PowerSupplyStore'; +import PcieSlotsStore from './modules/HardwareStatus/PcieSlotsStore'; +import FanStore from './modules/HardwareStatus/FanStore'; +import MemoryStore from './modules/HardwareStatus/MemoryStore'; +import AssemblyStore from './modules/HardwareStatus/AssemblyStore'; +import FabricAdaptersStore from './modules/HardwareStatus/FabricAdaptersStore'; // ... (export use other stores) export { EventLogStore, @@ -39,5 +45,12 @@ export { AuditLogsStore, SessionsStore, LicenseStore, + ChassisStore, + PowerSupplyStore, + PcieSlotsStore, + FanStore, + MemoryStore, BmcStore, + AssemblyStore, + FabricAdaptersStore, }; diff --git a/src/store/modules/HardwareStatus/AssemblyStore.js b/src/store/modules/HardwareStatus/AssemblyStore.js index 36a2bbd340..fa4a17ca91 100644 --- a/src/store/modules/HardwareStatus/AssemblyStore.js +++ b/src/store/modules/HardwareStatus/AssemblyStore.js @@ -1,13 +1,14 @@ import api from '@/store/api'; import i18n from '@/i18n'; +import { defineStore } from 'pinia'; -const AssemblyStore = { +export const AssemblyStore = defineStore('assemblyStore', { namespaced: true, - state: { + state: () => ({ assemblies: null, - }, + }), getters: { - assemblies: (state) => state.assemblies, + assembliesGetter: (state) => state.assemblies, }, mutations: { setAssemblyInfo: (state, data) => { @@ -40,14 +41,42 @@ const AssemblyStore = { }, }, actions: { - async getAssemblyInfo({ commit }, requestBody) { - commit('setAssemblyInfo', []); + setAssemblyInfo(data) { + this.assemblies = data.map((assembly) => { + const { + MemberId, + PartNumber, + SerialNumber, + SparePartNumber, + Model, + Name, + Location, + Status, + LocationIndicatorActive, + } = assembly; + return { + id: MemberId, + health: Status?.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + sparePartNumber: SparePartNumber, + model: Model, + name: Name, + locationNumber: Location?.PartLocation?.ServiceLabel, + identifyLed: LocationIndicatorActive, + status: Status?.State === 'Enabled' ? 'Present' : Status?.State, + uri: assembly['@odata.id'], + }; + }); + }, + async getAssemblyInfo(requestBody) { + this.setAssemblyInfo([]); return await api .get(`${requestBody.uri}/Assembly`) - .then(({ data }) => commit('setAssemblyInfo', data?.Assemblies)) + .then(({ data }) => this.setAssemblyInfo(data.Assemblies)) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue({ dispatch }, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { Assemblies: [ @@ -62,26 +91,30 @@ const AssemblyStore = { .patch(uri, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { - dispatch('getAssemblyInfo'); + this.getAssemblyInfo(); console.log('error', error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default AssemblyStore; diff --git a/src/store/modules/HardwareStatus/ChassisStore.js b/src/store/modules/HardwareStatus/ChassisStore.js index 32b2780105..5dba2a757f 100644 --- a/src/store/modules/HardwareStatus/ChassisStore.js +++ b/src/store/modules/HardwareStatus/ChassisStore.js @@ -1,19 +1,19 @@ import api from '@/store/api'; import i18n from '@/i18n'; - -const ChassisStore = { +import { defineStore } from 'pinia'; +export const ChassisStore = defineStore('chassisStore', { namespaced: true, - state: { + state: () => ({ chassis: [], powerState: null, - }, + }), getters: { - chassis: (state) => state.chassis, - powerState: (state) => state.powerState, + chassisGetter: (state) => state.chassis, + powerStateGetter: (state) => state.powerState, }, - mutations: { - setChassisInfo: (state, data) => { - state.chassis = data.map((chassis) => { + actions: { + setChassisInfo(data) { + this.chassis = data.map((chassis) => { const { Id, Status = {}, @@ -36,9 +36,7 @@ const ChassisStore = { }); }, setPowerState: (state, powerState) => (state.powerState = powerState), - }, - actions: { - async getChassisInfo({ commit }) { + async fetchGetChassisInfo() { return await api .get('/redfish/v1/Chassis') .then(({ data: { Members = [] } }) => @@ -47,11 +45,11 @@ const ChassisStore = { .then((promises) => api.all(promises)) .then((response) => { const data = response.map(({ data }) => data); - commit('setChassisInfo', data); + this.setChassisInfo(data); }) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue({ dispatch }, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, @@ -59,23 +57,27 @@ const ChassisStore = { return await api .patch(uri, updatedIdentifyLedValue) .then(() => { - dispatch('getChassisInfo'); + this.fetchGetChassisInfo(); if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { - dispatch('getChassisInfo'); + this.fetchGetChassisInfo(); console.log('error', error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); @@ -89,6 +91,6 @@ const ChassisStore = { .catch((error) => console.log(error)); }, }, -}; +}); export default ChassisStore; diff --git a/src/store/modules/HardwareStatus/FabricAdaptersStore.js b/src/store/modules/HardwareStatus/FabricAdaptersStore.js index 77cce3821a..8cc71b99ca 100644 --- a/src/store/modules/HardwareStatus/FabricAdaptersStore.js +++ b/src/store/modules/HardwareStatus/FabricAdaptersStore.js @@ -1,17 +1,18 @@ import api from '@/store/api'; import i18n from '@/i18n'; +import { defineStore } from 'pinia'; -const FabricAdaptersStore = { +export const FabricAdaptersStore = defineStore('fabricStore', { namespaced: true, - state: { + state: () => ({ fabricAdapters: [], - }, + }), getters: { - fabricAdapters: (state) => state.fabricAdapters, + fabricAdaptersGetter: (state) => state.fabricAdapters, }, - mutations: { - setFabricAdaptersInfo: (state, data) => { - state.fabricAdapters = data.map((adapter) => { + actions: { + setFabricAdaptersInfo(data) { + this.fabricAdapters = data.map((adapter) => { const { Id, Location, @@ -38,11 +39,9 @@ const FabricAdaptersStore = { }; }); }, - }, - actions: { - async getFabricAdaptersInfo({ commit }, requestBody) { + async getFabricAdaptersInfo(requestBody) { let tempFabricAdapters = []; - commit('setFabricAdaptersInfo', tempFabricAdapters); + this.setFabricAdaptersInfo(tempFabricAdapters); const res = await api.get(requestBody.uri + '/PCIeSlots'); return await api .get(`/redfish/v1/Systems/system/FabricAdapters`) @@ -56,7 +55,7 @@ const FabricAdaptersStore = { memberResponse.data?.Links?.PCIeDevices[0]['@odata.id'] ) { tempFabricAdapters.push(memberResponse.data); - commit('setFabricAdaptersInfo', tempFabricAdapters); + this.setFabricAdaptersInfo(tempFabricAdapters); } }); } else { @@ -65,7 +64,7 @@ const FabricAdaptersStore = { requestBody.uri.endsWith('chassis') ) { tempFabricAdapters.push(memberResponse.data); - commit('setFabricAdaptersInfo', tempFabricAdapters); + this.setFabricAdaptersInfo(tempFabricAdapters); } } }); @@ -73,36 +72,39 @@ const FabricAdaptersStore = { }) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue({ dispatch }, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, }; - return await api .patch(uri, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { - dispatch('getFabricAdaptersInfo'); + this.getFabricAdaptersInfo(led); console.log('error', error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default FabricAdaptersStore; diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js index 3ff5ccac9f..4b0681b15a 100644 --- a/src/store/modules/HardwareStatus/FanStore.js +++ b/src/store/modules/HardwareStatus/FanStore.js @@ -1,17 +1,18 @@ import api from '@/store/api'; import i18n from '@/i18n'; +import { defineStore } from 'pinia'; -const FanStore = { +export const FanStore = defineStore('fanStore', { namespaced: true, - state: { + state: () => ({ fans: [], - }, + }), getters: { - fans: (state) => state.fans, + fansGetter: (state) => state.fans, }, - mutations: { - setFanInfo: (state, data) => { - state.fans = data.map((fan) => { + actions: { + setFanInfo(data) { + this.fans = data.map((fan) => { const { LocationIndicatorActive, Location, @@ -38,10 +39,8 @@ const FanStore = { }; }); }, - }, - actions: { - async getAllFans({ commit }, requestBody) { - commit('setFanInfo', []); + async getAllFans(requestBody) { + this.setFanInfo([]); return await api .get(`${requestBody.uri}`) .then((response) => @@ -54,11 +53,11 @@ const FanStore = { .then((fanIds) => api.all(fanIds.map((fan) => api.get(fan)))) .then((fans) => { const fansData = fans.map((fans) => fans.data); - commit('setFanInfo', fansData); + this.setFanInfo(fansData); }) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue(_, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, @@ -67,25 +66,29 @@ const FanStore = { .patch(uri, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { console.log(error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default FanStore; diff --git a/src/store/modules/HardwareStatus/MemoryStore.js b/src/store/modules/HardwareStatus/MemoryStore.js index b42c0c69aa..72bade25c7 100644 --- a/src/store/modules/HardwareStatus/MemoryStore.js +++ b/src/store/modules/HardwareStatus/MemoryStore.js @@ -1,17 +1,18 @@ import api from '@/store/api'; import i18n from '@/i18n'; +import { defineStore } from 'pinia'; -const MemoryStore = { +export const MemoryStore = defineStore('memoryStore', { namespaced: true, - state: { + state: () => ({ dimms: [], - }, + }), getters: { - dimms: (state) => state.dimms, + dimmsGetter: (state) => state.dimms, }, - mutations: { - setMemoryInfo: (state, data) => { - state.dimms = data.map(({ data }) => { + actions: { + setMemoryInfo(data) { + this.dimms = data.map(({ data }) => { const { Id, Status = {}, @@ -42,20 +43,18 @@ const MemoryStore = { }; }); }, - }, - actions: { - async getDimms({ commit }) { - commit('setMemoryInfo', []); + async getDimms() { + this.setMemoryInfo([]); return await api .get('/redfish/v1/Systems/system/Memory') .then(({ data: { Members } }) => { const promises = Members.map((item) => api.get(item['@odata.id'])); return api.all(promises); }) - .then((response) => commit('setMemoryInfo', response)) + .then((response) => this.setMemoryInfo(response)) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue({ dispatch }, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, @@ -64,26 +63,30 @@ const MemoryStore = { .patch(uri, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { - dispatch('getDimms'); + this.getDimms; console.log('error', error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default MemoryStore; diff --git a/src/store/modules/HardwareStatus/PcieSlotsStore.js b/src/store/modules/HardwareStatus/PcieSlotsStore.js index 316b258751..a94d95dd8a 100644 --- a/src/store/modules/HardwareStatus/PcieSlotsStore.js +++ b/src/store/modules/HardwareStatus/PcieSlotsStore.js @@ -1,17 +1,17 @@ import api from '@/store/api'; import i18n from '@/i18n'; - -const PcieSlotsStore = { +import { defineStore } from 'pinia'; +export const PcieSlotsStore = defineStore('pcieSlotsStore', { namespaced: true, - state: { + state: () => ({ pcieSlots: [], - }, + }), getters: { - pcieSlots: (state) => state.pcieSlots, + pcieSlotsGetter: (state) => state.pcieSlots, }, - mutations: { - setPcieSlotsInfo: (state, data) => { - state.pcieSlots = data.map((slot) => { + actions: { + setPcieSlotsInfo(data) { + this.pcieSlots = data.map((slot) => { const { LocationIndicatorActive, Location, SlotType } = slot; return { type: SlotType, @@ -20,20 +20,18 @@ const PcieSlotsStore = { }; }); }, - }, - actions: { - async getPcieSlotsInfo({ commit }, requestBody) { - commit('setPcieSlotsInfo', []); + async getPcieSlotsInfo(requestBody) { + this.setPcieSlotsInfo([]); return await api .get(`${requestBody.uri}/PCIeSlots`) .then(({ data }) => { - commit('setPcieSlotsInfo', data.Slots); + this.setPcieSlotsInfo(data.Slots); }) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue({ dispatch, state }, led) { + async updateIdentifyLedValue(led) { const tempPcieSlots = []; - state.pcieSlots.map((slot) => { + this.pcieSlots.map((slot) => { if (slot.locationNumber === led.locationNumber) { tempPcieSlots.push({ LocationIndicatorActive: led.identifyLed }); } else { @@ -47,26 +45,30 @@ const PcieSlotsStore = { .patch(`${led.uri}/PCIeSlots`, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { - dispatch('getPcieSlotsInfo', { uri: led.uri }); + this.getPcieSlotsInfo({ uri: led.uri }); console.log('error', error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default PcieSlotsStore; diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index e2010d18cb..5792a1b34c 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -1,17 +1,17 @@ import api from '@/store/api'; import i18n from '@/i18n'; - -const PowerSupplyStore = { +import { defineStore } from 'pinia'; +export const PowerSupplyStore = defineStore('powerSupplyStore', { namespaced: true, - state: { + state: () => ({ powerSupplies: [], - }, + }), getters: { - powerSupplies: (state) => state.powerSupplies, + powerSuppliesGetter: (state) => state.powerSupplies, }, - mutations: { - setPowerSupply: (state, data) => { - state.powerSupplies = data.map((powerSupply) => { + actions: { + setPowerSupply(data) { + this.powerSupplies = data.map((powerSupply) => { const { FirmwareVersion, Location, @@ -40,10 +40,8 @@ const PowerSupplyStore = { }; }); }, - }, - actions: { - async getAllPowerSupplies({ commit }, requestBody) { - commit('setPowerSupply', []); + async getAllPowerSupplies(requestBody) { + this.setPowerSupply([]); return await api .get(`${requestBody.uri}`) .then((response) => api.get(response.data.PowerSubsystem['@odata.id'])) @@ -58,11 +56,11 @@ const PowerSupplyStore = { const powerSuppliesData = powerSupplies.map( (powerSupplies) => powerSupplies.data, ); - commit('setPowerSupply', powerSuppliesData); + this.setPowerSupply(powerSuppliesData); }) .catch((error) => console.log(error)); }, - async updateIdentifyLedValue(_, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, @@ -71,25 +69,29 @@ const PowerSupplyStore = { .patch(uri, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { console.log(error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default PowerSupplyStore; diff --git a/src/store/modules/HardwareStatus/ProcessorStore.js b/src/store/modules/HardwareStatus/ProcessorStore.js index e0fd4cfa86..0bb26b2b75 100644 --- a/src/store/modules/HardwareStatus/ProcessorStore.js +++ b/src/store/modules/HardwareStatus/ProcessorStore.js @@ -1,17 +1,17 @@ import api from '@/store/api'; import i18n from '@/i18n'; - -const ProcessorStore = { +import { defineStore } from 'pinia'; +export const ProcessorStore = defineStore('ProcessorStore', { namespaced: true, - state: { + state: () => ({ processors: [], - }, + }), getters: { - processors: (state) => state.processors, + processorsGetter: (state) => state.processors, }, - mutations: { - setProcessorsInfo: (state, data) => { - state.processors = data.map((processor) => { + actions: { + setProcessorsInfo(data) { + this.processors = data.map((processor) => { const { Id, Status = {}, @@ -42,10 +42,8 @@ const ProcessorStore = { }; }); }, - }, - actions: { - async getProcessorsInfo({ commit }) { - commit('setProcessorsInfo', []); + async getProcessorsInfo() { + this.setProcessorsInfo([]); return await api .get('/redfish/v1/Systems/system/Processors') .then(({ data: { Members = [] } }) => @@ -54,13 +52,13 @@ const ProcessorStore = { .then((promises) => api.all(promises)) .then((response) => { const data = response.map(({ data }) => data); - commit('setProcessorsInfo', data); + this.setProcessorsInfo(data); }) .catch((error) => console.log(error)); }, // Waiting for the following to be merged to test the Identify Led: // https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/37045 - async updateIdentifyLedValue({ dispatch }, led) { + async updateIdentifyLedValue(led) { const uri = led.uri; const updatedIdentifyLedValue = { LocationIndicatorActive: led.identifyLed, @@ -69,26 +67,30 @@ const ProcessorStore = { .patch(uri, updatedIdentifyLedValue) .then(() => { if (led.identifyLed) { - return i18n.t('pageInventory.toast.successEnableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); } else { - return i18n.t('pageInventory.toast.successDisableIdentifyLed'); + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); } }) .catch((error) => { - dispatch('getProcessorsInfo'); + this.getProcessorsInfo(); console.log('error', error); if (led.identifyLed) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), ); } }); }, }, -}; +}); export default ProcessorStore; diff --git a/src/store/modules/HardwareStatus/SystemStore.js b/src/store/modules/HardwareStatus/SystemStore.js index 38e9a763d6..d1ffb54937 100644 --- a/src/store/modules/HardwareStatus/SystemStore.js +++ b/src/store/modules/HardwareStatus/SystemStore.js @@ -11,27 +11,24 @@ export const SystemStore = defineStore('system', { getSystems: (state) => state.systems, }, actions: { - async setSystemInfo(data) { + setSystemInfo(data) { const system = {}; system.assetTag = data.AssetTag; - system.description = data.Description; - system.firmwareVersion = data.BiosVersion; - system.hardwareType = data.Name; + system.name = data.Name; system.health = data.Status?.Health; system.totalSystemMemoryGiB = data.MemorySummary?.TotalSystemMemoryGiB; system.id = data.Id; + system.lampTest = data.Oem?.IBM?.LampTest; + system.sysAttentionLed = + data.Oem?.IBM?.PartitionSystemAttentionIndicator || + data.Oem?.IBM?.PlatformSystemAttentionIndicator; system.locationIndicatorActive = data.LocationIndicatorActive; - system.locationNumber = data.Location?.PartLocation?.ServiceLabel; - system.manufacturer = data.Manufacturer; system.model = data.Model; - system.processorSummaryCount = data.ProcessorSummary?.Count; system.processorSummaryCoreCount = data.ProcessorSummary?.CoreCount; + system.processorSummaryCount = data.ProcessorSummary?.Count; system.powerState = data.PowerState; system.serialNumber = data.SerialNumber; - system.healthRollup = data.Status?.HealthRollup; - system.subModel = data.SubModel; system.statusState = data.Status?.State; - system.systemType = data.SystemType; this.systems = [system]; }, async getSystem() { @@ -48,20 +45,101 @@ export const SystemStore = defineStore('system', { .patch('/redfish/v1/Systems/system', { LocationIndicatorActive: ledState, }) + .then(() => { + if (ledState) { + return i18n.global.t( + 'pageInventory.toast.successEnableIdentifyLed', + ); + } else { + return i18n.global.t( + 'pageInventory.toast.successDisableIdentifyLed', + ); + } + }) .catch((error) => { - this.setSystemInfo(this.state.system.systems[0]); + this.setSystemInfo(this.systems[0]); console.log('error', error); if (ledState) { throw new Error( - i18n.t('pageInventory.toast.errorEnableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorEnableIdentifyLed'), ); } else { throw new Error( - i18n.t('pageInventory.toast.errorDisableIdentifyLed'), + i18n.global.t('pageInventory.toast.errorDisableIdentifyLed'), + ); + } + }); + }, + async changeSystemAttentionLedState(ledState) { + return await api + .patch('/api/redfish/v1/Systems/system', { + Oem: { + IBM: { + PartitionSystemAttentionIndicator: ledState, + PlatformSystemAttentionIndicator: ledState, + }, + }, + }) + .then(() => { + if (!ledState) { + return i18n.global.t( + 'pageInventory.toast.successDisableSystemAttentionLed', + ); + } + }) + .catch((error) => { + this.setSystemInfo(this.systems[0]); + console.log('error', error); + if (!ledState) { + throw new Error( + i18n.global.t( + 'pageInventory.toast.errorDisableSystemAttentionLed', + ), ); } }); }, + async changeLampTestState(lampTestState) { + return await api + .patch('/redfish/v1/Systems/system', { + Oem: { + IBM: { + LampTest: lampTestState, + }, + }, + }) + .then(() => { + if (lampTestState) { + return i18n.global.t('pageInventory.toast.successEnableLampTest'); + } + }) + .catch((error) => { + this.setSystemInfo(this.systems[0]); + console.log('error', error); + if (lampTestState) { + throw new Error( + i18n.global.t('pageInventory.toast.errorEnableLampTest'), + ); + } else { + throw new Error( + i18n.global.t('pageInventory.toast.errorDisableLampTest'), + ); + } + }); + }, + async saveAssetTag(assetTag) { + return api + .patch('/api/redfish/v1/Systems/system', assetTag) + .then(() => { + return i18n.global.t('pageOverview.toast.successSaveAssetTag'); + }) + .catch((error) => { + console.log(error); + throw new Error( + i18n.global.t('pageOverview.toast.errorSaveAssetTag'), + ); + }); + }, }, }); diff --git a/src/store/modules/Logs/AuditLogsStore.js b/src/store/modules/Logs/AuditLogsStore.js index b949160dc7..334e2d8fa7 100644 --- a/src/store/modules/Logs/AuditLogsStore.js +++ b/src/store/modules/Logs/AuditLogsStore.js @@ -29,7 +29,9 @@ export const AuditLogsStore = defineStore('auditLogs', { additionalDataUri: Oem.IBM.AdditionalDataFullAuditLogURI, }; }); + this.allAuditLogs = auditLogs; + console.log('audit logs3', this.allAuditLogs); }) .catch((error) => { console.log(error); diff --git a/src/views/HardwareStatus/Inventory/Inventory.vue b/src/views/HardwareStatus/Inventory/Inventory.vue index bfeb40c551..05b436d224 100644 --- a/src/views/HardwareStatus/Inventory/Inventory.vue +++ b/src/views/HardwareStatus/Inventory/Inventory.vue @@ -12,7 +12,7 @@
- - {{ item.linkText }} - + {{ item.linkText }} +
@@ -59,15 +59,15 @@ xl="4" >
- {{ item.linkText }} - +
@@ -149,7 +149,6 @@ ref="assembly" :chassis="chassis[currentTab].uri" /> - - diff --git a/src/views/HardwareStatus/Inventory/InventoryFabricAdapters.vue b/src/views/HardwareStatus/Inventory/InventoryFabricAdapters.vue index a5e1cf2905..26a8f5ce1f 100644 --- a/src/views/HardwareStatus/Inventory/InventoryFabricAdapters.vue +++ b/src/views/HardwareStatus/Inventory/InventoryFabricAdapters.vue @@ -1,32 +1,29 @@ - + - + diff --git a/src/views/HardwareStatus/Inventory/InventoryServiceIndicator.vue b/src/views/HardwareStatus/Inventory/InventoryServiceIndicator.vue index e4b00ba965..587e5532da 100644 --- a/src/views/HardwareStatus/Inventory/InventoryServiceIndicator.vue +++ b/src/views/HardwareStatus/Inventory/InventoryServiceIndicator.vue @@ -3,37 +3,39 @@ :section-title="$t('pageInventory.systemIndicator.sectionTitle')" >
- - + +
{{ $t('pageInventory.systemIndicator.powerStatus') }}
{{ $t(powerStatus) }}
-
- + +
{{ $t('pageInventory.systemIndicator.identifyLed') }}
- {{ $t('global.status.on') }} {{ $t('global.status.off') }} - +
-
- + +
{{ $t('pageInventory.systemIndicator.attentionLed') }} @@ -44,23 +46,25 @@ />
- {{ $t('global.status.on') }} {{ $t('global.status.off') }} - +
-
- + +
{{ $t('pageInventory.systemIndicator.lampTest') }} @@ -69,104 +73,103 @@ />
- - - {{ $t('pageInventory.systemIndicator.lampTest') }} - {{ $t('global.status.on') }} {{ $t('global.status.off') }} - +
-
-
+ +
- + \ No newline at end of file diff --git a/src/views/HardwareStatus/Inventory/InventoryTableAssembly.vue b/src/views/HardwareStatus/Inventory/InventoryTableAssembly.vue index a2378d08fb..8e04dcfe72 100644 --- a/src/views/HardwareStatus/Inventory/InventoryTableAssembly.vue +++ b/src/views/HardwareStatus/Inventory/InventoryTableAssembly.vue @@ -1,29 +1,27 @@ - + - + \ No newline at end of file diff --git a/src/views/HardwareStatus/Inventory/InventoryTableBmcManager.vue b/src/views/HardwareStatus/Inventory/InventoryTableBmcManager.vue index 2e2b89312b..9725e9265e 100644 --- a/src/views/HardwareStatus/Inventory/InventoryTableBmcManager.vue +++ b/src/views/HardwareStatus/Inventory/InventoryTableBmcManager.vue @@ -3,6 +3,7 @@ - + diff --git a/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue b/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue index 7d9509d1b6..3f770a3f39 100644 --- a/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue +++ b/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue @@ -1,31 +1,28 @@ - + - + diff --git a/src/views/HardwareStatus/Inventory/InventoryTableFans.vue b/src/views/HardwareStatus/Inventory/InventoryTableFans.vue index 3fa880f0af..72935b89f4 100644 --- a/src/views/HardwareStatus/Inventory/InventoryTableFans.vue +++ b/src/views/HardwareStatus/Inventory/InventoryTableFans.vue @@ -1,19 +1,16 @@