summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Ashoka <a.nikhil@ibm.com>2024-09-30 18:08:43 +0300
committerGunnar Mills <gunnar@gmills.xyz>2024-10-01 19:38:39 +0300
commit413039754779af2bb172b6ff84b646b814c48e31 (patch)
treeb4b15ffcf31a26f3f4d812aad9b51299fbb5ad98
parent51feb35350eee87fc5bf1d463873feb3ccf12f1e (diff)
downloadwebui-vue-413039754779af2bb172b6ff84b646b814c48e31.tar.xz
Updated Power restore policy URI
- Previously, we used to get the values for power restore policy page from“JsonSchemas/ComputerSystem/ComputerSystem.json”. Now we have removed the hardcoded API call and are fetching the values from the JsonSchemas/ComputerSystem’s URI because we would have versioned ComputerSystem.json in the redfish response. Change-Id: I1a25cbbb3dfc536485a6f71a359ae32c6eadf5f7 Signed-off-by: Nikhil Ashoka <a.nikhil@ibm.com>
-rw-r--r--src/store/modules/Settings/PowerPolicyStore.js47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/store/modules/Settings/PowerPolicyStore.js b/src/store/modules/Settings/PowerPolicyStore.js
index fc65381e..0bdc0b5d 100644
--- a/src/store/modules/Settings/PowerPolicyStore.js
+++ b/src/store/modules/Settings/PowerPolicyStore.js
@@ -20,27 +20,36 @@ const PowerPolicyStore = {
actions: {
async getPowerRestorePolicies({ commit }) {
return await api
- .get('/redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.json')
- .then(
- ({
- data: {
- definitions: { PowerRestorePolicyTypes = {} },
- },
- }) => {
- let powerPoliciesData = PowerRestorePolicyTypes.enum.map(
- (powerState) => {
- let desc = `${i18n.t(
- `pagePowerRestorePolicy.policies.${powerState}`,
- )} - ${PowerRestorePolicyTypes.enumDescriptions[powerState]}`;
- return {
- state: powerState,
- desc,
- };
+ .get('/redfish/v1/JsonSchemas/ComputerSystem')
+ .then(async (response) => {
+ if (
+ response.data?.Location.length > 0 &&
+ response.data?.Location[0].Uri
+ ) {
+ return await api.get(response.data?.Location[0].Uri).then(
+ ({
+ data: {
+ definitions: { PowerRestorePolicyTypes = {} },
+ },
+ }) => {
+ let powerPoliciesData = PowerRestorePolicyTypes.enum.map(
+ (powerState) => {
+ let desc = `${i18n.t(
+ `pagePowerRestorePolicy.policies.${powerState}`,
+ )} - ${
+ PowerRestorePolicyTypes.enumDescriptions[powerState]
+ }`;
+ return {
+ state: powerState,
+ desc,
+ };
+ },
+ );
+ commit('setPowerRestorePolicies', powerPoliciesData);
},
);
- commit('setPowerRestorePolicies', powerPoliciesData);
- },
- );
+ }
+ });
},
async getPowerRestoreCurrentPolicy({ commit }) {
return await api