diff options
author | SurenNeware <sneware9@in.ibm.com> | 2020-08-04 18:15:25 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-08-18 16:53:15 +0300 |
commit | dc3fa2e0382145126101dc6df04d0338a119824f (patch) | |
tree | 8e21d88b267b9a46631a6dd1c0bd2b9621727b8d /src/store/modules/Health | |
parent | 307382e809bc7d933ee593f68ef354c388ea350e (diff) | |
download | webui-vue-dc3fa2e0382145126101dc6df04d0338a119824f.tar.xz |
Add processors to hardware status page
-Add processors status from given API.
-Created seperate table with all available details.
Signed-off-by: Suren Neware <sneware9@in.ibm.com>
Change-Id: Iae4346cd0555a9a7d8ec35c0f56f8bce6c4ab653
Diffstat (limited to 'src/store/modules/Health')
-rw-r--r-- | src/store/modules/Health/ProcessorStore.js | 61 |
1 files changed, 61 insertions, 0 deletions
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; |