File tree Expand file tree Collapse file tree 2 files changed +34
-8
lines changed
ui/admin/app/components/form/target Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Original file line number Diff line number Diff line change 44}}
55
66{{ #if @model.type }}
7- {{ component
8- (concat ' form/target/' @model.type )
9- model = @model
10- submit = @submit
11- cancel = @cancel
12- globalScope = @globalScope
13- changeType = @changeType
14- }}
7+ <this .targetFormComponent
8+ @model ={{ @model }}
9+ @submit ={{ @submit }}
10+ @cancel ={{ @cancel }}
11+ @globalScope ={{ @globalScope }}
12+ @changeType ={{ @changeType }}
13+ />
1514{{ /if }}
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) HashiCorp, Inc.
3+ * SPDX-License-Identifier: BUSL-1.1
4+ */
5+
6+ import Component from '@glimmer/component' ;
7+ import { assert } from '@ember/debug' ;
8+ import rdpTargetForm from './rdp' ;
9+ import sshTargetForm from './ssh' ;
10+ import tcpTargetForm from './tcp' ;
11+
12+ const modelTypeToComponent = {
13+ rdp : rdpTargetForm ,
14+ ssh : sshTargetForm ,
15+ tcp : tcpTargetForm ,
16+ } ;
17+
18+ export default class FormTargetIndex extends Component {
19+ get targetFormComponent ( ) {
20+ const component = modelTypeToComponent [ this . args . model . type ] ;
21+ assert (
22+ `Mapped component must exist for target type: ${ this . args . model . type } ` ,
23+ component ,
24+ ) ;
25+ return component ;
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments