Add manage power usage page
-The page is used to control the power.
-Maximum power can be set between 1 to 10000.
-The API used to get and set the power
limit:/redfish/v1/Chassis/chassis/Power
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I1cab4876e9149d92de75014d7680ac11410ca4fe
diff --git a/src/store/modules/Control/PowerControlStore.js b/src/store/modules/Control/PowerControlStore.js
index 7858539..85d6963 100644
--- a/src/store/modules/Control/PowerControlStore.js
+++ b/src/store/modules/Control/PowerControlStore.js
@@ -1,4 +1,5 @@
import api from '../../api';
+import i18n from '@/i18n';
const PowerControlStore = {
namespaced: true,
@@ -17,6 +18,9 @@
(state.powerConsumptionValue = powerConsumptionValue)
},
actions: {
+ setPowerCapUpdatedValue({ commit }, value) {
+ commit('setPowerCapValue', value);
+ },
async getPowerControl({ commit }) {
return await api
.get('/redfish/v1/Chassis/chassis/Power')
@@ -32,6 +36,23 @@
.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')
+ );
+ });
}
}
};