summaryrefslogtreecommitdiff
path: root/src/store/modules/Operations
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/Operations')
-rw-r--r--src/store/modules/Operations/BootSettingsStore.js9
-rw-r--r--src/store/modules/Operations/ControlStore.js18
-rw-r--r--src/store/modules/Operations/FactoryResetStore.js13
-rw-r--r--src/store/modules/Operations/FirmwareStore.js10
-rw-r--r--src/store/modules/Operations/KeyClearStore.js2
-rw-r--r--src/store/modules/Operations/VirtualMediaStore.js6
6 files changed, 36 insertions, 22 deletions
diff --git a/src/store/modules/Operations/BootSettingsStore.js b/src/store/modules/Operations/BootSettingsStore.js
index 1f5a628f..89598456 100644
--- a/src/store/modules/Operations/BootSettingsStore.js
+++ b/src/store/modules/Operations/BootSettingsStore.js
@@ -32,7 +32,7 @@ const BootSettingsStore = {
actions: {
async getBootSettings({ commit }) {
return await api
- .get('/redfish/v1/Systems/system')
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then(({ data: { Boot } }) => {
commit(
'setBootSourceOptions',
@@ -43,7 +43,10 @@ const BootSettingsStore = {
})
.catch((error) => console.log(error));
},
- saveBootSettings({ commit, dispatch }, { bootSource, overrideEnabled }) {
+ async saveBootSettings(
+ { commit, dispatch },
+ { bootSource, overrideEnabled },
+ ) {
const data = { Boot: {} };
data.Boot.BootSourceOverrideTarget = bootSource;
@@ -56,7 +59,7 @@ const BootSettingsStore = {
}
return api
- .patch('/redfish/v1/Systems/system', data)
+ .patch(`${await this.dispatch('global/getSystemPath')}`, data)
.then((response) => {
// If request success, commit the values
commit('setBootSource', data.Boot.BootSourceOverrideTarget);
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);
diff --git a/src/store/modules/Operations/FactoryResetStore.js b/src/store/modules/Operations/FactoryResetStore.js
index 395cae19..84a8f08a 100644
--- a/src/store/modules/Operations/FactoryResetStore.js
+++ b/src/store/modules/Operations/FactoryResetStore.js
@@ -6,9 +6,12 @@ const FactoryResetStore = {
actions: {
async resetToDefaults() {
return await api
- .post('/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults', {
- ResetType: 'ResetAll',
- })
+ .post(
+ `${await this.dispatch('global/getBmcPath')}/Actions/Manager.ResetToDefaults`,
+ {
+ ResetType: 'ResetAll',
+ },
+ )
.then(() => i18n.t('pageFactoryReset.toast.resetToDefaultsSuccess'))
.catch((error) => {
console.log('Factory Reset: ', error);
@@ -19,7 +22,9 @@ const FactoryResetStore = {
},
async resetBios() {
return await api
- .post('/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios')
+ .post(
+ `${await this.dispatch('global/getSystemPath')}/Bios/Actions/Bios.ResetBios`,
+ )
.then(() => i18n.t('pageFactoryReset.toast.resetBiosSuccess'))
.catch((error) => {
console.log('Factory Reset: ', error);
diff --git a/src/store/modules/Operations/FirmwareStore.js b/src/store/modules/Operations/FirmwareStore.js
index 7dce2316..f6f965f9 100644
--- a/src/store/modules/Operations/FirmwareStore.js
+++ b/src/store/modules/Operations/FirmwareStore.js
@@ -52,18 +52,18 @@ const FirmwareStore = {
dispatch('getActiveBmcFirmware');
return await dispatch('getFirmwareInventory');
},
- getActiveBmcFirmware({ commit }) {
+ async getActiveBmcFirmware({ commit }) {
return api
- .get('/redfish/v1/Managers/bmc')
+ .get(`${await this.dispatch('global/getBmcPath')}`)
.then(({ data: { Links } }) => {
const id = Links?.ActiveSoftwareImage['@odata.id'].split('/').pop();
commit('setActiveBmcFirmwareId', id);
})
.catch((error) => console.log(error));
},
- getActiveHostFirmware({ commit }) {
+ async getActiveHostFirmware({ commit }) {
return api
- .get('/redfish/v1/Systems/system/Bios')
+ .get(`${await this.dispatch('global/getSystemPath')}/Bios`)
.then(({ data: { Links } }) => {
const id = Links?.ActiveSoftwareImage['@odata.id'].split('/').pop();
commit('setActiveHostFirmwareId', id);
@@ -159,7 +159,7 @@ const FirmwareStore = {
},
};
return await api
- .patch('/redfish/v1/Managers/bmc', data)
+ .patch(`${await this.dispatch('global/getBmcPath')}`, data)
.catch((error) => {
console.log(error);
throw new Error(i18n.t('pageFirmware.toast.errorSwitchImages'));
diff --git a/src/store/modules/Operations/KeyClearStore.js b/src/store/modules/Operations/KeyClearStore.js
index 78804e75..9e5e875e 100644
--- a/src/store/modules/Operations/KeyClearStore.js
+++ b/src/store/modules/Operations/KeyClearStore.js
@@ -10,7 +10,7 @@ const KeyClearStore = {
};
return await api
.patch(
- '/redfish/v1/Systems/system/Bios/Settings',
+ `${await this.dispatch('global/getSystemPath')}/Bios/Settings`,
selectedKeyForClearing,
)
.then(() => i18n.t('pageKeyClear.toast.selectedKeyClearedSuccess'))
diff --git a/src/store/modules/Operations/VirtualMediaStore.js b/src/store/modules/Operations/VirtualMediaStore.js
index 1d27e215..9688d9c6 100644
--- a/src/store/modules/Operations/VirtualMediaStore.js
+++ b/src/store/modules/Operations/VirtualMediaStore.js
@@ -49,7 +49,7 @@ const VirtualMediaStore = {
}
return await api
- .get('/redfish/v1/Managers/bmc/VirtualMedia')
+ .get(`${await this.dispatch('global/getBmcPath')}/VirtualMedia`)
.then((response) =>
response.data.Members.map(
(virtualMedia) => virtualMedia['@odata.id'],
@@ -95,7 +95,7 @@ const VirtualMediaStore = {
async mountImage(_, { id, data }) {
return await api
.post(
- `/redfish/v1/Managers/bmc/VirtualMedia/${id}/Actions/VirtualMedia.InsertMedia`,
+ `${await this.dispatch('global/getBmcPath')}/VirtualMedia/${id}/Actions/VirtualMedia.InsertMedia`,
data,
)
.catch((error) => {
@@ -106,7 +106,7 @@ const VirtualMediaStore = {
async unmountImage(_, id) {
return await api
.post(
- `/redfish/v1/Managers/bmc/VirtualMedia/${id}/Actions/VirtualMedia.EjectMedia`,
+ `${await this.dispatch('global/getBmcPath')}/VirtualMedia/${id}/Actions/VirtualMedia.EjectMedia`,
)
.catch((error) => {
console.log('Unmount image:', error);