File tree Expand file tree Collapse file tree 2 files changed +32
-14
lines changed
ui/admin/app/components/form/storage-bucket Expand file tree Collapse file tree 2 files changed +32
-14
lines changed Original file line number Diff line number Diff line change 33 SPDX-License-Identifier: BUSL-1.1
44}}
55{{ #if @model.type }}
6- {{ component
7- (concat ' form/storage-bucket/' @model.compositeType )
8- model = @model
9- submit = @submit
10- cancel = @cancel
11- updateScope =this.updateScope
12- scopes = @scopes
13- pluginTypes =this.pluginTypes
14- changePluginType = @changePluginType
15- changeCredentialType = @changeCredentialType
16- rollbackSecretAttrs =this.rollbackSecretAttrs
17- toggleDisableCredentialRotation =this.toggleDisableCredentialRotation
18- }}
6+ <this .storageBucketFormComponent
7+ @model ={{ @model }}
8+ @submit ={{ @submit }}
9+ @cancel ={{ @cancel }}
10+ @updateScope ={{ this.updateScope }}
11+ @scopes ={{ @scopes }}
12+ @pluginTypes ={{ this.pluginTypes }}
13+ @changePluginType ={{ @changePluginType }}
14+ @changeCredentialType ={{ @changeCredentialType }}
15+ @rollbackSecretAttrs ={{ this.rollbackSecretAttrs }}
16+ @toggleDisableCredentialRotation ={{ this.toggleDisableCredentialRotation }}
17+ />
1918{{ /if }}
Original file line number Diff line number Diff line change @@ -7,11 +7,18 @@ import Component from '@glimmer/component';
77import { action } from '@ember/object' ;
88import { service } from '@ember/service' ;
99import { set } from '@ember/object' ;
10-
10+ import { assert } from '@ember/debug' ;
1111import {
1212 TYPE_CREDENTIAL_DYNAMIC ,
1313 TYPES_STORAGE_BUCKET_PLUGIN ,
1414} from 'api/models/storage-bucket' ;
15+ import awsFormComponent from './aws' ;
16+ import minioFormComponent from './minio' ;
17+
18+ const modelCompositeTypeToComponent = {
19+ aws : awsFormComponent ,
20+ minio : minioFormComponent ,
21+ } ;
1522
1623export default class FormStorageBucketComponent extends Component {
1724 // =attributes
@@ -24,6 +31,18 @@ export default class FormStorageBucketComponent extends Component {
2431 return TYPES_STORAGE_BUCKET_PLUGIN ;
2532 }
2633
34+ /**
35+ * returns the associated storage bucket form component for the model's composite type
36+ */
37+ get storageBucketFormComponent ( ) {
38+ const component = modelCompositeTypeToComponent [ this . args . model . type ] ;
39+ assert (
40+ `Mapped component must exist for storage bucket composite type: ${ this . args . model . compositeType } ` ,
41+ component ,
42+ ) ;
43+ return component ;
44+ }
45+
2746 // =actions
2847 @action
2948 updateScope ( event ) {
You can’t perform that action at this time.
0 commit comments