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/Settings/NetworkStore.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/store/modules/Settings/NetworkStore.js') 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')) -- cgit v1.2.3