From 1d08ddb513971bc56aef2cae1550533e9ef20db3 Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:37:05 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20migrate=20component=20h?= =?UTF-8?q?elper=20usage=20for=20storage=20bucket=20form=20(#3081)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/form/storage-bucket/index.hbs | 25 +++++++++---------- .../components/form/storage-bucket/index.js | 22 +++++++++++++++- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/ui/admin/app/components/form/storage-bucket/index.hbs b/ui/admin/app/components/form/storage-bucket/index.hbs index c0c814d3a..aef78d9b6 100644 --- a/ui/admin/app/components/form/storage-bucket/index.hbs +++ b/ui/admin/app/components/form/storage-bucket/index.hbs @@ -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 - }} + {{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/storage-bucket/index.js b/ui/admin/app/components/form/storage-bucket/index.js index ba174e207..288d09278 100644 --- a/ui/admin/app/components/form/storage-bucket/index.js +++ b/ui/admin/app/components/form/storage-bucket/index.js @@ -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) {