diff options
author | Nikhil Ashoka <a.nikhil@ibm.com> | 2024-09-30 18:08:43 +0300 |
---|---|---|
committer | Surya Venkatesan <suryav@ami.com> | 2024-10-03 18:04:30 +0300 |
commit | 14914269eff5f06571f8dab9a1d4bf8e8509c4dc (patch) | |
tree | c3dc2c4fadfc9db1299aeb3b2d539d341c35894b | |
parent | 343cf0d96479e928798d42ffeddfc0a0cdb2c16c (diff) | |
download | webui-vue-vue3.tar.xz |
Updated Power restore policy URIvue3
- 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>
Signed-off-by: Surya Venkatesan <suryav@ami.com>
-rw-r--r-- | src/store/modules/Settings/PowerPolicyStore.js | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/store/modules/Settings/PowerPolicyStore.js b/src/store/modules/Settings/PowerPolicyStore.js index 9ee12390..9cbf3c8b 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.global.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.global.t( + `pagePowerRestorePolicy.policies.${powerState}`, + )} - ${ + PowerRestorePolicyTypes.enumDescriptions[powerState] + }`; + return { + state: powerState, + desc, + }; + }, + ); + commit('setPowerRestorePolicies', powerPoliciesData); }, ); - commit('setPowerRestorePolicies', powerPoliciesData); - }, - ); + } + }); }, async getPowerRestoreCurrentPolicy({ commit }) { return await api |