From 8841b7d463a5272a87faaa14cb103f778a772770 Mon Sep 17 00:00:00 2001
From: Sean Zhang <xiazhang@nvidia.com>
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 <xiazhang@nvidia.com>
---
 .../Certificates/ModalGenerateCsr.vue              | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

(limited to 'src/views/SecurityAndAccess/Certificates/ModalGenerateCsr.vue')

diff --git a/src/views/SecurityAndAccess/Certificates/ModalGenerateCsr.vue b/src/views/SecurityAndAccess/Certificates/ModalGenerateCsr.vue
index d9d65912..9f60d2ba 100644
--- a/src/views/SecurityAndAccess/Certificates/ModalGenerateCsr.vue
+++ b/src/views/SecurityAndAccess/Certificates/ModalGenerateCsr.vue
@@ -366,7 +366,6 @@ import IconCheckmark from '@carbon/icons-vue/es/checkmark/20';
 import { required, requiredIf } from 'vuelidate/lib/validators';
 
 import { COUNTRY_LIST } from './CsrCountryCodes';
-import { CERTIFICATE_TYPES } from '@/store/modules/SecurityAndAccess/CertificatesStore';
 import BVToastMixin from '@/components/Mixins/BVToastMixin';
 import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
 
@@ -391,14 +390,6 @@ export default {
         keyCurveId: null,
         keyBitLength: null,
       },
-      certificateOptions: CERTIFICATE_TYPES.reduce((arr, cert) => {
-        if (cert.type === 'TrustStore Certificate') return arr;
-        arr.push({
-          text: cert.label,
-          value: cert.type,
-        });
-        return arr;
-      }, []),
       countryOptions: COUNTRY_LIST.map((country) => ({
         text: country.label,
         value: country.code,
@@ -410,6 +401,21 @@ export default {
       csrStringCopied: false,
     };
   },
+  computed: {
+    certificateTypes() {
+      return this.$store.getters['certificates/certificateTypes'];
+    },
+    certificateOptions() {
+      return this.certificateTypes.reduce((arr, cert) => {
+        if (cert.type === 'TrustStore Certificate') return arr;
+        arr.push({
+          text: cert.label,
+          value: cert.type,
+        });
+        return arr;
+      }, []);
+    },
+  },
   validations: {
     form: {
       certificateType: { required },
-- 
cgit v1.2.3

