diff --git a/shell/cloud-credential/generic.vue b/shell/cloud-credential/generic.vue index 0f1b85a3ee3..546ac1cb91d 100644 --- a/shell/cloud-credential/generic.vue +++ b/shell/cloud-credential/generic.vue @@ -3,10 +3,13 @@ import CreateEditView from '@shell/mixins/create-edit-view'; import KeyValue from '@shell/components/form/KeyValue'; import { Banner } from '@components/Banner'; import { simplify, iffyFields, likelyFields } from '@shell/store/plugins'; +import Loading from '@shell/components/Loading'; export default { - components: { KeyValue, Banner }, - mixins: [CreateEditView], + components: { + KeyValue, Banner, Loading + }, + mixins: [CreateEditView], props: { driverName: { @@ -15,19 +18,19 @@ export default { } }, - data() { + async fetch() { let keyOptions = []; - const normanType = this.$store.getters['plugins/credentialFieldForDriver'](this.driverName); - const normanSchema = this.$store.getters['rancher/schemaFor'](`${ normanType }credentialconfig`); + const { normanSchema } = this; if ( normanSchema?.resourceFields ) { keyOptions = Object.keys(normanSchema.resourceFields); } else { - keyOptions = this.$store.getters['plugins/fieldNamesForDriver'](this.driverName); + keyOptions = await this.$store.getters['plugins/fieldNamesForDriver'](this.driverName); } - // Prepopulate empty values for keys that sound like they're cloud-credential-ey + this.keyOptions = keyOptions; + const keys = []; for ( const k of keyOptions ) { @@ -43,11 +46,16 @@ export default { this.value.setData(k, ''); } } + }, + + data() { + const normanType = this.$store.getters['plugins/credentialFieldForDriver'](this.driverName); + const normanSchema = this.$store.getters['rancher/schemaFor'](`${ normanType }credentialconfig`); return { hasSupport: !!normanSchema, - keyOptions, errors: null, + normanSchema, }; }, @@ -67,7 +75,8 @@ export default { +
-