chore: 🤖 migrate component helper usage for storage bucket form (#3081)
This commit is contained in:
1 parent
824427b690
commit
1d08ddb513
2 files changed
+33
-14
No files matched your search
@@ -3,17 +3,16 @@
|
||||
SPDX-License-Identifier: BUSL-1.1
|
||||
}}
|
||||
{{#if @model.type}}
|
||||
{{component
|
||||
(concat 'form/storage-bucket/' @model.compositeType)
|
||||
model=@model
|
||||
submit=@submit
|
||||
cancel=@cancel
|
||||
updateScope=this.updateScope
|
||||
scopes=@scopes
|
||||
pluginTypes=this.pluginTypes
|
||||
changePluginType=@changePluginType
|
||||
changeCredentialType=@changeCredentialType
|
||||
rollbackSecretAttrs=this.rollbackSecretAttrs
|
||||
toggleDisableCredentialRotation=this.toggleDisableCredentialRotation
|
||||
}}
|
||||
<this.storageBucketFormComponent
|
||||
@model={{@model}}
|
||||
@submit={{@submit}}
|
||||
@cancel={{@cancel}}
|
||||
@updateScope={{this.updateScope}}
|
||||
@scopes={{@scopes}}
|
||||
@pluginTypes={{this.pluginTypes}}
|
||||
@changePluginType={{@changePluginType}}
|
||||
@changeCredentialType={{@changeCredentialType}}
|
||||
@rollbackSecretAttrs={{this.rollbackSecretAttrs}}
|
||||
@toggleDisableCredentialRotation={{this.toggleDisableCredentialRotation}}
|
||||
/>
|
||||
{{/if}}
|
||||
@@ -7,11 +7,18 @@ import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
import { service } from '@ember/service';
|
||||
import { set } from '@ember/object';
|
||||
|
||||
import { assert } from '@ember/debug';
|
||||
import {
|
||||
TYPE_CREDENTIAL_DYNAMIC,
|
||||
TYPES_STORAGE_BUCKET_PLUGIN,
|
||||
} from 'api/models/storage-bucket';
|
||||
import awsFormComponent from './aws';
|
||||
import minioFormComponent from './minio';
|
||||
|
||||
const modelCompositeTypeToComponent = {
|
||||
aws: awsFormComponent,
|
||||
minio: minioFormComponent,
|
||||
};
|
||||
|
||||
export default class FormStorageBucketComponent extends Component {
|
||||
// =attributes
|
||||
@@ -24,6 +31,19 @@ export default class FormStorageBucketComponent extends Component {
|
||||
return TYPES_STORAGE_BUCKET_PLUGIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the associated storage bucket form component for the model's composite type
|
||||
*/
|
||||
get storageBucketFormComponent() {
|
||||
const component =
|
||||
modelCompositeTypeToComponent[this.args.model.compositeType];
|
||||
assert(
|
||||
`Mapped component must exist for storage bucket composite type: ${this.args.model.compositeType}`,
|
||||
component,
|
||||
);
|
||||
return component;
|
||||
}
|
||||
|
||||
// =actions
|
||||
@action
|
||||
updateScope(event) {
|
||||
|
||||
Reference in new issue
Block a user