blob: 828b78bddb3a09266022355ff65d0a455e2a8693 [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001import api from '@/store/api';
2
3const SystemStore = {
4 namespaced: true,
5 state: {
6 systems: []
7 },
8 getters: {
9 systems: state => state.systems
10 },
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;
19 system.indicatorLed = data.IndicatorLED;
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];
29 }
30 },
31 actions: {
32 async getSystem({ commit }) {
33 return await api
34 .get('/redfish/v1/Systems/system')
35 .then(({ data }) => commit('setSystemInfo', data))
36 .catch(error => console.log(error));
37 }
38 }
39};
40
41export default SystemStore;