File tree Expand file tree Collapse file tree 2 files changed +29
-8
lines changed
ui/admin/app/components/form/target Expand file tree Collapse file tree 2 files changed +29
-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+ import Component from '@glimmer/component' ;
2+ import { assert } from '@ember/debug' ;
3+ import rdpTargetForm from './rdp' ;
4+ import sshTargetForm from './ssh' ;
5+ import tcpTargetForm from './tcp' ;
6+
7+ const modelTypeToComponent = {
8+ rdp : rdpTargetForm ,
9+ ssh : sshTargetForm ,
10+ tcp : tcpTargetForm ,
11+ } ;
12+
13+ export default class FormTargetIndex extends Component {
14+ get targetFormComponent ( ) {
15+ const component = modelTypeToComponent [ this . args . model . type ] ;
16+ assert (
17+ `Mapped component must exist for target type: ${ this . args . model . type } ` ,
18+ component ,
19+ ) ;
20+ return component ;
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments