From 36eab2e0f1b1cae213a5d2373ec341a8320b6da1 Mon Sep 17 00:00:00 2001 From: dharini Date: Fri, 28 Jan 2022 08:53:16 -0800 Subject: [PATCH] unknown type --- addons/api/addon/models/host-catalog.js | 14 +++++++++++++- .../app/components/form/host-catalog/index.hbs | 4 ++-- .../app/routes/scopes/scope/host-catalogs/new.js | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/addons/api/addon/models/host-catalog.js b/addons/api/addon/models/host-catalog.js index ec34b50e3..33fce7bc7 100644 --- a/addons/api/addon/models/host-catalog.js +++ b/addons/api/addon/models/host-catalog.js @@ -26,7 +26,15 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { * @type {boolean} */ get isUnknown() { - return this.isPlugin && !types.includes(this.plugin.name); + console.log(this.isPlugin, 'IS IT PLUGIN', this.plugin, types); + // if(this.plugin === undefined) { + // console.log('in USEFNNFNF') + // return false; + // } else { + // console.log('in ELSE EE') + + return this.isPlugin && !types.includes(this.plugin.name); + // } } /** @@ -51,6 +59,8 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { * @type {string} */ get compositeType() { + console.log(this, this.isPlugin, 'WHAT IS PLUGNI'); + // if(this.plugin === undefined) return 'static'; if (this.isUnknown) return 'unknown'; if (this.isPlugin) return this.plugin.name; return 'static'; @@ -65,7 +75,9 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { this.type = 'static'; } else { this.type = 'plugin'; + this.plugin = { name: type }; + console.log('COMPOSITI' , this.plugin, type) } } } diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 1b1dbf68d..1740712ef 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -2,8 +2,8 @@ COMES JERE {{{log 'BLLL' @model.compositeType}}} {{{log 'NNFRM' @model.isNew}}} -{{#if @model.isNew}} -{{!-- {{#if @model.compositeType}} --}} +{{!-- {{#if @model.isNew}} --}} +{{#if @model.compositeType}} {{component (concat 'form/host-catalog/' @model.compositeType) model=@model 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 cf9f74624..c93bdbce6 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -25,8 +25,10 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { model(params) { const scopeModel = this.modelFor('scopes.scope'); if (!params.type) params.type = 'plugin'; + params.name = 'Avon'; return this.store.createRecord('host-catalog', { type: params.type, + name: params.name, scopeModel, }); }