summaryrefslogtreecommitdiff
path: root/src/store/modules/GlobalStore.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/GlobalStore.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/GlobalStore.js')
-rw-r--r--src/store/modules/GlobalStore.js26
1 files changed, 23 insertions, 3 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: {