From 824427b69068d9c89be829b47db060f34123a3e0 Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Mon, 1 Dec 2025 09:39:58 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20migrate=20away=20from?= =?UTF-8?q?=20component=20helper=20for=20target=20form=20(#3080)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 🤖 migrate away from component helper for target form * Add missing copyright headers --- ui/admin/app/components/form/target/index.hbs | 15 +++++------ ui/admin/app/components/form/target/index.js | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 ui/admin/app/components/form/target/index.js diff --git a/ui/admin/app/components/form/target/index.hbs b/ui/admin/app/components/form/target/index.hbs index 167fdf660..b325cdd8f 100644 --- a/ui/admin/app/components/form/target/index.hbs +++ b/ui/admin/app/components/form/target/index.hbs @@ -4,12 +4,11 @@ }} {{#if @model.type}} - {{component - (concat 'form/target/' @model.type) - model=@model - submit=@submit - cancel=@cancel - globalScope=@globalScope - changeType=@changeType - }} + {{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/target/index.js b/ui/admin/app/components/form/target/index.js new file mode 100644 index 000000000..fdb7992b9 --- /dev/null +++ b/ui/admin/app/components/form/target/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 rdpTargetForm from './rdp'; +import sshTargetForm from './ssh'; +import tcpTargetForm from './tcp'; + +const modelTypeToComponent = { + rdp: rdpTargetForm, + ssh: sshTargetForm, + tcp: tcpTargetForm, +}; + +export default class FormTargetIndex extends Component { + get targetFormComponent() { + const component = modelTypeToComponent[this.args.model.type]; + assert( + `Mapped component must exist for target type: ${this.args.model.type}`, + component, + ); + return component; + } +}