diff --git a/ui/admin/app/components/form/credential-store/index.hbs b/ui/admin/app/components/form/credential-store/index.hbs index e1c09f760e..28db884af3 100644 --- a/ui/admin/app/components/form/credential-store/index.hbs +++ b/ui/admin/app/components/form/credential-store/index.hbs @@ -4,11 +4,10 @@ }} {{#if @model.type}} - {{component - (concat 'form/credential-store/' @model.type) - model=@model - submit=@submit - cancel=@cancel - changeType=@changeType - }} + {{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/credential-store/index.js b/ui/admin/app/components/form/credential-store/index.js new file mode 100644 index 0000000000..31199e0c73 --- /dev/null +++ b/ui/admin/app/components/form/credential-store/index.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Component from '@glimmer/component'; +import { assert } from '@ember/debug'; +import { + TYPE_CREDENTIAL_STORE_STATIC, + TYPE_CREDENTIAL_STORE_VAULT, +} from 'api/models/credential-store'; +import staticCredentialStoreComponent from './static'; +import vaultCredentialStoreComponent from './vault'; + +const modelTypeToComponent = { + [TYPE_CREDENTIAL_STORE_STATIC]: staticCredentialStoreComponent, + [TYPE_CREDENTIAL_STORE_VAULT]: vaultCredentialStoreComponent, +}; + +export default class FormCredentialStoreIndex extends Component { + get credentialStoreFormComponent() { + const component = modelTypeToComponent[this.args.model.type]; + assert( + `Mapped component must exist for credential store type: ${this.args.model.type}`, + component, + ); + return component; + } +}