Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions ui/admin/app/components/form/storage-bucket/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
22 changes: 21 additions & 1 deletion ui/admin/app/components/form/storage-bucket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
Loading