Skip to content

Commit

Permalink
Updated Power restore policy URI
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
Nikhil-Ashoka authored and Gunnar Mills committed Oct 1, 2024
1 parent 51feb35 commit 4130397
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions src/store/modules/Settings/PowerPolicyStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4130397

Please sign in to comment.