File tree Expand file tree Collapse file tree 2 files changed +35
-7
lines changed
ui/admin/app/components/form/credential-store Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 44}}
55
66{{ #if @model.type }}
7- {{ component
8- (concat ' form/credential-store/' @model.type )
9- model = @model
10- submit = @submit
11- cancel = @cancel
12- changeType = @changeType
13- }}
7+ <this .credentialStoreFormComponent
8+ @model ={{ @model }}
9+ @submit ={{ @submit }}
10+ @cancel ={{ @cancel }}
11+ @changeType ={{ @changeType }}
12+ />
1413{{ /if }}
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) HashiCorp, Inc.
3+ * SPDX-License-Identifier: BUSL-1.1
4+ */
5+
6+ import Component from '@glimmer/component' ;
7+ import { assert } from '@ember/debug' ;
8+ import {
9+ TYPE_CREDENTIAL_STORE_STATIC ,
10+ TYPE_CREDENTIAL_STORE_VAULT ,
11+ } from 'api/models/credential-store' ;
12+ import staticCredentialStoreComponent from './static' ;
13+ import vaultCredentialStoreComponent from './vault' ;
14+
15+ const modelTypeToComponent = {
16+ [ TYPE_CREDENTIAL_STORE_STATIC ] : staticCredentialStoreComponent ,
17+ [ TYPE_CREDENTIAL_STORE_VAULT ] : vaultCredentialStoreComponent ,
18+ } ;
19+
20+ export default class FormCredentialStoreIndex extends Component {
21+ get credentialStoreFormComponent ( ) {
22+ const component = modelTypeToComponent [ this . args . model . type ] ;
23+ assert (
24+ `Mapped component must exist for credential store type: ${ this . args . model . type } ` ,
25+ component ,
26+ ) ;
27+ return component ;
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments