summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorKenneth Fullbright <kennyneedsmilky@gmail.com>2022-01-07 22:12:30 +0300
committerKenneth Fullbright <kennyneedsmilky@gmail.com>2022-02-04 19:29:18 +0300
commit80a87851ab2b1bddb9f42cc494b0ad7799b06012 (patch)
treede378bf2ddb3ce5ae21c5476b7225a720e1382e3 /src/store/modules
parent410578537f7ca6dd76aa406b440b0a435606c448 (diff)
downloadwebui-vue-80a87851ab2b1bddb9f42cc494b0ad7799b06012.tar.xz
Re-modeled Power restore radio buttons
When a user selects a radio button and saves, the selected setting should be patched. - Computed properties on generated bootstrap-vue radio buttons causes errors. - Re-modeled radio buttons to take Redfish api data on component render. - Mapped selected radio button value to patch the Redfish api property. - Added translations. Signed-off-by: Kenneth Fullbright <kennyneedsmilky@gmail.com> Change-Id: I22ce75d9ef840d7f0c2659bba855093e5b4559f4
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/Settings/PowerPolicyStore.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/store/modules/Settings/PowerPolicyStore.js b/src/store/modules/Settings/PowerPolicyStore.js
index 4e76cdfe..54efa2c1 100644
--- a/src/store/modules/Settings/PowerPolicyStore.js
+++ b/src/store/modules/Settings/PowerPolicyStore.js
@@ -1,7 +1,7 @@
import api from '@/store/api';
import i18n from '@/i18n';
-const PowerControlStore = {
+const PowerPolicyStore = {
namespaced: true,
state: {
powerRestoreCurrentPolicy: null,
@@ -43,22 +43,22 @@ const PowerControlStore = {
);
},
async getPowerRestoreCurrentPolicy({ commit }) {
- api
+ return await api
.get('/redfish/v1/Systems/system')
.then(({ data: { PowerRestorePolicy } }) => {
commit('setPowerRestoreCurrentPolicy', PowerRestorePolicy);
})
.catch((error) => console.log(error));
},
- async setPowerRestorePolicy({ commit }, powerPolicy) {
+ async setPowerRestorePolicy({ dispatch }, powerPolicy) {
const data = { PowerRestorePolicy: powerPolicy };
return await api
.patch('/redfish/v1/Systems/system', data)
- .then(() =>
- commit('setPowerRestoreCurrentPolicy', data.PowerRestorePolicy)
- )
- .then(() => i18n.t('pagePowerRestorePolicy.toast.successSaveSettings'))
+ .then(() => {
+ dispatch('getPowerRestoreCurrentPolicy');
+ return i18n.t('pagePowerRestorePolicy.toast.successSaveSettings');
+ })
.catch((error) => {
console.log(error);
throw new Error(
@@ -69,4 +69,4 @@ const PowerControlStore = {
},
};
-export default PowerControlStore;
+export default PowerPolicyStore;