From 7f4586ed9e6c97e23ed64e0d066b504935294418 Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Wed, 18 Jun 2025 10:09:28 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20migrate=20away=20from?= =?UTF-8?q?=20component=20helper=20for=20form/account=20(#2880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/form/account/index.hbs | 11 ++++---- ui/admin/app/components/form/account/index.js | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 ui/admin/app/components/form/account/index.js diff --git a/ui/admin/app/components/form/account/index.hbs b/ui/admin/app/components/form/account/index.hbs index f6a7d2dae..08d475201 100644 --- a/ui/admin/app/components/form/account/index.hbs +++ b/ui/admin/app/components/form/account/index.hbs @@ -4,10 +4,9 @@ }} {{#if @model.type}} - {{component - (concat 'form/account/' @model.type) - model=@model - submit=@submit - cancel=@cancel - }} + {{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/account/index.js b/ui/admin/app/components/form/account/index.js new file mode 100644 index 000000000..6eca02f6f --- /dev/null +++ b/ui/admin/app/components/form/account/index.js @@ -0,0 +1,27 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Component from '@glimmer/component'; +import { assert } from '@ember/debug'; +import oidc from './oidc'; +import ldap from './ldap'; +import password from './password'; + +const modelTypeToComponent = { + ldap, + password, + oidc, +}; + +export default class FormAccountIndex extends Component { + get accountFormComponent() { + const component = modelTypeToComponent[this.args.model.type]; + assert( + `Mapped component must exist for account type: ${this.args.model.type}`, + component, + ); + return component; + } +}