summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'src/store')
-rw-r--r--src/store/modules/GlobalStore.js26
-rw-r--r--src/store/modules/HardwareStatus/BmcStore.js2
-rw-r--r--src/store/modules/HardwareStatus/MemoryStore.js2
-rw-r--r--src/store/modules/HardwareStatus/ProcessorStore.js2
-rw-r--r--src/store/modules/HardwareStatus/ServerLedStore.js4
-rw-r--r--src/store/modules/HardwareStatus/SystemStore.js7
-rw-r--r--src/store/modules/Logs/DumpsStore.js14
-rw-r--r--src/store/modules/Logs/EventLogStore.js6
-rw-r--r--src/store/modules/Logs/PostCodeLogsStore.js6
-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
-rw-r--r--src/store/modules/SecurityAndAccess/CertificatesStore.js110
-rw-r--r--src/store/modules/SecurityAndAccess/PoliciesStore.js18
-rw-r--r--src/store/modules/Settings/DateTimeStore.js14
-rw-r--r--src/store/modules/Settings/NetworkStore.js20
-rw-r--r--src/store/modules/Settings/PowerPolicyStore.js4
20 files changed, 186 insertions, 107 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 036dc481..10d50b1a 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -77,9 +77,29 @@ const GlobalStore = {
},
},
actions: {
+ async getBmcPath() {
+ const serviceRoot = await api
+ .get('/redfish/v1')
+ .catch((error) => console.log(error));
+ let bmcPath = serviceRoot.data?.ManagerProvidingService?.['@odata.id'];
+ if (!bmcPath) {
+ const managers = await api
+ .get('/redfish/v1/Managers')
+ .catch((error) => console.log(error));
+ bmcPath = managers.data?.Members?.[0]?.['@odata.id'];
+ }
+ return bmcPath;
+ },
+ async getSystemPath() {
+ const systems = await api
+ .get('/redfish/v1/Systems')
+ .catch((error) => console.log(error));
+ let systemPath = systems.data?.Members?.[0]?.['@odata.id'];
+ return systemPath;
+ },
async getBmcTime({ commit }) {
return await api
- .get('/redfish/v1/Managers/bmc')
+ .get(`${await this.dispatch('global/getBmcPath')}`)
.then((response) => {
const bmcDateTime = response.data.DateTime;
const date = new Date(bmcDateTime);
@@ -87,9 +107,9 @@ const GlobalStore = {
})
.catch((error) => console.log(error));
},
- getSystemInfo({ commit }) {
+ async getSystemInfo({ commit }) {
api
- .get('/redfish/v1/Systems/system')
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then(
({
data: {
diff --git a/src/store/modules/HardwareStatus/BmcStore.js b/src/store/modules/HardwareStatus/BmcStore.js
index d96926ea..f0e4cf96 100644
--- a/src/store/modules/HardwareStatus/BmcStore.js
+++ b/src/store/modules/HardwareStatus/BmcStore.js
@@ -47,7 +47,7 @@ const BmcStore = {
actions: {
async getBmcInfo({ commit }) {
return await api
- .get('/redfish/v1/Managers/bmc')
+ .get(`${await this.dispatch('global/getBmcPath')}`)
.then(({ data }) => commit('setBmcInfo', data))
.catch((error) => console.log(error));
},
diff --git a/src/store/modules/HardwareStatus/MemoryStore.js b/src/store/modules/HardwareStatus/MemoryStore.js
index 787a0502..d9a107d3 100644
--- a/src/store/modules/HardwareStatus/MemoryStore.js
+++ b/src/store/modules/HardwareStatus/MemoryStore.js
@@ -60,7 +60,7 @@ const MemoryStore = {
actions: {
async getDimms({ commit }) {
return await api
- .get('/redfish/v1/Systems/system/Memory')
+ .get(`${await this.dispatch('global/getSystemPath')}/Memory`)
.then(({ data: { Members } }) => {
const promises = Members.map((item) => api.get(item['@odata.id']));
return api.all(promises);
diff --git a/src/store/modules/HardwareStatus/ProcessorStore.js b/src/store/modules/HardwareStatus/ProcessorStore.js
index 49f96208..446fdb9c 100644
--- a/src/store/modules/HardwareStatus/ProcessorStore.js
+++ b/src/store/modules/HardwareStatus/ProcessorStore.js
@@ -63,7 +63,7 @@ const ProcessorStore = {
actions: {
async getProcessorsInfo({ commit }) {
return await api
- .get('/redfish/v1/Systems/system/Processors')
+ .get(`${await this.dispatch('global/getSystemPath')}/Processors`)
.then(({ data: { Members = [] } }) =>
Members.map((member) => api.get(member['@odata.id'])),
)
diff --git a/src/store/modules/HardwareStatus/ServerLedStore.js b/src/store/modules/HardwareStatus/ServerLedStore.js
index af228022..d4af0648 100644
--- a/src/store/modules/HardwareStatus/ServerLedStore.js
+++ b/src/store/modules/HardwareStatus/ServerLedStore.js
@@ -17,7 +17,7 @@ const ServerLedStore = {
actions: {
async getIndicatorLedActiveState({ commit }) {
return await api
- .get('/redfish/v1/Systems/system')
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then((response) => {
commit(
'setIndicatorLedActiveState',
@@ -29,7 +29,7 @@ const ServerLedStore = {
async saveIndicatorLedActiveState({ commit }, payload) {
commit('setIndicatorLedActiveState', payload);
return await api
- .patch('/redfish/v1/Systems/system', {
+ .patch(`${await this.dispatch('global/getSystemPath')}`, {
LocationIndicatorActive: payload,
})
.catch((error) => {
diff --git a/src/store/modules/HardwareStatus/SystemStore.js b/src/store/modules/HardwareStatus/SystemStore.js
index ea519d73..87d2810b 100644
--- a/src/store/modules/HardwareStatus/SystemStore.js
+++ b/src/store/modules/HardwareStatus/SystemStore.js
@@ -37,16 +37,13 @@ const SystemStore = {
actions: {
async getSystem({ commit }) {
return await api
- .get('/redfish/v1')
- .then((response) =>
- api.get(`${response.data.Systems['@odata.id']}/system`),
- )
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then(({ data }) => commit('setSystemInfo', data))
.catch((error) => console.log(error));
},
async changeIdentifyLedState({ commit }, ledState) {
return await api
- .patch('/redfish/v1/Systems/system', {
+ .patch(`${await this.dispatch('global/getSystemPath')}`, {
LocationIndicatorActive: ledState,
})
.then(() => {
diff --git a/src/store/modules/Logs/DumpsStore.js b/src/store/modules/Logs/DumpsStore.js
index 328e3164..9391e571 100644
--- a/src/store/modules/Logs/DumpsStore.js
+++ b/src/store/modules/Logs/DumpsStore.js
@@ -24,9 +24,7 @@ const DumpsStore = {
actions: {
async getBmcDumpEntries() {
return api
- .get('/redfish/v1/')
- .then((response) => api.get(response.data.Managers['@odata.id']))
- .then((response) => api.get(`${response.data['@odata.id']}/bmc`))
+ .get(`${await this.dispatch('global/getBmcPath')}`)
.then((response) => api.get(response.data.LogServices['@odata.id']))
.then((response) => api.get(`${response.data['@odata.id']}/Dump`))
.then((response) => api.get(response.data.Entries['@odata.id']))
@@ -34,9 +32,7 @@ const DumpsStore = {
},
async getSystemDumpEntries() {
return api
- .get('/redfish/v1/')
- .then((response) => api.get(response.data.Systems['@odata.id']))
- .then((response) => api.get(`${response.data['@odata.id']}/system`))
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then((response) => api.get(response.data.LogServices['@odata.id']))
.then((response) => api.get(`${response.data['@odata.id']}/Dump`))
.then((response) => api.get(response.data.Entries['@odata.id']))
@@ -56,7 +52,7 @@ const DumpsStore = {
async createBmcDump() {
return await api
.post(
- '/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData',
+ `${await this.dispatch('global/getBmcPath')}/LogServices/Dump/Actions/LogService.CollectDiagnosticData`,
{
DiagnosticDataType: 'Manager',
OEMDiagnosticDataType: '',
@@ -70,7 +66,7 @@ const DumpsStore = {
async createSystemDump() {
return await api
.post(
- '/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData',
+ `${await this.dispatch('global/getSystemPath')}/LogServices/Dump/Actions/LogService.CollectDiagnosticData`,
{
DiagnosticDataType: 'OEM',
OEMDiagnosticDataType: 'System',
@@ -123,7 +119,7 @@ const DumpsStore = {
const totalDumpCount = state.allDumps.length;
return await api
.post(
- '/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog',
+ `${await this.dispatch('global/getBmcPath')}/LogServices/Dump/Actions/LogService.ClearLog`,
)
.then(() => {
commit('setAllDumps', []);
diff --git a/src/store/modules/Logs/EventLogStore.js b/src/store/modules/Logs/EventLogStore.js
index f7b2ead6..e67da39b 100644
--- a/src/store/modules/Logs/EventLogStore.js
+++ b/src/store/modules/Logs/EventLogStore.js
@@ -42,7 +42,9 @@ const EventLogStore = {
actions: {
async getEventLogData({ commit }) {
return await api
- .get('/redfish/v1/Systems/system/LogServices/EventLog/Entries')
+ .get(
+ `${await this.dispatch('global/getSystemPath')}/LogServices/EventLog/Entries`,
+ )
.then(({ data: { Members = [] } = {} }) => {
const eventLogs = Members.map((log) => {
const {
@@ -79,7 +81,7 @@ const EventLogStore = {
async deleteAllEventLogs({ dispatch }, data) {
return await api
.post(
- '/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog',
+ `${await this.dispatch('global/getSystemPath')}/LogServices/EventLog/Actions/LogService.ClearLog`,
)
.then(() => dispatch('getEventLogData'))
.then(() => i18n.tc('pageEventLogs.toast.successDelete', data.length))
diff --git a/src/store/modules/Logs/PostCodeLogsStore.js b/src/store/modules/Logs/PostCodeLogsStore.js
index 7648b13c..7bd1410f 100644
--- a/src/store/modules/Logs/PostCodeLogsStore.js
+++ b/src/store/modules/Logs/PostCodeLogsStore.js
@@ -16,7 +16,9 @@ const PostCodeLogsStore = {
actions: {
async getPostCodesLogData({ commit }) {
return await api
- .get('/redfish/v1/Systems/system/LogServices/PostCodes/Entries')
+ .get(
+ `${await this.dispatch('global/getSystemPath')}/LogServices/PostCodes/Entries`,
+ )
.then(({ data: { Members = [] } = {} }) => {
const postCodeLogs = Members.map((log) => {
const { Created, MessageArgs, AdditionalDataURI } = log;
@@ -37,7 +39,7 @@ const PostCodeLogsStore = {
async deleteAllPostCodeLogs({ dispatch }, data) {
return await api
.post(
- '/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog',
+ `${await this.dispatch('global/getSystemPath')}/LogServices/PostCodes/Actions/LogService.ClearLog`,
)
.then(() => dispatch('getPostCodesLogData'))
.then(() =>
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);
diff --git a/src/store/modules/SecurityAndAccess/CertificatesStore.js b/src/store/modules/SecurityAndAccess/CertificatesStore.js
index 666f5fd5..5c7c36d2 100644
--- a/src/store/modules/SecurityAndAccess/CertificatesStore.js
+++ b/src/store/modules/SecurityAndAccess/CertificatesStore.js
@@ -1,29 +1,8 @@
import api from '@/store/api';
import i18n from '@/i18n';
-export const CERTIFICATE_TYPES = [
- {
- type: 'HTTPS Certificate',
- location: '/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/',
- label: i18n.t('pageCertificates.httpsCertificate'),
- },
- {
- type: 'LDAP Certificate',
- location: '/redfish/v1/AccountService/LDAP/Certificates/',
- label: i18n.t('pageCertificates.ldapCertificate'),
- },
- {
- type: 'TrustStore Certificate',
- location: '/redfish/v1/Managers/bmc/Truststore/Certificates/',
- // Web UI will show 'CA Certificate' instead of
- // 'TrustStore Certificate' after user testing revealed
- // the term 'TrustStore Certificate' wasn't recognized/was unfamilar
- label: i18n.t('pageCertificates.caCertificate'),
- },
-];
-
-const getCertificateProp = (type, prop) => {
- const certificate = CERTIFICATE_TYPES.find(
+const getCertificateProp = (certificateTypes, type, prop) => {
+ const certificate = certificateTypes.find(
(certificate) => certificate.type === type,
);
return certificate ? certificate[prop] : null;
@@ -34,10 +13,12 @@ const CertificatesStore = {
state: {
allCertificates: [],
availableUploadTypes: [],
+ certificateTypes: [],
},
getters: {
allCertificates: (state) => state.allCertificates,
availableUploadTypes: (state) => state.availableUploadTypes,
+ certificateTypes: (state) => state.certificateTypes,
},
mutations: {
setCertificates(state, certificates) {
@@ -46,9 +27,40 @@ const CertificatesStore = {
setAvailableUploadTypes(state, availableUploadTypes) {
state.availableUploadTypes = availableUploadTypes;
},
+ setCertificateTypes(state, certificateTypes) {
+ state.certificateTypes = certificateTypes;
+ },
},
actions: {
- async getCertificates({ commit }) {
+ async getCertificateTypes({ commit }) {
+ const certificateTypes = [
+ {
+ type: 'HTTPS Certificate',
+ location: `${await this.dispatch(
+ 'global/getBmcPath',
+ )}/NetworkProtocol/HTTPS/Certificates/`,
+ label: i18n.t('pageCertificates.httpsCertificate'),
+ },
+ {
+ type: 'LDAP Certificate',
+ location: '/redfish/v1/AccountService/LDAP/Certificates/',
+ label: i18n.t('pageCertificates.ldapCertificate'),
+ },
+ {
+ type: 'TrustStore Certificate',
+ location: `${await this.dispatch(
+ 'global/getBmcPath',
+ )}/Truststore/Certificates/`,
+ // Web UI will show 'CA Certificate' instead of
+ // 'TrustStore Certificate' after user testing revealed
+ // the term 'TrustStore Certificate' wasn't recognized/was unfamilar
+ label: i18n.t('pageCertificates.caCertificate'),
+ },
+ ];
+ await commit('setCertificateTypes', certificateTypes);
+ },
+ async getCertificates({ dispatch, getters, commit }) {
+ await dispatch('getCertificateTypes');
return await api
.get('/redfish/v1/CertificateService/CertificateLocations')
.then(
@@ -75,14 +87,18 @@ const CertificatesStore = {
return {
type: Name,
location: data['@odata.id'],
- certificate: getCertificateProp(Name, 'label'),
+ certificate: getCertificateProp(
+ getters['certificateTypes'],
+ Name,
+ 'label',
+ ),
issuedBy: Issuer.CommonName,
issuedTo: Subject.CommonName,
validFrom: new Date(ValidNotBefore),
validUntil: new Date(ValidNotAfter),
};
});
- const availableUploadTypes = CERTIFICATE_TYPES.filter(
+ const availableUploadTypes = getters['certificateTypes'].filter(
({ type }) =>
!certificates
.map((certificate) => certificate.type)
@@ -95,15 +111,23 @@ const CertificatesStore = {
);
});
},
- async addNewCertificate({ dispatch }, { file, type }) {
+ async addNewCertificate({ dispatch, getters }, { file, type }) {
return await api
- .post(getCertificateProp(type, 'location'), file, {
- headers: { 'Content-Type': 'application/x-pem-file' },
- })
+ .post(
+ getCertificateProp(getters['certificateTypes'], type, 'location'),
+ file,
+ {
+ headers: { 'Content-Type': 'application/x-pem-file' },
+ },
+ )
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageCertificates.toast.successAddCertificate', {
- certificate: getCertificateProp(type, 'label'),
+ certificate: getCertificateProp(
+ getters['certificateTypes'],
+ type,
+ 'label',
+ ),
}),
)
.catch((error) => {
@@ -112,7 +136,7 @@ const CertificatesStore = {
});
},
async replaceCertificate(
- { dispatch },
+ { dispatch, getters },
{ certificateString, location, type },
) {
const data = {};
@@ -128,7 +152,11 @@ const CertificatesStore = {
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageCertificates.toast.successReplaceCertificate', {
- certificate: getCertificateProp(type, 'label'),
+ certificate: getCertificateProp(
+ getters['certificateTypes'],
+ type,
+ 'label',
+ ),
}),
)
.catch((error) => {
@@ -138,13 +166,17 @@ const CertificatesStore = {
);
});
},
- async deleteCertificate({ dispatch }, { type, location }) {
+ async deleteCertificate({ dispatch, getters }, { type, location }) {
return await api
.delete(location)
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageCertificates.toast.successDeleteCertificate', {
- certificate: getCertificateProp(type, 'label'),
+ certificate: getCertificateProp(
+ getters['certificateTypes'],
+ type,
+ 'label',
+ ),
}),
)
.catch((error) => {
@@ -154,7 +186,7 @@ const CertificatesStore = {
);
});
},
- async generateCsr(_, userData) {
+ async generateCsr({ getters }, userData) {
const {
certificateType,
country,
@@ -173,7 +205,11 @@ const CertificatesStore = {
const data = {};
data.CertificateCollection = {
- '@odata.id': getCertificateProp(certificateType, 'location'),
+ '@odata.id': getCertificateProp(
+ getters['certificateTypes'],
+ certificateType,
+ 'location',
+ ),
};
data.Country = country;
data.State = state;
diff --git a/src/store/modules/SecurityAndAccess/PoliciesStore.js b/src/store/modules/SecurityAndAccess/PoliciesStore.js
index e6bcfb96..f1e98b27 100644
--- a/src/store/modules/SecurityAndAccess/PoliciesStore.js
+++ b/src/store/modules/SecurityAndAccess/PoliciesStore.js
@@ -31,7 +31,7 @@ const PoliciesStore = {
actions: {
async getNetworkProtocolStatus({ commit }) {
return await api
- .get('/redfish/v1/Managers/bmc/NetworkProtocol')
+ .get(`${await this.dispatch('global/getBmcPath')}/NetworkProtocol`)
.then((response) => {
const sshProtocol = response.data.SSH.ProtocolEnabled;
const ipmiProtocol = response.data.IPMI.ProtocolEnabled;
@@ -42,7 +42,7 @@ const PoliciesStore = {
},
async getBiosStatus({ commit }) {
return await api
- .get('/redfish/v1/Systems/system/Bios')
+ .get(`${await this.dispatch('global/getSystemPath')}/Bios`)
.then((response) => {
commit('setRtadEnabled', response.data.Attributes.pvm_rtad);
commit('setVtpmEnabled', response.data.Attributes.pvm_vtpm);
@@ -66,7 +66,10 @@ const PoliciesStore = {
},
};
return await api
- .patch('/redfish/v1/Managers/bmc/NetworkProtocol', ipmi)
+ .patch(
+ `${await this.dispatch('global/getBmcPath')}/NetworkProtocol`,
+ ipmi,
+ )
.then(() => {
if (protocolEnabled) {
return i18n.t('pagePolicies.toast.successIpmiEnabled');
@@ -92,7 +95,10 @@ const PoliciesStore = {
},
};
return await api
- .patch('/redfish/v1/Managers/bmc/NetworkProtocol', ssh)
+ .patch(
+ `${await this.dispatch('global/getBmcPath')}/NetworkProtocol`,
+ ssh,
+ )
.then(() => {
if (protocolEnabled) {
return i18n.t('pagePolicies.toast.successSshEnabled');
@@ -113,7 +119,7 @@ const PoliciesStore = {
async saveRtadState({ commit }, updatedRtad) {
commit('setRtadEnabled', updatedRtad);
return await api
- .patch('/redfish/v1/Systems/system/Bios/Settings', {
+ .patch(`${await this.dispatch('global/getSystemPath')}/Bios/Settings`, {
Attributes: {
pvm_rtad: updatedRtad,
},
@@ -137,7 +143,7 @@ const PoliciesStore = {
async saveVtpmState({ commit }, updatedVtpm) {
commit('setVtpmEnabled', updatedVtpm);
return await api
- .patch('/redfish/v1/Systems/system/Bios/Settings', {
+ .patch(`${await this.dispatch('global/getSystemPath')}/Bios/Settings`, {
Attributes: {
pvm_vtpm: updatedVtpm,
},
diff --git a/src/store/modules/Settings/DateTimeStore.js b/src/store/modules/Settings/DateTimeStore.js
index 51b722a8..9d804a7e 100644
--- a/src/store/modules/Settings/DateTimeStore.js
+++ b/src/store/modules/Settings/DateTimeStore.js
@@ -19,7 +19,7 @@ const DateTimeStore = {
actions: {
async getNtpData({ commit }) {
return await api
- .get('/redfish/v1/Managers/bmc/NetworkProtocol')
+ .get(`${await this.dispatch('global/getBmcPath')}/NetworkProtocol`)
.then((response) => {
const ntpServers = response.data.NTP.NTPServers;
const isNtpProtocolEnabled = response.data.NTP.ProtocolEnabled;
@@ -40,7 +40,10 @@ const DateTimeStore = {
ntpData.NTP.NTPServers = dateTimeForm.ntpServersArray;
}
return await api
- .patch(`/redfish/v1/Managers/bmc/NetworkProtocol`, ntpData)
+ .patch(
+ `${await this.dispatch('global/getBmcPath')}/NetworkProtocol`,
+ ntpData,
+ )
.then(async () => {
if (!dateTimeForm.ntpProtocolEnabled) {
const dateTimeData = {
@@ -58,9 +61,12 @@ const DateTimeStore = {
*/
const timeoutVal = state.isNtpProtocolEnabled ? 20000 : 0;
return await new Promise((resolve, reject) => {
- setTimeout(() => {
+ setTimeout(async () => {
return api
- .patch(`/redfish/v1/Managers/bmc`, dateTimeData)
+ .patch(
+ `${await this.dispatch('global/getBmcPath')}`,
+ dateTimeData,
+ )
.then(() => resolve())
.catch(() => reject());
}, timeoutVal);
diff --git a/src/store/modules/Settings/NetworkStore.js b/src/store/modules/Settings/NetworkStore.js
index 9b016030..7f24e198 100644
--- a/src/store/modules/Settings/NetworkStore.js
+++ b/src/store/modules/Settings/NetworkStore.js
@@ -60,7 +60,7 @@ const NetworkStore = {
actions: {
async getEthernetData({ commit }) {
return await api
- .get('/redfish/v1/Managers/bmc/EthernetInterfaces')
+ .get(`${await this.dispatch('global/getBmcPath')}/EthernetInterfaces`)
.then((response) =>
response.data.Members.map(
(ethernetInterface) => ethernetInterface['@odata.id'],
@@ -96,7 +96,7 @@ const NetworkStore = {
};
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.selectedInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.selectedInterfaceId}`,
data,
)
.then(dispatch('getEthernetData'))
@@ -125,7 +125,7 @@ const NetworkStore = {
// on all interfaces
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.firstInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.firstInterfaceId}`,
data,
)
.then(() => {
@@ -154,7 +154,7 @@ const NetworkStore = {
// on all interfaces
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.firstInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.firstInterfaceId}`,
data,
)
.then(() => {
@@ -183,7 +183,7 @@ const NetworkStore = {
// on all interfaces
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.firstInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.firstInterfaceId}`,
data,
)
.then(() => {
@@ -221,7 +221,7 @@ const NetworkStore = {
const newAddress = [ipv4Form];
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.selectedInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.selectedInterfaceId}`,
{ IPv4StaticAddresses: originalAddresses.concat(newAddress) },
)
.then(dispatch('getEthernetData'))
@@ -242,7 +242,7 @@ const NetworkStore = {
async editIpv4Address({ dispatch, state }, ipv4TableData) {
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.selectedInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.selectedInterfaceId}`,
{ IPv4StaticAddresses: ipv4TableData },
)
.then(dispatch('getEthernetData'))
@@ -263,7 +263,7 @@ const NetworkStore = {
async saveSettings({ state, dispatch }, interfaceSettingsForm) {
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.selectedInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.selectedInterfaceId}`,
interfaceSettingsForm,
)
.then(dispatch('getEthernetData'))
@@ -288,7 +288,7 @@ const NetworkStore = {
const newDnsArray = originalAddresses.concat(newAddress);
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.selectedInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.selectedInterfaceId}`,
{ StaticNameServers: newDnsArray },
)
.then(dispatch('getEthernetData'))
@@ -309,7 +309,7 @@ const NetworkStore = {
async editDnsAddress({ dispatch, state }, dnsTableData) {
return api
.patch(
- `/redfish/v1/Managers/bmc/EthernetInterfaces/${state.selectedInterfaceId}`,
+ `${await this.dispatch('global/getBmcPath')}/EthernetInterfaces/${state.selectedInterfaceId}`,
{ StaticNameServers: dnsTableData },
)
.then(dispatch('getEthernetData'))
diff --git a/src/store/modules/Settings/PowerPolicyStore.js b/src/store/modules/Settings/PowerPolicyStore.js
index 3adaec8d..fc65381e 100644
--- a/src/store/modules/Settings/PowerPolicyStore.js
+++ b/src/store/modules/Settings/PowerPolicyStore.js
@@ -44,7 +44,7 @@ const PowerPolicyStore = {
},
async getPowerRestoreCurrentPolicy({ commit }) {
return await api
- .get('/redfish/v1/Systems/system')
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then(({ data: { PowerRestorePolicy } }) => {
commit('setPowerRestoreCurrentPolicy', PowerRestorePolicy);
})
@@ -54,7 +54,7 @@ const PowerPolicyStore = {
const data = { PowerRestorePolicy: powerPolicy };
return await api
- .patch('/redfish/v1/Systems/system', data)
+ .patch(`${await this.dispatch('global/getSystemPath')}`, data)
.then(() => {
dispatch('getPowerRestoreCurrentPolicy');
return i18n.t('pagePowerRestorePolicy.toast.successSaveSettings');