diff options
author | Sukanya Pandey <sukapan1@in.ibm.com> | 2020-03-31 15:07:53 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-05-21 15:05:06 +0300 |
commit | 9055d9880b35b8c076f2ff12e726f1cf22f237fc (patch) | |
tree | b3f6ad7a2629334343fa5bc13fce862529a29175 /src/store | |
parent | 090c2d44c47f4f68dd70c4c60b576542d7979836 (diff) | |
download | webui-vue-9055d9880b35b8c076f2ff12e726f1cf22f237fc.tar.xz |
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
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/Control/PowerControlStore.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/store/modules/Control/PowerControlStore.js b/src/store/modules/Control/PowerControlStore.js index 78585395..85d69633 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 @@ const PowerControlStore = { (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 @@ const PowerControlStore = { .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') + ); + }); } } }; |