summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus/MotherboardStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/HardwareStatus/MotherboardStore.js')
-rw-r--r--src/store/modules/HardwareStatus/MotherboardStore.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/MotherboardStore.js b/src/store/modules/HardwareStatus/MotherboardStore.js
new file mode 100644
index 00000000..7b2fe032
--- /dev/null
+++ b/src/store/modules/HardwareStatus/MotherboardStore.js
@@ -0,0 +1,45 @@
+import api from '@/store/api';
+
+const MotherboardStore = {
+ namespaced: true,
+ state: {
+ motherboard: [],
+ motherboardLastHour: [],
+ },
+ getters: {
+ motherboard: (state) => state.motherboard,
+ motherboardLastHour: (state) => state.motherboardLastHour,
+ },
+ mutations: {
+ setMotherboardDynamic: (state, data) => {
+ state.motherboard = data;
+ },
+ setMotherboardDynamicLastHour: (state, data) => {
+ state.motherboardLastHour = data;
+ },
+ },
+ actions: {
+ async getMotherboardDynamic({ commit }, { lastHour }) {
+ let url = null;
+ if (lastHour) {
+ url =
+ '/redfish/v1/TelemetryService/MetricReports/hour_data&id=other_temp&period=last_hour';
+ } else {
+ url =
+ '/redfish/v1/TelemetryService/MetricReports/hour_data&id=other_temp';
+ }
+ return await api
+ .get(url)
+ .then(({ data: { MetricValues = [] } }) => {
+ if (lastHour) {
+ commit('setMotherboardDynamicLastHour', MetricValues);
+ } else {
+ commit('setMotherboardDynamic', MetricValues);
+ }
+ })
+ .catch((error) => console.log(error));
+ },
+ },
+};
+
+export default MotherboardStore;