From 6a8bbcad9d06be158eb0ec7624eae23b07f5784c Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Jan 2022 10:38:04 -0500 Subject: [PATCH 1/3] feat: Add type param support to creation form of host catalog --- .../app/components/form/host-catalog/index.hbs | 14 ++++++++++++++ .../components/form/host-catalog/static/index.hbs | 1 + .../app/routes/scopes/scope/host-catalogs/new.js | 15 +++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 ui/admin/app/components/form/host-catalog/static/index.hbs diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 39571b820..2df4c07d9 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -45,6 +45,20 @@ {{/if}} + +

Place Radio Button Group Here

+ + {{#if @model.isNew}} + {{#if @model.type}} + {{component + (concat 'form/host-catalog/' @model.type) + model=@model + submit=@submit + cancel=@cancel + }} + {{/if}} + {{/if}} + {{#if (can 'save model' @model)}} Date: Wed, 26 Jan 2022 10:49:28 -0500 Subject: [PATCH 2/3] feat: Trigger update to host catalog type --- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 10 ++++++++++ .../app/templates/scopes/scope/host-catalogs/new.hbs | 1 + 2 files changed, 11 insertions(+) diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js index 5105e168a..b8f6a396d 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -1,4 +1,5 @@ import Route from '@ember/routing/route'; +import { action } from '@ember/object'; export default class ScopesScopeHostCatalogsNewRoute extends Route { // =attributes @@ -25,4 +26,13 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { scopeModel, }); } + + /** + * Update type of host catalog + * @param {string} type + */ + @action + async changeType(type) { + await this.router.replaceWith({ type }); + } } diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs index fb936598e..983c1e86f 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs @@ -18,6 +18,7 @@ @model={{@model}} @submit={{route-action 'save' @model}} @cancel={{route-action 'cancel' @model}} + @changeType={{route-action 'changeType' @model.type}} /> From 07b2c646b1efb504990b9975c485bbaef93201cf Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Jan 2022 10:56:38 -0500 Subject: [PATCH 3/3] feat: Question on default host catalog type value --- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js index b8f6a396d..c95aea7b4 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -18,8 +18,7 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { */ model(params) { const scopeModel = this.modelFor('scopes.scope'); - // TODO Use model provider type method - // to set params.type to 'static' if type is not provided + // FIXME Should default static type be specified when type is undefined? params.type = 'static'; return this.store.createRecord('host-catalog', { type: params.type,