diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js index 38b1c86c6..3c728dd1a 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js @@ -15,10 +15,6 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends const { id: host_catalog_id, compositeType } = this.modelFor( 'scopes.scope.host-catalogs.host-catalog' ); - if (this.currentModel?.isNew) { - this.currentModel.rollbackAttributes(); - } - console.log('typedwed', compositeType); return this.store.createRecord('host-set', { compositeType, host_catalog_id, @@ -55,17 +51,10 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends model: model, }); } - /** - * Update type of host set - * @param {string} type - */ - @action - async changeType(type) { - await this.router.replaceWith({ queryParams: { type } }); - } + /** * Adds a string item to array `property` on the passed `filter`. - + * @param {hostSetModel} hostSet * @param {string} property * @param {string} value 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 1e4932280..c712630aa 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -23,7 +23,7 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { * creating another, but reuse name/description if available. * @return {HostCatalogModel} */ - model() { + model({ type: compositeType = 'static' }) { const scopeModel = this.modelFor('scopes.scope'); let name, description; if (this.currentModel?.isNew) { @@ -32,25 +32,19 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { } return this.store.createRecord('host-catalog', { scopeModel, + compositeType, name, description, }); } - afterModel(model, transition) { - this.changeType(transition.to.queryParams?.type); - } - /** * Update type of host catalog * @param {string} type */ @action - async changeType(type) { - const model = this.modelFor('scopes.scope.host-catalogs.new'); - if (!type) type = 'static'; // Unknown host catalog type defaults to 'static' - if (model.isUnknown) type = 'aws'; //Is this the default case for plugin type? - model.compositeType = type; - await this.router.replaceWith({ queryParams: { type } }); + changeType(type) { + if (type === 'plugin') type = 'aws'; + this.router.replaceWith({ queryParams: { type } }); } } diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs index 4047f364c..2aec7f029 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs @@ -4,7 +4,6 @@ @model={{@model}} @submit={{route-action 'save' @model}} @cancel={{route-action 'cancel' @model}} - @changeType={{route-action 'changeType' @model.type}} @removeItemByIndex={{route-action 'removeItemByIndex' @model}} @addStringItem={{route-action 'addStringItem' @model}} /> \ No newline at end of file