From bf134072e5844a280e9d8235a34b4eaf9ba666c4 Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Wed, 8 Oct 2025 09:53:19 -0700 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20migrate=20away=20fro?= =?UTF-8?q?m=20component=20helper=20for=20auth-method=20(#3011)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 💡 migrate away from component helper for auth-method component * Add missing copyright headers --- .../app/components/form/auth-method/index.hbs | 20 +++++++------- .../app/components/form/auth-method/index.js | 27 +++++++++++++++++++ 2 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 ui/admin/app/components/form/auth-method/index.js diff --git a/ui/admin/app/components/form/auth-method/index.hbs b/ui/admin/app/components/form/auth-method/index.hbs index 229e354ce..afe55a14a 100644 --- a/ui/admin/app/components/form/auth-method/index.hbs +++ b/ui/admin/app/components/form/auth-method/index.hbs @@ -2,16 +2,14 @@ Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: BUSL-1.1 }} - {{#if @model.type}} - {{component - (concat 'form/auth-method/' @model.type) - model=@model - edit=@edit - submit=@submit - cancel=@cancel - removeItemByIndex=@removeItemByIndex - addStringItem=@addStringItem - addAccountMapItem=@addAccountMapItem - }} + {{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/auth-method/index.js b/ui/admin/app/components/form/auth-method/index.js new file mode 100644 index 000000000..f62f5c69c --- /dev/null +++ b/ui/admin/app/components/form/auth-method/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 FormAuthMethodIndex extends Component { + get authMethodFormComponent() { + const component = modelTypeToComponent[this.args.model.type]; + assert( + `Mapped component must exist for auth method: ${this.args.model.type}`, + component, + ); + return component; + } +}