summaryrefslogtreecommitdiff
path: root/src/store/modules/Operations
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/Operations')
-rw-r--r--src/store/modules/Operations/PowerControlStore.js60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/store/modules/Operations/PowerControlStore.js b/src/store/modules/Operations/PowerControlStore.js
deleted file mode 100644
index 9dbddf05..00000000
--- a/src/store/modules/Operations/PowerControlStore.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import api from '@/store/api';
-import i18n from '@/i18n';
-
-const PowerControlStore = {
- namespaced: true,
- state: {
- powerCapValue: null,
- powerConsumptionValue: null,
- },
- getters: {
- powerCapValue: (state) => state.powerCapValue,
- powerConsumptionValue: (state) => state.powerConsumptionValue,
- },
- mutations: {
- setPowerCapValue: (state, powerCapValue) =>
- (state.powerCapValue = powerCapValue),
- setPowerConsumptionValue: (state, powerConsumptionValue) =>
- (state.powerConsumptionValue = powerConsumptionValue),
- },
- actions: {
- setPowerCapUpdatedValue({ commit }, value) {
- commit('setPowerCapValue', value);
- },
- async getPowerControl({ commit }) {
- return await api
- .get('/redfish/v1/Chassis/chassis/Power')
- .then((response) => {
- const powerControl = response.data.PowerControl;
- const powerCap = powerControl[0].PowerLimit.LimitInWatts;
- // If system is powered off, power consumption does not exist in the PowerControl
- const powerConsumption = powerControl[0].PowerConsumedWatts || null;
-
- commit('setPowerCapValue', powerCap);
- commit('setPowerConsumptionValue', powerConsumption);
- })
- .catch((error) => {
- console.log('Power control', error);
- });
- },
- async setPowerControl(_, powerCapValue) {
- const data = {
- PowerControl: [{ PowerLimit: { LimitInWatts: powerCapValue } }],
- };
-
- return await api
- .patch('/redfish/v1/Chassis/chassis/Power', data)
- .then(() =>
- i18n.t('pageServerPowerOperations.toast.successSaveSettings')
- )
- .catch((error) => {
- console.log(error);
- throw new Error(
- i18n.t('pageServerPowerOperations.toast.errorSaveSettings')
- );
- });
- },
- },
-};
-
-export default PowerControlStore;