blob: 23b12d72130d58268efc7f2be5ac0294b1350f25 [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001import api from '@/store/api';
2
3const SystemStore = {
4 namespaced: true,
5 state: {
Derick Montague602e98a2020-10-21 16:20:00 -05006 systems: [],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07007 },
8 getters: {
Derick Montague602e98a2020-10-21 16:20:00 -05009 systems: (state) => state.systems,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070010 },
11 mutations: {
12 setSystemInfo: (state, data) => {
13 const system = {};
14 system.assetTag = data.AssetTag;
15 system.description = data.Description;
Yoshie Muranakac687f102020-06-02 12:01:27 -070016 system.firmwareVersion = data.BiosVersion;
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070017 system.health = data.Status.Health;
18 system.id = data.Id;
SurenNewarebbf896c2021-01-27 21:50:22 +053019 system.locationIndicatorActive = data.LocationIndicatorActive;
Yoshie Muranakac687f102020-06-02 12:01:27 -070020 system.manufacturer = data.Manufacturer;
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070021 system.model = data.Model;
22 system.partNumber = data.PartNumber;
23 system.powerState = data.PowerState;
24 system.serialNumber = data.SerialNumber;
25 system.healthRollup = data.Status.HealthRollup;
26 system.statusState = data.Status.State;
27 system.systemType = data.SystemType;
28 state.systems = [system];
Derick Montague602e98a2020-10-21 16:20:00 -050029 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070030 },
31 actions: {
32 async getSystem({ commit }) {
33 return await api
34 .get('/redfish/v1/Systems/system')
35 .then(({ data }) => commit('setSystemInfo', data))
Derick Montague602e98a2020-10-21 16:20:00 -050036 .catch((error) => console.log(error));
37 },
38 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070039};
40
41export default SystemStore;