chore: 🤖 migrate away from component helper for form/account (#2880)
This commit is contained in:
1 parent
0b6049c8b0
commit
7f4586ed9e
2 files changed
+32
-6
No files matched your search
@@ -4,10 +4,9 @@
|
||||
}}
|
||||
|
||||
{{#if @model.type}}
|
||||
{{component
|
||||
(concat 'form/account/' @model.type)
|
||||
model=@model
|
||||
submit=@submit
|
||||
cancel=@cancel
|
||||
}}
|
||||
<this.accountFormComponent
|
||||
@model={{@model}}
|
||||
@submit={{@submit}}
|
||||
@cancel={{@cancel}}
|
||||
/>
|
||||
{{/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 oidc from './oidc';
|
||||
import ldap from './ldap';
|
||||
import password from './password';
|
||||
|
||||
const modelTypeToComponent = {
|
||||
ldap,
|
||||
password,
|
||||
oidc,
|
||||
};
|
||||
|
||||
export default class FormAccountIndex extends Component {
|
||||
get accountFormComponent() {
|
||||
const component = modelTypeToComponent[this.args.model.type];
|
||||
assert(
|
||||
`Mapped component must exist for account type: ${this.args.model.type}`,
|
||||
component,
|
||||
);
|
||||
return component;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user