Skip to content

Commit 19df23e

Browse files
committed
chore: 🤖 migrate away from component helper for managed group
1 parent 6fcc743 commit 19df23e

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

‎ui/admin/app/components/form/managed-group/index.hbs‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
}}
55

66
{{#if @model.type}}
7-
{{component
8-
(concat 'form/managed-group/' @model.type)
9-
model=@model
10-
edit=@edit
11-
submit=@submit
12-
cancel=@cancel
13-
removeItemByIndex=@removeItemByIndex
14-
addStringItem=@addStringItem
15-
}}
7+
<this.managedGroupForm
8+
@model={{@model}}
9+
@edit={{@edit}}
10+
@submit={{@submit}}
11+
@cancel={{@cancel}}
12+
@removeItemByIndex={{@removeItemByIndex}}
13+
@addStringItem={{@addStringItem}}
14+
/>
1615
{{/if}}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Component from '@glimmer/component';
2+
import { assert } from '@ember/debug';
3+
import ldapFormComponent from './ldap';
4+
import oidcFormComponent from './oidc';
5+
6+
const modelTypeToComponent = {
7+
ldap: ldapFormComponent,
8+
oidc: oidcFormComponent,
9+
};
10+
11+
export default class FormManagedGroupIndex extends Component {
12+
/**
13+
* returns the associated managed group form component for the model's type
14+
*/
15+
get managedGroupForm() {
16+
const component = modelTypeToComponent[this.args.model.type];
17+
assert(
18+
`Mapped component must exist for account type: ${this.args.model.type}`,
19+
component,
20+
);
21+
return component;
22+
}
23+
}

0 commit comments

Comments
 (0)