From f9a9f677caa96cd885c691d84a4ce22ca082673d Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Thu, 20 Nov 2025 10:19:46 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20use=20statically=20defi?= =?UTF-8?q?ned=20credential=20store=20components=20(#3071)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 🤖 use statically defined cred store components * Add missing copyright headers --- .../form/credential-store/index.hbs | 13 ++++----- .../components/form/credential-store/index.js | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 ui/admin/app/components/form/credential-store/index.js diff --git a/ui/admin/app/components/form/credential-store/index.hbs b/ui/admin/app/components/form/credential-store/index.hbs index e1c09f760..28db884af 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 000000000..31199e0c7 --- /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; + } +}