summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-08-03 09:18:36 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-08-03 09:18:36 +0300
commit58860854beb269e6fa3d62e08be2c9ebb95997f2 (patch)
tree8217aa3942ae722c02ac62e1bd23d50f67f70e6e
parent81e9a4b00b362f07d587b7a497eb1dbf6870154f (diff)
downloadwebui-vue-58860854beb269e6fa3d62e08be2c9ebb95997f2.tar.xz
upd FanStore
-rw-r--r--src/store/index.js4
-rw-r--r--src/store/modules/HardwareStatus/FanStore.js31
-rw-r--r--src/store/modules/HardwareStatus/MotherboardStore.js (renamed from src/store/modules/_sila/HardwareStatus/MotherboardStore.js)0
-rw-r--r--src/store/modules/_sila/HardwareStatus/FanStore.js81
4 files changed, 33 insertions, 83 deletions
diff --git a/src/store/index.js b/src/store/index.js
index fa857b3a..fb911a40 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -19,8 +19,8 @@ import ServerLedStore from './modules/HardwareStatus/ServerLedStore';
import SystemStore from './modules/HardwareStatus/SystemStore';
import PowerSupplyStore from './modules/HardwareStatus/PowerSupplyStore';
import MemoryStore from './modules/HardwareStatus/MemoryStore';
-import FanStore from './modules/_sila/HardwareStatus/FanStore';
-import MotherboardStore from './modules/_sila/HardwareStatus/MotherboardStore';
+import FanStore from './modules/HardwareStatus/FanStore';
+import MotherboardStore from './modules/HardwareStatus/MotherboardStore';
import ChassisStore from './modules/HardwareStatus/ChassisStore';
import BmcStore from './modules/HardwareStatus/BmcStore';
import ProcessorStore from './modules/HardwareStatus/ProcessorStore';
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
index fca1f326..fed3f742 100644
--- a/src/store/modules/HardwareStatus/FanStore.js
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -1,12 +1,15 @@
import api from '@/store/api';
+import { fanType } from '@/utilities/_sila/tableParser';
const FanStore = {
namespaced: true,
state: {
fans: [],
+ fansLastHour: [],
},
getters: {
fans: (state) => state.fans,
+ fansLastHour: (state) => state.fansLastHour,
},
mutations: {
setFanInfo: (state, data) => {
@@ -32,12 +35,40 @@ const FanStore = {
locationNumber: Location,
name: Name,
speed: Reading + ' ' + ReadingUnits,
+ speedRPM: Reading,
+ type: fanType(Name),
statusState: Status.State,
};
});
},
+
+ setFansDynamic: (state, data) => {
+ state.fans = data;
+ },
+ setFansDynamicLastHour: (state, data) => {
+ state.fansLastHour = data;
+ },
},
actions: {
+ async getFansDynamic({ commit }, { lastHour }) {
+ let url = null;
+ if (lastHour) {
+ url =
+ '/redfish/v1/TelemetryService/MetricReports/hour_data&id=fans&period=last_hour';
+ } else {
+ url = '/redfish/v1/TelemetryService/MetricReports/hour_data&id=fans';
+ }
+ return await api
+ .get(url)
+ .then(({ data: { MetricValues = [] } }) => {
+ if (lastHour) {
+ commit('setFansDynamicLastHour', MetricValues);
+ } else {
+ commit('setFansDynamic', MetricValues);
+ }
+ })
+ .catch((error) => console.log(error));
+ },
async getFanInfo({ commit }) {
return await api
.get('/redfish/v1/Chassis/chassis/Thermal')
diff --git a/src/store/modules/_sila/HardwareStatus/MotherboardStore.js b/src/store/modules/HardwareStatus/MotherboardStore.js
index 7b2fe032..7b2fe032 100644
--- a/src/store/modules/_sila/HardwareStatus/MotherboardStore.js
+++ b/src/store/modules/HardwareStatus/MotherboardStore.js
diff --git a/src/store/modules/_sila/HardwareStatus/FanStore.js b/src/store/modules/_sila/HardwareStatus/FanStore.js
deleted file mode 100644
index fed3f742..00000000
--- a/src/store/modules/_sila/HardwareStatus/FanStore.js
+++ /dev/null
@@ -1,81 +0,0 @@
-import api from '@/store/api';
-import { fanType } from '@/utilities/_sila/tableParser';
-
-const FanStore = {
- namespaced: true,
- state: {
- fans: [],
- fansLastHour: [],
- },
- getters: {
- fans: (state) => state.fans,
- fansLastHour: (state) => state.fansLastHour,
- },
- mutations: {
- setFanInfo: (state, data) => {
- state.fans = data.map((fan) => {
- const {
- IndicatorLED,
- Location,
- MemberId,
- Name,
- Reading,
- ReadingUnits,
- Status = {},
- PartNumber,
- SerialNumber,
- } = fan;
- return {
- id: MemberId,
- health: Status.Health,
- partNumber: PartNumber,
- serialNumber: SerialNumber,
- healthRollup: Status.HealthRollup,
- identifyLed: IndicatorLED,
- locationNumber: Location,
- name: Name,
- speed: Reading + ' ' + ReadingUnits,
- speedRPM: Reading,
- type: fanType(Name),
- statusState: Status.State,
- };
- });
- },
-
- setFansDynamic: (state, data) => {
- state.fans = data;
- },
- setFansDynamicLastHour: (state, data) => {
- state.fansLastHour = data;
- },
- },
- actions: {
- async getFansDynamic({ commit }, { lastHour }) {
- let url = null;
- if (lastHour) {
- url =
- '/redfish/v1/TelemetryService/MetricReports/hour_data&id=fans&period=last_hour';
- } else {
- url = '/redfish/v1/TelemetryService/MetricReports/hour_data&id=fans';
- }
- return await api
- .get(url)
- .then(({ data: { MetricValues = [] } }) => {
- if (lastHour) {
- commit('setFansDynamicLastHour', MetricValues);
- } else {
- commit('setFansDynamic', MetricValues);
- }
- })
- .catch((error) => console.log(error));
- },
- async getFanInfo({ commit }) {
- return await api
- .get('/redfish/v1/Chassis/chassis/Thermal')
- .then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans))
- .catch((error) => console.log(error));
- },
- },
-};
-
-export default FanStore;