From 8841b7d463a5272a87faaa14cb103f778a772770 Mon Sep 17 00:00:00 2001 From: Sean Zhang Date: Sat, 15 Jun 2024 08:42:41 +0300 Subject: Replace fixed paths with response from API Currently, the Redfish request used fixed URIs, modify the code to use the BMC and System paths got from response of API calls. For CertificateStore, since it was using the URL for constant variable assignment, changed the constant CERTIFICATE_TYPES to method call. Change-Id: I330b7272083e3e6993aae5705aae170b8e9a4659 Signed-off-by: Sean Zhang --- src/store/modules/Operations/ControlStore.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/store/modules/Operations/ControlStore.js') diff --git a/src/store/modules/Operations/ControlStore.js b/src/store/modules/Operations/ControlStore.js index e76063ba..efcdf627 100644 --- a/src/store/modules/Operations/ControlStore.js +++ b/src/store/modules/Operations/ControlStore.js @@ -51,7 +51,7 @@ const ControlStore = { actions: { async getLastPowerOperationTime({ commit }) { return await api - .get('/redfish/v1/Systems/system') + .get(`${await this.dispatch('global/getSystemPath')}`) .then((response) => { const lastReset = response.data.LastResetTime; if (lastReset) { @@ -61,9 +61,9 @@ const ControlStore = { }) .catch((error) => console.log(error)); }, - getLastBmcRebootTime({ commit }) { + async getLastBmcRebootTime({ commit }) { return api - .get('/redfish/v1/Managers/bmc') + .get(`${await this.dispatch('global/getBmcPath')}`) .then((response) => { const lastBmcReset = response.data.LastResetTime; const lastBmcRebootTime = new Date(lastBmcReset); @@ -74,7 +74,10 @@ const ControlStore = { async rebootBmc({ dispatch }) { const data = { ResetType: 'GracefulRestart' }; return await api - .post('/redfish/v1/Managers/bmc/Actions/Manager.Reset', data) + .post( + `${await this.dispatch('global/getBmcPath')}/Actions/Manager.Reset`, + data, + ) .then(() => dispatch('getLastBmcRebootTime')) .then(() => i18n.t('pageRebootBmc.toast.successRebootStart')) .catch((error) => { @@ -117,10 +120,13 @@ const ControlStore = { commit('setOperationInProgress', false); dispatch('getLastPowerOperationTime'); }, - serverPowerChange({ commit }, data) { + async serverPowerChange({ commit }, data) { commit('setOperationInProgress', true); api - .post('/redfish/v1/Systems/system/Actions/ComputerSystem.Reset', data) + .post( + `${await this.dispatch('global/getSystemPath')}/Actions/ComputerSystem.Reset`, + data, + ) .catch((error) => { console.log(error); commit('setOperationInProgress', false); -- cgit v1.2.3