refactor: 💡 migrate away from component helper for auth-method (#3011)
* refactor: 💡 migrate away from component helper for auth-method
component
* Add missing copyright headers
This commit is contained in:
1 parent
0bd152e0b5
commit
bf134072e5
2 files changed
+36
-11
No files matched your search
@@ -2,16 +2,14 @@
|
||||
Copyright (c) HashiCorp, Inc.
|
||||
SPDX-License-Identifier: BUSL-1.1
|
||||
}}
|
||||
|
||||
{{#if @model.type}}
|
||||
{{component
|
||||
(concat 'form/auth-method/' @model.type)
|
||||
model=@model
|
||||
edit=@edit
|
||||
submit=@submit
|
||||
cancel=@cancel
|
||||
removeItemByIndex=@removeItemByIndex
|
||||
addStringItem=@addStringItem
|
||||
addAccountMapItem=@addAccountMapItem
|
||||
}}
|
||||
<this.authMethodFormComponent
|
||||
@model={{@model}}
|
||||
@edit={{@edit}}
|
||||
@submit={{@submit}}
|
||||
@cancel={{@cancel}}
|
||||
@removeItemByIndex={{@removeItemByIndex}}
|
||||
@addStringItem={{@addStringItem}}
|
||||
@addAccountMapItem={{@addAccountMapItem}}
|
||||
/>
|
||||
{{/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 FormAuthMethodIndex extends Component {
|
||||
get authMethodFormComponent() {
|
||||
const component = modelTypeToComponent[this.args.model.type];
|
||||
assert(
|
||||
`Mapped component must exist for auth method: ${this.args.model.type}`,
|
||||
component,
|
||||
);
|
||||
return component;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user