summaryrefslogtreecommitdiff
path: root/src/store/modules/Operations/ControlStore.js
diff options
context:
space:
mode:
authorSean Zhang <xiazhang@nvidia.com>2024-06-15 08:42:41 +0300
committerGunnar Mills <gunnar@gmills.xyz>2024-06-25 18:45:07 +0300
commit8841b7d463a5272a87faaa14cb103f778a772770 (patch)
tree731d8c82ddb76c1c9358c36d707747b09c5189cd /src/store/modules/Operations/ControlStore.js
parentccb71f0bd6b91b4344cf9a776a433528a5771217 (diff)
downloadwebui-vue-8841b7d463a5272a87faaa14cb103f778a772770.tar.xz
Replace fixed paths with response from APIHEADmaster
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 <xiazhang@nvidia.com>
Diffstat (limited to 'src/store/modules/Operations/ControlStore.js')
-rw-r--r--src/store/modules/Operations/ControlStore.js18
1 files changed, 12 insertions, 6 deletions
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);