From dc3fa2e0382145126101dc6df04d0338a119824f Mon Sep 17 00:00:00 2001 From: SurenNeware Date: Tue, 4 Aug 2020 20:45:25 +0530 Subject: Add processors to hardware status page -Add processors status from given API. -Created seperate table with all available details. Signed-off-by: Suren Neware Change-Id: Iae4346cd0555a9a7d8ec35c0f56f8bce6c4ab653 --- src/store/modules/Health/ProcessorStore.js | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/store/modules/Health/ProcessorStore.js (limited to 'src/store/modules') diff --git a/src/store/modules/Health/ProcessorStore.js b/src/store/modules/Health/ProcessorStore.js new file mode 100644 index 00000000..8680f652 --- /dev/null +++ b/src/store/modules/Health/ProcessorStore.js @@ -0,0 +1,61 @@ +import api from '@/store/api'; + +const ProcessorStore = { + namespaced: true, + state: { + processors: null + }, + getters: { + processors: state => state.processors + }, + mutations: { + setProcessorsInfo: (state, data) => { + state.processors = data.map(processor => { + const { + Id, + Status = {}, + PartNumber, + SerialNumber, + InstructionSet, + Manufacturer, + Model, + Name, + ProcessorArchitecture, + ProcessorType, + TotalCores + } = processor; + return { + id: Id, + health: Status.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + statusState: Status.State, + instructionSet: InstructionSet, + manufacturer: Manufacturer, + model: Model, + name: Name, + processorArchitecture: ProcessorArchitecture, + processorType: ProcessorType, + totalCores: TotalCores + }; + }); + } + }, + actions: { + async getProcessorsInfo({ commit }) { + return await api + .get('/redfish/v1/Systems/system/Processors') + .then(({ data: { Members = [] } }) => + Members.map(member => api.get(member['@odata.id'])) + ) + .then(promises => api.all(promises)) + .then(response => { + const data = response.map(({ data }) => data); + commit('setProcessorsInfo', data); + }) + .catch(error => console.log(error)); + } + } +}; + +export default ProcessorStore; -- cgit v1.2.3