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; + } +}