chore: 🤖 migrate away from component helper for target form (#3080)

* chore: 🤖 migrate away from component helper for target form

* Add missing copyright headers
This commit is contained in:
hashicc authored and GitHub committed 2025-12-01 09:39:58 -05:00
1 parent 183bde311c
commit 824427b690
2 files changed
+34 -8

No files matched your search

@@ -4,12 +4,11 @@
}}
{{#if @model.type}}
{{component
(concat 'form/target/' @model.type)
model=@model
submit=@submit
cancel=@cancel
globalScope=@globalScope
changeType=@changeType
}}
<this.targetFormComponent
@model={{@model}}
@submit={{@submit}}
@cancel={{@cancel}}
@globalScope={{@globalScope}}
@changeType={{@changeType}}
/>
{{/if}}
@@ -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;
}
}