summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorSurenNeware <sneware9@in.ibm.com>2020-08-04 18:15:25 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-08-18 16:53:15 +0300
commitdc3fa2e0382145126101dc6df04d0338a119824f (patch)
tree8e21d88b267b9a46631a6dd1c0bd2b9621727b8d /src/store
parent307382e809bc7d933ee593f68ef354c388ea350e (diff)
downloadwebui-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')
-rw-r--r--src/store/index.js4
-rw-r--r--src/store/modules/Health/ProcessorStore.js61
2 files changed, 64 insertions, 1 deletions
diff --git a/src/store/index.js b/src/store/index.js
index 392344d0..2e7c97aa 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -20,6 +20,7 @@ import MemoryStore from './modules/Health/MemoryStore';
import FanStore from './modules/Health/FanStore';
import ChassisStore from './modules/Health/ChassisStore';
import BmcStore from './modules/Health/BmcStore';
+import ProcessorStore from './modules/Health/ProcessorStore';
import WebSocketPlugin from './plugins/WebSocketPlugin';
import DateTimeStore from './modules/Configuration/DateTimeSettingsStore';
@@ -50,7 +51,8 @@ export default new Vuex.Store({
memory: MemoryStore,
fan: FanStore,
chassis: ChassisStore,
- bmc: BmcStore
+ bmc: BmcStore,
+ processors: ProcessorStore
},
plugins: [WebSocketPlugin]
});
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;