Skip to content

Commit 40ace73

Browse files
committed
chore: 🤖 migrate away from component helper for host set form
1 parent 2bf0901 commit 40ace73

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

‎ui/admin/app/components/form/host-set/index.hbs‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
SPDX-License-Identifier: BUSL-1.1
44
}}
55

6-
{{component
7-
(concat 'form/host-set/' @model.compositeType)
8-
model=@model
9-
edit=@edit
10-
submit=@submit
11-
cancel=@cancel
12-
}}
6+
<this.hostSetForm
7+
@model={{@model}}
8+
@edit={{@edit}}
9+
@submit={{@submit}}
10+
@cancel={{@cancel}}
11+
/>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Component from '@glimmer/component';
2+
import { assert } from '@ember/debug';
3+
import awsFormComponent from './aws';
4+
import azureFormComponent from './azure';
5+
import gcpFormComponent from './gcp';
6+
import staticFormComponent from './static';
7+
8+
const modelCompositeTypeToComponent = {
9+
aws: awsFormComponent,
10+
azure: azureFormComponent,
11+
gcp: gcpFormComponent,
12+
static: staticFormComponent,
13+
};
14+
15+
export default class FormHostSetIndex extends Component {
16+
/**
17+
* returns the associated host set form component for the model's composite type
18+
*/
19+
get hostSetForm() {
20+
const component =
21+
modelCompositeTypeToComponent[this.args.model.compositeType];
22+
assert(
23+
`Mapped component must exist for host set composite type: ${this.args.model.compositeType}`,
24+
component,
25+
);
26+
return component;
27+
}
28+
}

0 commit comments

Comments
 (0)