From 6a8bbcad9d06be158eb0ec7624eae23b07f5784c Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Jan 2022 10:38:04 -0500 Subject: [PATCH 01/40] 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 02/40] 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 03/40] 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, From feec5d96f3a68bcf6fbeb8ab7f11f2ba81842274 Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 25 Jan 2022 19:12:18 -0800 Subject: [PATCH 04/40] typed host catalog init --- .../form/host-catalog/aws/index.hbs | 38 +++++++++++++++++++ .../form/host-catalog/azure/index.hbs | 38 +++++++++++++++++++ .../form/host-catalog/static/index.hbs | 38 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 ui/admin/app/components/form/host-catalog/aws/index.hbs create mode 100644 ui/admin/app/components/form/host-catalog/azure/index.hbs create mode 100644 ui/admin/app/components/form/host-catalog/static/index.hbs diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs new file mode 100644 index 000000000..2632020d2 --- /dev/null +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -0,0 +1,38 @@ + + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs new file mode 100644 index 000000000..2632020d2 --- /dev/null +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -0,0 +1,38 @@ + + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs new file mode 100644 index 000000000..2632020d2 --- /dev/null +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -0,0 +1,38 @@ + + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file From f13a3ee18cafe39b4ff1d8d446f2bf8b59675649 Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 26 Jan 2022 09:34:23 -0800 Subject: [PATCH 05/40] split host catalog into other types --- .../app/components/form/auth-method/index.hbs | 4 +- .../form/host-catalog/aws/index.hbs | 2 +- .../form/host-catalog/azure/index.hbs | 2 +- .../components/form/host-catalog/index.hbs | 65 +++---------------- .../form/host-catalog/static/index.hbs | 2 +- 5 files changed, 16 insertions(+), 59 deletions(-) diff --git a/ui/admin/app/components/form/auth-method/index.hbs b/ui/admin/app/components/form/auth-method/index.hbs index 77cf37d4d..224c8006f 100644 --- a/ui/admin/app/components/form/auth-method/index.hbs +++ b/ui/admin/app/components/form/auth-method/index.hbs @@ -8,4 +8,6 @@ addStringItem=@addStringItem addAccountClaimMapItem=@addAccountClaimMapItem }} -{{/if}} \ No newline at end of file +{{/if}} + +{{{log @model 'mdelll'}}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 2632020d2..5c8278a97 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -6,7 +6,7 @@ @showEditToggle={{if @model.isNew false true}} --}} as |form| > - +AWASSS! - +AZURE!! +{{#if @model.compositeType}} + {{component + (concat 'form/host-catalog/' @model.compositeType) + model=@model + submit=@submit + cancel=@cancel + changeType=@changeType + }} +{{/if}} - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +{{{log @model 'modede'}}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 2632020d2..ab96e4e79 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -6,7 +6,7 @@ @showEditToggle={{if @model.isNew false true}} --}} as |form| > - +STATIC!! Date: Wed, 26 Jan 2022 14:35:31 -0800 Subject: [PATCH 06/40] static form with radioCards --- .../form/host-catalog/aws/index.hbs | 39 +------------------ .../form/host-catalog/azure/index.hbs | 39 +------------------ .../components/form/host-catalog/index.hbs | 1 - .../form/host-catalog/static/index.hbs | 38 ++++++++++++++++-- 4 files changed, 36 insertions(+), 81 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 5c8278a97..d4a50149c 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -1,38 +1 @@ - -AWASSS! - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +AWS Form \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index 3bfff4bd0..2c7cb5293 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -1,38 +1 @@ - -AZURE!! - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +Azure Form \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 2177276d7..975d98f62 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -4,7 +4,6 @@ model=@model submit=@submit cancel=@cancel - changeType=@changeType }} {{/if}} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index ab96e4e79..b77d02fa5 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -2,11 +2,8 @@ @onSubmit={{@submit}} @cancel={{@cancel}} @disabled={{@model.isSaving}} - {{!-- @error={{@model.errors.base}} - @showEditToggle={{if @model.isNew false true}} --}} as |form| > -STATIC!! - + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + + {{#if (can 'save model' @model)}} Date: Wed, 26 Jan 2022 16:36:11 -0800 Subject: [PATCH 07/40] further updates --- addons/core/translations/resources/en-us.yaml | 1 + .../form/host-catalog/static/index.hbs | 38 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 4ac6c4023..308161cb1 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -78,6 +78,7 @@ host-catalog: title: Host Catalog title_plural: Host Catalogs description: A host catalog is a collection of hosts and host sets. + type: Type messages: welcome: title: Welcome to Host Catalogs diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index b77d02fa5..1c88faefc 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -42,21 +42,25 @@ {{/if}} - - - - - + + <:title>{{t 'resources.host-catalog.type'}} + <:body> + + + + + + {{#if (can 'save model' @model)}} {{/if}} - \ No newline at end of file + + +{{{log @model.compositeType 'compostite type'}}} \ No newline at end of file From c1d71e51663889d2dec2818497db7df181b12abf Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Jan 2022 10:38:04 -0500 Subject: [PATCH 08/40] feat: Add type param support to creation form of host catalog --- .../components/form/host-catalog/index.hbs | 66 ++++++++++++++++++- .../form/host-catalog/static/index.hbs | 2 +- .../routes/scopes/scope/host-catalogs/new.js | 15 ++++- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 975d98f62..fc04f322d 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -7,4 +7,68 @@ }} {{/if}} -{{{log @model 'modede'}}} \ No newline at end of file +<<<<<<< HEAD +{{{log @model 'modede'}}} +======= + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/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)}} + + {{/if}} + +>>>>>>> 6a8bbcad (feat: Add type param support to creation form of host catalog) diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 1c88faefc..42c75e421 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -71,4 +71,4 @@ {{/if}} -{{{log @model.compositeType 'compostite type'}}} \ No newline at end of file +{{{log @model.compositeType 'compostite type'}}} 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 9af8baaef..5105e168a 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -1,16 +1,27 @@ import Route from '@ember/routing/route'; export default class ScopesScopeHostCatalogsNewRoute extends Route { + // =attributes + + queryParams = { + type: { + refreshModel: true, + }, + }; + // =methods /** * Creates a new unsaved host catalog belonging to the current scope. * @return {HostCatalogModel} */ - model() { + 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 + params.type = 'static'; return this.store.createRecord('host-catalog', { - type: 'static', + type: params.type, scopeModel, }); } From cc56fb9636c99667e668f183570e505fcc81bab0 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Jan 2022 10:49:28 -0500 Subject: [PATCH 09/40] 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 46b6c51f5de0cdbf3ceaadcc8ea3be78fd298601 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Jan 2022 10:56:38 -0500 Subject: [PATCH 10/40] 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, From 2de2a79e7c8ec4b259aa12af596afea8c6513672 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 27 Jan 2022 10:07:50 -0500 Subject: [PATCH 11/40] fix: Protect catalog type selectors in edit mode --- .../components/form/host-catalog/index.hbs | 6 +---- .../form/host-catalog/static/index.hbs | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index fc04f322d..28a7711d1 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -7,9 +7,6 @@ }} {{/if}} -<<<<<<< HEAD -{{{log @model 'modede'}}} -======= {{/if}} - ->>>>>>> 6a8bbcad (feat: Add type param support to creation form of host catalog) + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 42c75e421..e39512155 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -42,6 +42,7 @@ {{/if}} +<<<<<<< HEAD <:title>{{t 'resources.host-catalog.type'}} <:body> @@ -61,6 +62,32 @@ +======= + + {{#if @model.isNew}} + + <:title>{{t 'resources.host-catalog.type'}} + <:body> + + + + + + + {{/if}} + +>>>>>>> f3d3bdd7 (fix: Protect catalog type selectors in edit mode) {{#if (can 'save model' @model)}} Date: Thu, 27 Jan 2022 10:11:12 -0500 Subject: [PATCH 12/40] feat: Add missing queryParam to hostcatalog create controller --- .../controllers/scopes/scope/host-catalogs/new.js | 7 +++++++ .../app/routes/scopes/scope/host-catalogs/new.js | 5 +++++ .../scopes/scope/host-catalogs/new-test.js | 14 ++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 ui/admin/app/controllers/scopes/scope/host-catalogs/new.js create mode 100644 ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/new-test.js diff --git a/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js b/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js new file mode 100644 index 000000000..182b9c423 --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeHostCatalogsNewController extends Controller { + // =attributes + + queryParams = ['type']; +} 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 c95aea7b4..43c4a025e 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -1,7 +1,12 @@ import Route from '@ember/routing/route'; import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; export default class ScopesScopeHostCatalogsNewRoute extends Route { + // =services + + @service router; + // =attributes queryParams = { diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/new-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/new-test.js new file mode 100644 index 000000000..c872fa28a --- /dev/null +++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/new-test.js @@ -0,0 +1,14 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/new', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:scopes/scope/host-catalogs/new' + ); + assert.ok(controller); + }); +}); From 67c4440a9091c0ecc29502ad0a233b8471fad387 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 27 Jan 2022 10:43:22 -0500 Subject: [PATCH 13/40] fix: Reflect catalog type in creation url --- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 43c4a025e..e8bf1cef8 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -23,20 +23,24 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { */ model(params) { const scopeModel = this.modelFor('scopes.scope'); - // FIXME Should default static type be specified when type is undefined? - params.type = 'static'; + if (!params.type) params.type = 'static'; return this.store.createRecord('host-catalog', { type: params.type, scopeModel, }); } + afterModel(model) { + this.router.replaceWith({ queryParams: { type: model.compositeType } }); + } + /** * Update type of host catalog * @param {string} type */ @action async changeType(type) { - await this.router.replaceWith({ type }); + console.log(type, 'GET TYPE HERE'); + await this.router.replaceWith({ queryParams: { type } }); } } From 0577cdec76f7bc9b1337140e677a4823731816f0 Mon Sep 17 00:00:00 2001 From: dharini Date: Fri, 28 Jan 2022 00:01:17 -0800 Subject: [PATCH 14/40] more updates --- .../components/form/host-catalog/index.hbs | 70 ++----------------- .../form/host-catalog/plugin/index.hbs | 2 + .../form/host-catalog/static/index.hbs | 30 +------- .../routes/scopes/scope/host-catalogs/new.js | 3 +- 4 files changed, 13 insertions(+), 92 deletions(-) create mode 100644 ui/admin/app/components/form/host-catalog/plugin/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 28a7711d1..1b1dbf68d 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -1,70 +1,14 @@ -{{#if @model.compositeType}} +COMES JERE +{{{log 'BLLL' @model.compositeType}}} +{{{log 'NNFRM' @model.isNew}}} + +{{#if @model.isNew}} +{{!-- {{#if @model.compositeType}} --}} {{component (concat 'form/host-catalog/' @model.compositeType) model=@model submit=@submit cancel=@cancel }} +{{!-- {{/if}} --}} {{/if}} - - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/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)}} - - {{/if}} - \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/plugin/index.hbs b/ui/admin/app/components/form/host-catalog/plugin/index.hbs new file mode 100644 index 000000000..0191a0174 --- /dev/null +++ b/ui/admin/app/components/form/host-catalog/plugin/index.hbs @@ -0,0 +1,2 @@ +THIS IS DYNAINC +{{{log @model 'NAMEEEE'}}} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index e39512155..bad64bf24 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -1,3 +1,4 @@ +STATIC {{{log 'STATTTTTIC' @model}}} {{/if}} -
+
--}} {{/if}} -<<<<<<< HEAD <:title>{{t 'resources.host-catalog.type'}} <:body> @@ -62,32 +62,6 @@ -======= - - {{#if @model.isNew}} - - <:title>{{t 'resources.host-catalog.type'}} - <:body> - - - - - - - {{/if}} - ->>>>>>> f3d3bdd7 (fix: Protect catalog type selectors in edit mode) {{#if (can 'save model' @model)}} Date: Fri, 28 Jan 2022 08:53:16 -0800 Subject: [PATCH 15/40] 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, }); } From 19f48b2ca308a1102eca57d910d66a20a965735b Mon Sep 17 00:00:00 2001 From: dharini Date: Fri, 28 Jan 2022 17:27:59 -0800 Subject: [PATCH 16/40] show provider info when dynamic is selected --- .../form/host-catalog/plugin/index.hbs | 2 -- .../form/host-catalog/static/index.hbs | 3 +-- .../form/host-catalog/static/index.js | 26 +++++++++++++++++++ .../routes/scopes/scope/host-catalogs/new.js | 7 ++--- 4 files changed, 29 insertions(+), 9 deletions(-) delete mode 100644 ui/admin/app/components/form/host-catalog/plugin/index.hbs create mode 100644 ui/admin/app/components/form/host-catalog/static/index.js diff --git a/ui/admin/app/components/form/host-catalog/plugin/index.hbs b/ui/admin/app/components/form/host-catalog/plugin/index.hbs deleted file mode 100644 index 0191a0174..000000000 --- a/ui/admin/app/components/form/host-catalog/plugin/index.hbs +++ /dev/null @@ -1,2 +0,0 @@ -THIS IS DYNAINC -{{{log @model 'NAMEEEE'}}} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index bad64bf24..42c75e421 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -1,4 +1,3 @@ -STATIC {{{log 'STATTTTTIC' @model}}} {{/if}} -
--}} +
Date: Tue, 25 Jan 2022 19:12:18 -0800 Subject: [PATCH 17/40] typed host catalog init --- ui/admin/app/components/form/host-catalog/aws/index.hbs | 2 +- ui/admin/app/components/form/host-catalog/azure/index.hbs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index d4a50149c..b9990fda4 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -1 +1 @@ -AWS Form \ No newline at end of file +AWS Form diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index 2c7cb5293..0dea00f73 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -1 +1 @@ -Azure Form \ No newline at end of file +Azure Form From 043b760cd67397c42cc668b4fb2edf3f5431f485 Mon Sep 17 00:00:00 2001 From: dharini Date: Fri, 28 Jan 2022 00:01:17 -0800 Subject: [PATCH 18/40] more updates --- ui/admin/app/components/form/host-catalog/plugin/index.hbs | 2 ++ ui/admin/app/components/form/host-catalog/static/index.hbs | 3 ++- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 ui/admin/app/components/form/host-catalog/plugin/index.hbs diff --git a/ui/admin/app/components/form/host-catalog/plugin/index.hbs b/ui/admin/app/components/form/host-catalog/plugin/index.hbs new file mode 100644 index 000000000..0191a0174 --- /dev/null +++ b/ui/admin/app/components/form/host-catalog/plugin/index.hbs @@ -0,0 +1,2 @@ +THIS IS DYNAINC +{{{log @model 'NAMEEEE'}}} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 42c75e421..bad64bf24 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -1,3 +1,4 @@ +STATIC {{{log 'STATTTTTIC' @model}}} {{/if}} -
+ --}} Date: Fri, 28 Jan 2022 08:53:16 -0800 Subject: [PATCH 19/40] unknown type --- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 1 + 1 file changed, 1 insertion(+) 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 62ed87dfc..f299f980c 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -25,6 +25,7 @@ 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', { compositeType: params.type, //static or aws or azure scopeModel, From 73566b0583f3475271fd2c31909fb763071f826d Mon Sep 17 00:00:00 2001 From: dharini Date: Fri, 28 Jan 2022 17:27:59 -0800 Subject: [PATCH 20/40] show provider info when dynamic is selected --- ui/admin/app/components/form/host-catalog/plugin/index.hbs | 2 -- ui/admin/app/components/form/host-catalog/static/index.hbs | 3 +-- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 ui/admin/app/components/form/host-catalog/plugin/index.hbs diff --git a/ui/admin/app/components/form/host-catalog/plugin/index.hbs b/ui/admin/app/components/form/host-catalog/plugin/index.hbs deleted file mode 100644 index 0191a0174..000000000 --- a/ui/admin/app/components/form/host-catalog/plugin/index.hbs +++ /dev/null @@ -1,2 +0,0 @@ -THIS IS DYNAINC -{{{log @model 'NAMEEEE'}}} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index bad64bf24..42c75e421 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -1,4 +1,3 @@ -STATIC {{{log 'STATTTTTIC' @model}}} {{/if}} - --}} + Date: Mon, 31 Jan 2022 13:16:03 -0800 Subject: [PATCH 21/40] rebase main --- addons/api/addon/models/host-catalog.js | 14 +------------- ui/admin/app/components/form/auth-method/index.hbs | 4 +--- .../app/components/form/host-catalog/index.hbs | 8 ++------ 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/addons/api/addon/models/host-catalog.js b/addons/api/addon/models/host-catalog.js index 33fce7bc7..ec34b50e3 100644 --- a/addons/api/addon/models/host-catalog.js +++ b/addons/api/addon/models/host-catalog.js @@ -26,15 +26,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { * @type {boolean} */ get isUnknown() { - 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); - // } + return this.isPlugin && !types.includes(this.plugin.name); } /** @@ -59,8 +51,6 @@ 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'; @@ -75,9 +65,7 @@ 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/auth-method/index.hbs b/ui/admin/app/components/form/auth-method/index.hbs index 224c8006f..77cf37d4d 100644 --- a/ui/admin/app/components/form/auth-method/index.hbs +++ b/ui/admin/app/components/form/auth-method/index.hbs @@ -8,6 +8,4 @@ addStringItem=@addStringItem addAccountClaimMapItem=@addAccountClaimMapItem }} -{{/if}} - -{{{log @model 'mdelll'}}} \ No newline at end of file +{{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 1740712ef..35a4a94bd 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -1,8 +1,4 @@ -COMES JERE -{{{log 'BLLL' @model.compositeType}}} -{{{log 'NNFRM' @model.isNew}}} - -{{!-- {{#if @model.isNew}} --}} +{{#if @model.isNew}} {{#if @model.compositeType}} {{component (concat 'form/host-catalog/' @model.compositeType) @@ -10,5 +6,5 @@ COMES JERE submit=@submit cancel=@cancel }} -{{!-- {{/if}} --}} +{{/if}} {{/if}} From 55acdc76b6abf595209f55781014dd7fcd075873 Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 1 Feb 2022 11:12:33 -0800 Subject: [PATCH 22/40] move up component logic --- addons/core/translations/resources/en-us.yaml | 8 ++ .../form/host-catalog/aws/index.hbs | 130 +++++++++++++++++- .../form/host-catalog/azure/index.hbs | 130 +++++++++++++++++- .../components/form/host-catalog/index.hbs | 32 +++-- .../app/components/form/host-catalog/index.js | 29 ++++ .../form/host-catalog/static/index.hbs | 40 +++++- .../form/host-catalog/static/index.js | 26 ---- .../scopes/scope/host-catalogs/new.js | 16 +++ .../routes/scopes/scope/host-catalogs/new.js | 3 +- 9 files changed, 370 insertions(+), 44 deletions(-) create mode 100644 ui/admin/app/components/form/host-catalog/index.js delete mode 100644 ui/admin/app/components/form/host-catalog/static/index.js diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 308161cb1..d7a3a1db3 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -89,6 +89,14 @@ host-catalog: unknown: Unknown aws: AWS azure: Azure + dynamic: Dynamic + form: + provider-details: Provider Details + types: + static: + help: Provide a list of hosts and host sets with static addresses + dynamic: + help: Automate discovery of target hosts and services on Azure or AWS host-set: title: Host Set title_plural: Host Sets diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index b9990fda4..208468752 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -1 +1,129 @@ -AWS Form + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + + + {{#if @showDynamicPlugins}} + + <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:body> + + + + + + + {{/if}} + + + + + + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index 0dea00f73..208468752 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -1 +1,129 @@ -Azure Form + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + + + {{#if @showDynamicPlugins}} + + <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:body> + + + + + + + {{/if}} + + + + + + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 35a4a94bd..d41b3749b 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -1,10 +1,24 @@ {{#if @model.isNew}} -{{#if @model.compositeType}} - {{component - (concat 'form/host-catalog/' @model.compositeType) - model=@model - submit=@submit - cancel=@cancel - }} -{{/if}} -{{/if}} +
{{@model.type}} {{@model.compositeType}}
+ {{#if @model.isStatic}} + {{component + (concat 'form/host-catalog/' @model.compositeType) + model=@model + submit=@submit + cancel=@cancel + toggleType=this.toggleType + showDynamicPlugins=this.showDynamicPlugins + }} + {{/if}} + + {{#if this.showDynamicPlugins}} + {{component + (concat 'form/host-catalog/' @model.compositeType) + model=@model + submit=@submit + cancel=@cancel + toggleType=this.toggleType + showDynamicPlugins=this.showDynamicPlugins + }} + {{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/index.js b/ui/admin/app/components/form/host-catalog/index.js new file mode 100644 index 000000000..ed49133db --- /dev/null +++ b/ui/admin/app/components/form/host-catalog/index.js @@ -0,0 +1,29 @@ +import Component from '@glimmer/component'; +import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; + +export default class FormHostCatalogIndexComponent extends Component { + // =properties + /** + /** + */ + @tracked showDynamicPlugins = false; + // =actions + + @action + toggleType(type) { + this.renderDynamicPlugins(type); + } + //show dynamic type radio cards -> aws and azure if the type is dynamic + //call route action to update the query and rerender the model if static is selected + renderDynamicPlugins(type) { + if (type === 'dynamic') { + this.showDynamicPlugins = true; + } else { + this.showDynamicPlugins = false; + //CHECK:how to call the action to update query param + this.args.model.type = 'static'; + this.args.changeType(); + } + } +} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 42c75e421..c3201cb81 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -43,9 +43,14 @@ {{/if}}
- <:title>{{t 'resources.host-catalog.type'}} + <:title>{{t 'form.type.label'}} <:body> - + + + {{#if @showDynamicPlugins}} + + <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:body> + + + + + + + {{/if}} + {{#if (can 'save model' @model)}} {{/if}} -
- -{{{log @model.compositeType 'compostite type'}}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/static/index.js b/ui/admin/app/components/form/host-catalog/static/index.js deleted file mode 100644 index 8b55cf8b8..000000000 --- a/ui/admin/app/components/form/host-catalog/static/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import Component from '@glimmer/component'; -import { options } from 'api/models/credential-library'; -import { computed, action } from '@ember/object'; -import { tracked } from '@glimmer/tracking'; - -export default class FormHostCatalogIndexComponent extends Component { - // =properties - /** - /** - */ - @tracked showDynamicPlugins = false; - // =actions - - @action - toggleType(type) { - this.renderDynamicPlugins(type); - } - renderDynamicPlugins(type) { - if(type === 'dynamic') { - this.showDynamicPlugins = true; - } else { - this.showDynamicPlugins = false; - } - } - -} diff --git a/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js b/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js index 182b9c423..3b0c5b729 100644 --- a/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js @@ -1,7 +1,23 @@ import Controller from '@ember/controller'; +import { tracked } from '@glimmer/tracking'; +import { action } from '@ember/object'; export default class ScopesScopeHostCatalogsNewController extends Controller { // =attributes queryParams = ['type']; + @tracked showDynamicPlugins = false; + + @action + async toggleType(type) { + this.renderDynamicPlugins(type); + } + + renderDynamicPlugins(type) { + if (type !== 'static') { + this.showDynamicPlugins = true; + } else { + this.showDynamicPlugins = false; + } + } } 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 49a4a69da..53a2fea97 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -6,13 +6,12 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { // =services @service router; - // =attributes queryParams = { type: { refreshModel: true, - replace: true + replace: true, }, }; From f7a2dd14e33636d5ad70d991d05347ce845415cf Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 1 Feb 2022 22:35:00 -0500 Subject: [PATCH 23/40] chore: Integrate compositetypes into route --- addons/api/addon/models/host-catalog.js | 2 +- .../form/host-catalog/aws/index.hbs | 74 +++++++++++------- .../form/host-catalog/azure/index.hbs | 75 ++++++++++++------- .../components/form/host-catalog/index.hbs | 58 ++++++++------ .../app/components/form/host-catalog/index.js | 44 +++++------ .../form/host-catalog/static/index.hbs | 72 ++++++++++-------- .../scopes/scope/host-catalogs/new.js | 16 ---- .../routes/scopes/scope/host-catalogs/new.js | 18 ++--- .../scopes/scope/host-catalogs/new.hbs | 2 +- 9 files changed, 205 insertions(+), 156 deletions(-) diff --git a/addons/api/addon/models/host-catalog.js b/addons/api/addon/models/host-catalog.js index ec34b50e3..08e1a7d82 100644 --- a/addons/api/addon/models/host-catalog.js +++ b/addons/api/addon/models/host-catalog.js @@ -26,7 +26,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { * @type {boolean} */ get isUnknown() { - return this.isPlugin && !types.includes(this.plugin.name); + return this.isPlugin && !types.includes(this.plugin?.name); } /** diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 208468752..ca157a9f0 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -2,6 +2,8 @@ @onSubmit={{@submit}} @cancel={{@cancel}} @disabled={{@model.isSaving}} + @error={{@model.errors.base}} + @showEditToggle={{if @model.isNew false true}} as |form| > {{/if}}
- - <:title>{{t 'form.type.label'}} - <:body> - - - - - - + + {{#if @model.isNew}} + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + - {{#if @showDynamicPlugins}} <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> @@ -92,13 +95,32 @@ + {{else}} + + <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:body> + + + + + {{/if}} diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index 208468752..80b9f9275 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -2,6 +2,9 @@ @onSubmit={{@submit}} @cancel={{@cancel}} @disabled={{@model.isSaving}} + @disabled={{@model.isSaving}} + @error={{@model.errors.base}} + @showEditToggle={{if @model.isNew false true}} as |form| > {{/if}} - - <:title>{{t 'form.type.label'}} - <:body> - - - - - - + + {{#if @model.isNew}} + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + - {{#if @showDynamicPlugins}} <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> @@ -92,13 +96,32 @@ + {{else}} + + <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:body> + + + + + {{/if}} diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index d41b3749b..39a9d270c 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -1,24 +1,38 @@ -{{#if @model.isNew}} -
{{@model.type}} {{@model.compositeType}}
- {{#if @model.isStatic}} - {{component - (concat 'form/host-catalog/' @model.compositeType) - model=@model - submit=@submit - cancel=@cancel - toggleType=this.toggleType - showDynamicPlugins=this.showDynamicPlugins - }} - {{/if}} +{{component + (concat 'form/host-catalog/' @model.compositeType) + model=@model + submit=@submit + cancel=@cancel + changeType=@changeType + }} - {{#if this.showDynamicPlugins}} - {{component - (concat 'form/host-catalog/' @model.compositeType) - model=@model - submit=@submit - cancel=@cancel - toggleType=this.toggleType - showDynamicPlugins=this.showDynamicPlugins - }} +{{!-- {{#if @model.isStatic}} + {{component + (concat 'form/host-catalog/' @model.type) + model=@model + submit=@submit + cancel=@cancel + form=form + toggleType=this.toggleType + showDynamicPlugins=this.showDynamicPlugins + }} +{{else if @model.isPlugin}} + Model is plugin + {{#if @model.isAWS}} + Model is Aws + {{else if @model.isAzure}} + Model is Azure {{/if}} -{{/if}} \ No newline at end of file +{{/if}} --}} + +{{!-- {{#if @model.type}} + {{component + (concat 'form/auth-method/' @model.type) + model=@model + submit=@submit + cancel=@cancel + removeItemByIndex=@removeItemByIndex + addStringItem=@addStringItem + addAccountClaimMapItem=@addAccountClaimMapItem + }} +{{/if}} --}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/index.js b/ui/admin/app/components/form/host-catalog/index.js index ed49133db..f6ac0ba23 100644 --- a/ui/admin/app/components/form/host-catalog/index.js +++ b/ui/admin/app/components/form/host-catalog/index.js @@ -3,27 +3,27 @@ import { action } from '@ember/object'; import { tracked } from '@glimmer/tracking'; export default class FormHostCatalogIndexComponent extends Component { - // =properties - /** - /** - */ - @tracked showDynamicPlugins = false; - // =actions + // // =properties + // /** + // /** + // */ + // @tracked showDynamicPlugins = false; + // // =actions - @action - toggleType(type) { - this.renderDynamicPlugins(type); - } - //show dynamic type radio cards -> aws and azure if the type is dynamic - //call route action to update the query and rerender the model if static is selected - renderDynamicPlugins(type) { - if (type === 'dynamic') { - this.showDynamicPlugins = true; - } else { - this.showDynamicPlugins = false; - //CHECK:how to call the action to update query param - this.args.model.type = 'static'; - this.args.changeType(); - } - } + // @action + // toggleType(type) { + // this.renderDynamicPlugins(type); + // } + // //show dynamic type radio cards -> aws and azure if the type is dynamic + // //call route action to update the query and rerender the model if static is selected + // renderDynamicPlugins(type) { + // if (type === 'dynamic') { + // this.showDynamicPlugins = true; + // } else { + // this.showDynamicPlugins = false; + // //CHECK:how to call the action to update query param + // // this.args.model.type = 'static'; + // // this.args.changeType(); + // } + // } } diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 960ed5e2b..b0b607602 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -2,6 +2,8 @@ @onSubmit={{@submit}} @cancel={{@cancel}} @disabled={{@model.isSaving}} + @error={{@model.errors.base}} + @showEditToggle={{if @model.isNew false true}} as |form| > {{/if}} - - <:title>{{t 'form.type.label'}} - <:body> - - - - - - - {{#if @showDynamicPlugins}} + {{#if @model.isNew}} - <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:title>{{t 'form.type.label'}} <:body> + + {{#if @model.isPlugin}} + + <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:body> + + + + + + + {{/if}} {{/if}} {{#if (can 'save model' @model)}} diff --git a/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js b/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js index 3b0c5b729..182b9c423 100644 --- a/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/controllers/scopes/scope/host-catalogs/new.js @@ -1,23 +1,7 @@ import Controller from '@ember/controller'; -import { tracked } from '@glimmer/tracking'; -import { action } from '@ember/object'; export default class ScopesScopeHostCatalogsNewController extends Controller { // =attributes queryParams = ['type']; - @tracked showDynamicPlugins = false; - - @action - async toggleType(type) { - this.renderDynamicPlugins(type); - } - - renderDynamicPlugins(type) { - if (type !== 'static') { - this.showDynamicPlugins = true; - } else { - this.showDynamicPlugins = false; - } - } } 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 53a2fea97..fef70cf13 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -6,12 +6,12 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { // =services @service router; + // =attributes queryParams = { type: { refreshModel: true, - replace: true, }, }; @@ -21,17 +21,13 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { * Creates a new unsaved host catalog belonging to the current scope. * @return {HostCatalogModel} */ - model(params) { + model() { const scopeModel = this.modelFor('scopes.scope'); - if (!params.type) params.type = 'static'; - return this.store.createRecord('host-catalog', { - compositeType: params.type, //static or aws or azure - scopeModel, - }); + return this.store.createRecord('host-catalog', { scopeModel }); } - afterModel(model) { - this.router.replaceWith({ queryParams: { type: model.compositeType } }); + afterModel(model, transition) { + this.changeType(transition.to.queryParams?.type); } /** @@ -40,6 +36,10 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { */ @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 } }); } } 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 983c1e86f..210eec22c 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs @@ -18,7 +18,7 @@ @model={{@model}} @submit={{route-action 'save' @model}} @cancel={{route-action 'cancel' @model}} - @changeType={{route-action 'changeType' @model.type}} + @changeType={{route-action 'changeType' @model}} /> From 096b7ea1424f890d1b7d7d043ec390b13e1e709d Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 2 Feb 2022 11:05:48 -0800 Subject: [PATCH 24/40] remove unused file, lint --- .../form/host-catalog/aws/index.hbs | 2 +- .../form/host-catalog/azure/index.hbs | 3 +- .../components/form/host-catalog/index.hbs | 12 ++++---- .../app/components/form/host-catalog/index.js | 29 ------------------- .../form/host-catalog/static/index.hbs | 2 +- .../routes/scopes/scope/host-catalogs/new.js | 2 +- 6 files changed, 10 insertions(+), 40 deletions(-) delete mode 100644 ui/admin/app/components/form/host-catalog/index.js diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index ca157a9f0..537e2589d 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -44,7 +44,7 @@ {{/if}} - + {{#if @model.isNew}} <:title>{{t 'form.type.label'}} diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index 80b9f9275..de9e492aa 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -2,7 +2,6 @@ @onSubmit={{@submit}} @cancel={{@cancel}} @disabled={{@model.isSaving}} - @disabled={{@model.isSaving}} @error={{@model.errors.base}} @showEditToggle={{if @model.isNew false true}} as |form| @@ -45,7 +44,7 @@ {{/if}} - + {{#if @model.isNew}} <:title>{{t 'form.type.label'}} diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index 39a9d270c..def897e50 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -1,10 +1,10 @@ {{component - (concat 'form/host-catalog/' @model.compositeType) - model=@model - submit=@submit - cancel=@cancel - changeType=@changeType - }} + (concat 'form/host-catalog/' @model.compositeType) + model=@model + submit=@submit + cancel=@cancel + changeType=@changeType +}} {{!-- {{#if @model.isStatic}} {{component diff --git a/ui/admin/app/components/form/host-catalog/index.js b/ui/admin/app/components/form/host-catalog/index.js deleted file mode 100644 index f6ac0ba23..000000000 --- a/ui/admin/app/components/form/host-catalog/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import Component from '@glimmer/component'; -import { action } from '@ember/object'; -import { tracked } from '@glimmer/tracking'; - -export default class FormHostCatalogIndexComponent extends Component { - // // =properties - // /** - // /** - // */ - // @tracked showDynamicPlugins = false; - // // =actions - - // @action - // toggleType(type) { - // this.renderDynamicPlugins(type); - // } - // //show dynamic type radio cards -> aws and azure if the type is dynamic - // //call route action to update the query and rerender the model if static is selected - // renderDynamicPlugins(type) { - // if (type === 'dynamic') { - // this.showDynamicPlugins = true; - // } else { - // this.showDynamicPlugins = false; - // //CHECK:how to call the action to update query param - // // this.args.model.type = 'static'; - // // this.args.changeType(); - // } - // } -} diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index b0b607602..50adcf87f 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -107,4 +107,4 @@ @cancelText={{t 'actions.cancel'}} /> {{/if}} - + \ No newline at end of file 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 fef70cf13..40cf6f01a 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -37,7 +37,7 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { @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 (!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 } }); From bd5a7c0aa91d6991e69cf425355da2d4c5407870 Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 2 Feb 2022 12:09:13 -0800 Subject: [PATCH 25/40] pull from int branch --- .../app/components/form/host-catalog/aws/index.hbs | 4 ++-- .../app/components/form/host-catalog/azure/index.hbs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 537e2589d..d00fa198b 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -124,7 +124,7 @@ readonly={{false}} /> - + /> --}} {{#if (can 'save model' @model)}} - + /> --}} {{#if (can 'save model' @model)}} Date: Wed, 2 Feb 2022 14:39:08 -0800 Subject: [PATCH 26/40] add translations --- addons/core/translations/form/en-us.yaml | 10 ++++++ .../form/host-catalog/aws/index.hbs | 30 +++++------------ .../form/host-catalog/azure/index.hbs | 31 ++++++----------- .../components/form/host-catalog/index.hbs | 33 +------------------ .../form/host-catalog/static/index.hbs | 5 +-- 5 files changed, 33 insertions(+), 76 deletions(-) diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 05105fbac..87beceb23 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -118,3 +118,13 @@ callback_url: filter: label: Filter help: A boolean expression defining a filter run against the provided information. +tenant_id: + label: Tenant ID +subscription_id: + label: Subscription ID +access_key_id: + label: Access Key ID +secret_access_key: + label: Secret Access Key +region: + label: Region \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index d00fa198b..f9f02515f 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -13,6 +13,7 @@ @label={{t 'form.name.label'}} @helperText={{t 'form.name.help'}} @error={{@model.errors.name}} + disabled={{@model.isSaving}} readonly={{false}} as |field| > @@ -81,16 +82,18 @@ as |radioGroup| > @@ -106,10 +109,11 @@ as |radioGroup| > @@ -119,27 +123,11 @@ - {{!-- - - --}} - {{#if (can 'save model' @model)}} @@ -81,16 +82,18 @@ as |radioGroup| > @@ -106,10 +109,11 @@ as |radioGroup| > @@ -119,27 +123,11 @@ - {{!-- - - --}} - {{#if (can 'save model' @model)}} {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/index.hbs b/ui/admin/app/components/form/host-catalog/index.hbs index def897e50..90cebebc9 100644 --- a/ui/admin/app/components/form/host-catalog/index.hbs +++ b/ui/admin/app/components/form/host-catalog/index.hbs @@ -4,35 +4,4 @@ submit=@submit cancel=@cancel changeType=@changeType -}} - -{{!-- {{#if @model.isStatic}} - {{component - (concat 'form/host-catalog/' @model.type) - model=@model - submit=@submit - cancel=@cancel - form=form - toggleType=this.toggleType - showDynamicPlugins=this.showDynamicPlugins - }} -{{else if @model.isPlugin}} - Model is plugin - {{#if @model.isAWS}} - Model is Aws - {{else if @model.isAzure}} - Model is Azure - {{/if}} -{{/if}} --}} - -{{!-- {{#if @model.type}} - {{component - (concat 'form/auth-method/' @model.type) - model=@model - submit=@submit - cancel=@cancel - removeItemByIndex=@removeItemByIndex - addStringItem=@addStringItem - addAccountClaimMapItem=@addAccountClaimMapItem - }} -{{/if}} --}} \ No newline at end of file +}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 50adcf87f..caac65a1d 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -13,6 +13,7 @@ @label={{t 'form.name.label'}} @helperText={{t 'form.name.help'}} @error={{@model.errors.name}} + disabled={{@model.isSaving}} readonly={{false}} as |field| > @@ -82,13 +83,13 @@ as |radioGroup| > Date: Wed, 2 Feb 2022 17:39:22 -0800 Subject: [PATCH 27/40] =?UTF-8?q?fix:=20=F0=9F=90=9B=20host=20catalog=20cr?= =?UTF-8?q?eation=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acceptance/host-catalogs/create-test.js | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/ui/admin/tests/acceptance/host-catalogs/create-test.js b/ui/admin/tests/acceptance/host-catalogs/create-test.js index b47b3b4ea..1cfafabe7 100644 --- a/ui/admin/tests/acceptance/host-catalogs/create-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/create-test.js @@ -31,6 +31,8 @@ module('Acceptance | host-catalogs | create', function (hooks) { hostCatalogs: null, hostCatalog: null, newHostCatalog: null, + newStaticHostCatalog: null, + newDynamicHostCatalog: null, }; hooks.beforeEach(function () { @@ -64,6 +66,8 @@ module('Acceptance | host-catalogs | create', function (hooks) { urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; urls.newHostCatalog = `${urls.hostCatalogs}/new`; + urls.newStaticHostCatalog = `${urls.newHostCatalog}?type=static`; + urls.newDynamicHostCatalog = `${urls.newHostCatalog}?type=aws`; // Generate resource couner gethostCatalogCount = () => this.server.schema.hostCatalogs.all().models.length; @@ -71,11 +75,29 @@ module('Acceptance | host-catalogs | create', function (hooks) { authenticateSession({}); }); - test('Users can create new host catalogs', async function (assert) { + test('Users can create new static host catalogs', async function (assert) { assert.expect(1); const count = gethostCatalogCount(); - await visit(urls.newHostCatalog); + await visit(urls.newStaticHostCatalog); + console.log( + urls.newStaticHostCatalog, + 'NEW HOST CATALOGG', + gethostCatalogCount() + ); await fillIn('[name="name"]', 'random string'); + await fillIn('[name="description"]', 'random string'); + await fillIn('[name="types"]', 'static'); + await click('[type="submit"]'); + assert.equal(gethostCatalogCount(), count + 1); + }); + + test('Users can create new dynamic host catalogs', async function (assert) { + assert.expect(1); + const count = gethostCatalogCount(); + await visit(urls.newDynamicHostCatalog); + await fillIn('[name="name"]', 'random string'); + await fillIn('[name="description"]', 'random string'); + await fillIn('[name="types"]', 'aws'); await click('[type="submit"]'); assert.equal(gethostCatalogCount(), count + 1); }); @@ -83,7 +105,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { test('Users can cancel create new host catalogs', async function (assert) { assert.expect(2); const count = gethostCatalogCount(); - await visit(urls.newHostCatalog); + await visit(urls.newStaticHostCatalog); await fillIn('[name="name"]', 'random string'); await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), urls.hostCatalogs); @@ -111,7 +133,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { 'host-catalogs' ].includes('create') ); - assert.notOk(find(`[href="${urls.newHostCatalog}"]`)); + assert.notOk(find(`[href="${urls.newStaticHostCatalog}"]`)); }); test('saving a new host catalog with invalid fields displays error messages', async function (assert) { @@ -135,7 +157,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { } ); }); - await visit(urls.newHostCatalog); + await visit(urls.newStaticHostCatalog); await click('[type="submit"]'); assert.ok( find('[role="alert"]').textContent.trim(), From b3bde173bab2bca2a707d16aaaaca77d83720f48 Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 2 Feb 2022 18:11:01 -0800 Subject: [PATCH 28/40] add missing translations --- ui/admin/app/components/form/host-catalog/aws/index.hbs | 6 +++--- ui/admin/app/components/form/host-catalog/azure/index.hbs | 6 +++--- ui/admin/app/components/form/host-catalog/static/index.hbs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index f9f02515f..8a12ed1df 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -82,14 +82,14 @@ as |radioGroup| > Date: Wed, 2 Feb 2022 18:14:02 -0800 Subject: [PATCH 29/40] names --- ui/admin/app/components/form/host-catalog/azure/index.hbs | 2 +- ui/admin/app/components/form/host-catalog/static/index.hbs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index bba300785..b3e0bfbd6 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -51,7 +51,7 @@ <:title>{{t 'form.type.label'}} <:body> {{t 'form.type.label'}} <:body> Date: Thu, 3 Feb 2022 10:38:10 -0800 Subject: [PATCH 30/40] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20helper?= =?UTF-8?q?=20text,=20fix=20=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/form/host-catalog/aws/index.hbs | 9 ++++----- .../app/components/form/host-catalog/azure/index.hbs | 11 ++++------- .../app/components/form/host-catalog/static/index.hbs | 7 +++---- .../tests/acceptance/host-catalogs/create-test.js | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 8a12ed1df..7b294e368 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -72,11 +72,13 @@ + + <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> @@ -103,7 +103,7 @@ <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index b3e0bfbd6..bdf8e15c0 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -51,7 +51,7 @@ <:title>{{t 'form.type.label'}} <:body> - + <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> @@ -103,7 +101,7 @@ <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index be34effa8..232b63797 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -51,7 +51,7 @@ <:title>{{t 'form.type.label'}} <:body> {{#if @model.isPlugin}} + <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> diff --git a/ui/admin/tests/acceptance/host-catalogs/create-test.js b/ui/admin/tests/acceptance/host-catalogs/create-test.js index 1cfafabe7..68cfd6599 100644 --- a/ui/admin/tests/acceptance/host-catalogs/create-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/create-test.js @@ -86,7 +86,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { ); await fillIn('[name="name"]', 'random string'); await fillIn('[name="description"]', 'random string'); - await fillIn('[name="types"]', 'static'); + await fillIn('[name="static_types"]', 'static'); await click('[type="submit"]'); assert.equal(gethostCatalogCount(), count + 1); }); From d62a8afd3bccd5b37d1c01810a976277eff328c3 Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Thu, 3 Feb 2022 13:48:29 -0800 Subject: [PATCH 31/40] Update create-test.js --- ui/admin/tests/acceptance/host-catalogs/create-test.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ui/admin/tests/acceptance/host-catalogs/create-test.js b/ui/admin/tests/acceptance/host-catalogs/create-test.js index 68cfd6599..1f6fce2ff 100644 --- a/ui/admin/tests/acceptance/host-catalogs/create-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/create-test.js @@ -79,11 +79,6 @@ module('Acceptance | host-catalogs | create', function (hooks) { assert.expect(1); const count = gethostCatalogCount(); await visit(urls.newStaticHostCatalog); - console.log( - urls.newStaticHostCatalog, - 'NEW HOST CATALOGG', - gethostCatalogCount() - ); await fillIn('[name="name"]', 'random string'); await fillIn('[name="description"]', 'random string'); await fillIn('[name="static_types"]', 'static'); From a1ac704649f4059a1fb276b526d1eda8bc46d280 Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 7 Feb 2022 10:32:13 -0800 Subject: [PATCH 32/40] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/host-catalog/aws/index.hbs | 2 +- ui/admin/app/components/form/host-catalog/azure/index.hbs | 4 ++-- ui/admin/app/components/form/host-catalog/static/index.hbs | 4 ++-- ui/admin/tests/acceptance/host-catalogs/create-test.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 7b294e368..8361e2e5b 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -78,7 +78,7 @@ <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> {{t 'form.type.label'}} <:body> {{t 'resources.host-catalog.form.provider-details'}} <:body> {{t 'form.type.label'}} <:body> {{t 'resources.host-catalog.form.provider-details'}} <:body> Date: Mon, 7 Feb 2022 12:48:32 -0800 Subject: [PATCH 33/40] =?UTF-8?q?fix:=20=F0=9F=90=9B=20move=20out=20route-?= =?UTF-8?q?action=20from=20the=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/host-catalog/aws/index.hbs | 4 ++-- ui/admin/app/components/form/host-catalog/azure/index.hbs | 4 ++-- ui/admin/app/components/form/host-catalog/static/index.hbs | 4 ++-- ui/admin/app/templates/scopes/scope/host-catalogs/new.hbs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 8361e2e5b..a50c29492 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -53,7 +53,7 @@ From ab95378f6e6f4fdf3531f01a52721e451cf9924c Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 7 Feb 2022 14:04:03 -0800 Subject: [PATCH 34/40] =?UTF-8?q?fix:=20=F0=9F=90=9B=20radioGroup=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/host-catalog/aws/index.hbs | 4 ++-- ui/admin/app/components/form/host-catalog/azure/index.hbs | 6 +++--- ui/admin/app/components/form/host-catalog/static/index.hbs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index a50c29492..dbe615370 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -78,7 +78,7 @@ <:title>{{t 'resources.host-catalog.form.provider-details'}} <:body> {{t 'resources.host-catalog.form.provider-details'}} <:body> {{t 'form.type.label'}} <:body> {{t 'resources.host-catalog.form.provider-details'}} <:body> {{t 'resources.host-catalog.form.provider-details'}} <:body> {{t 'resources.host-catalog.form.provider-details'}} <:body> Date: Mon, 7 Feb 2022 14:10:12 -0800 Subject: [PATCH 35/40] translation label fix --- addons/core/translations/resources/en-us.yaml | 3 ++- ui/admin/app/components/form/host-catalog/aws/index.hbs | 4 ++-- ui/admin/app/components/form/host-catalog/azure/index.hbs | 4 ++-- ui/admin/app/components/form/host-catalog/static/index.hbs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index d7a3a1db3..5cee71441 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -91,7 +91,8 @@ host-catalog: azure: Azure dynamic: Dynamic form: - provider-details: Provider Details + provider-details: + label: Provider Details types: static: help: Provide a list of hosts and host sets with static addresses diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index dbe615370..683ea2569 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -75,7 +75,7 @@ - <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:title>{{t 'resources.host-catalog.form.provider-details.label'}} <:body> {{else}} - <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:title>{{t 'resources.host-catalog.form.provider-details.label'}} <:body> - <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:title>{{t 'resources.host-catalog.form.provider-details.label'}} <:body> {{else}} - <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:title>{{t 'resources.host-catalog.form.provider-details.label'}} <:body> - <:title>{{t 'resources.host-catalog.form.provider-details'}} + <:title>{{t 'resources.host-catalog.form.provider-details.label'}} <:body> Date: Mon, 7 Feb 2022 14:21:52 -0800 Subject: [PATCH 36/40] lint fic --- ui/admin/app/components/form/host-catalog/aws/index.hbs | 8 ++++++-- ui/admin/app/components/form/host-catalog/azure/index.hbs | 8 ++++++-- .../app/components/form/host-catalog/static/index.hbs | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 683ea2569..c94fe1f24 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -75,7 +75,9 @@ - <:title>{{t 'resources.host-catalog.form.provider-details.label'}} + <:title>{{t + 'resources.host-catalog.form.provider-details.label' + }} <:body> {{else}} - <:title>{{t 'resources.host-catalog.form.provider-details.label'}} + <:title>{{t + 'resources.host-catalog.form.provider-details.label' + }} <:body> - <:title>{{t 'resources.host-catalog.form.provider-details.label'}} + <:title>{{t + 'resources.host-catalog.form.provider-details.label' + }} <:body> {{else}} - <:title>{{t 'resources.host-catalog.form.provider-details.label'}} + <:title>{{t + 'resources.host-catalog.form.provider-details.label' + }} <:body> - <:title>{{t 'resources.host-catalog.form.provider-details.label'}} + <:title>{{t + 'resources.host-catalog.form.provider-details.label' + }} <:body> Date: Mon, 7 Feb 2022 20:59:27 -0800 Subject: [PATCH 37/40] =?UTF-8?q?fix:=20=F0=9F=90=9B=20translation=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/core/translations/resources/en-us.yaml | 24 ++++++++++--------- .../form/host-catalog/aws/index.hbs | 18 +++++++------- .../form/host-catalog/azure/index.hbs | 18 +++++++------- .../form/host-catalog/static/index.hbs | 14 +++++------ .../scopes/scope/host-catalogs/index.hbs | 3 +++ 5 files changed, 41 insertions(+), 36 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 5cee71441..35e000970 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -85,19 +85,21 @@ host-catalog: actions: delete: Delete Host Catalog types: - static: Static - unknown: Unknown - aws: AWS - azure: Azure - dynamic: Dynamic + static: + label: Static + help: Provide a list of hosts and host sets with static addresses + unknown: + label: Unknown + aws: + label: AWS + azure: + label: Azure + dynamic: + label: Dynamic + help: Automate discovery of target hosts and services on Azure or AWS form: - provider-details: + provider_details: label: Provider Details - types: - static: - help: Provide a list of hosts and host sets with static addresses - dynamic: - help: Automate discovery of target hosts and services on Azure or AWS host-set: title: Host Set title_plural: Host Sets diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index c94fe1f24..77dfc8a52 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -57,15 +57,15 @@ as |radioGroup| > @@ -76,7 +76,7 @@ <:title>{{t - 'resources.host-catalog.form.provider-details.label' + 'resources.host-catalog.form.provider_details.label' }} <:body> <:title>{{t - 'resources.host-catalog.form.provider-details.label' + 'resources.host-catalog.form.provider_details.label' }} <:body> @@ -74,7 +74,7 @@ <:title>{{t - 'resources.host-catalog.form.provider-details.label' + 'resources.host-catalog.form.provider_details.label' }} <:body> <:title>{{t - 'resources.host-catalog.form.provider-details.label' + 'resources.host-catalog.form.provider_details.label' }} <:body> @@ -76,7 +76,7 @@ <:title>{{t - 'resources.host-catalog.form.provider-details.label' + 'resources.host-catalog.form.provider_details.label' }} <:body> diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs index f7def8b62..79e33a11c 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs @@ -62,6 +62,7 @@ (concat 'resources.host-catalog.types.' hostCatalog.compositeType + '.label' ) }} @@ -71,6 +72,7 @@ (concat 'resources.host-catalog.types.' hostCatalog.compositeType + '.label' ) }} @@ -86,6 +88,7 @@ (concat 'resources.host-catalog.types.' hostCatalog.compositeType + '.label' ) }} From 4559c1b650d82f6116fadd215ba1e7088e93e857 Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 7 Feb 2022 22:31:58 -0800 Subject: [PATCH 38/40] =?UTF-8?q?fix:=20=F0=9F=90=9B=20label=20and=20paddi?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/core/translations/resources/en-us.yaml | 6 ++++- .../rose/components/form/_radio-card.scss | 2 +- .../form/host-catalog/aws/index.hbs | 16 +++++++++--- .../form/host-catalog/azure/index.hbs | 25 +++++++++++++++---- .../form/host-catalog/static/index.hbs | 12 +++++++-- .../acceptance/host-catalogs/create-test.js | 2 +- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 35e000970..27e3497c0 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -98,8 +98,12 @@ host-catalog: label: Dynamic help: Automate discovery of target hosts and services on Azure or AWS form: - provider_details: + provider: label: Provider Details + description: This is the provider for this host catalog. The format of the host set filters are specific to each provider. + choose_a_provider: + label: Choose a provider + description: There are several built-in plugins for the most common providers. You can choose from on of the included plugins or use a custom plugin. host-set: title: Host Set title_plural: Host Sets diff --git a/addons/rose/addon/styles/rose/components/form/_radio-card.scss b/addons/rose/addon/styles/rose/components/form/_radio-card.scss index 5e8018b40..d8b69c896 100644 --- a/addons/rose/addon/styles/rose/components/form/_radio-card.scss +++ b/addons/rose/addon/styles/rose/components/form/_radio-card.scss @@ -61,7 +61,7 @@ $radio-svg: ( display: inline-flex; align-items: center; justify-content: center; - margin: $size-m $size-xs $size-xl 0; + margin: $size-m $size-xs $size-m 0; .radio-card-overlay { position: absolute; diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 77dfc8a52..d343e3cdd 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -73,11 +73,18 @@ + + <:title>{{t 'resources.host-catalog.form.provider.label'}} + <:title>{{t - 'resources.host-catalog.form.provider_details.label' + 'resources.host-catalog.form.provider.choose_a_provider.label' }} + <:description>{{t + 'resources.host-catalog.form.provider.choose_a_provider.description' + }} + <:body> {{else}} - <:title>{{t - 'resources.host-catalog.form.provider_details.label' - }} + <:title>{{t 'resources.host-catalog.form.provider.label'}} + <:description>{{t + 'resources.host-catalog.form.provider.description' + }} <:body> {{#if @model.isNew}} + {{!-- {{t + 'resources.host-catalog.form.provider.label' + }} --}} + <:title>{{t 'form.type.label'}} <:body> + + + <:title>{{t 'resources.host-catalog.form.provider.label'}} + <:title>{{t - 'resources.host-catalog.form.provider_details.label' + 'resources.host-catalog.form.provider.choose_a_provider.label' }} + <:description>{{t + 'resources.host-catalog.form.provider.choose_a_provider.description' + }} + <:body> {{else}} + - <:title>{{t - 'resources.host-catalog.form.provider_details.label' - }} + <:title>{{t 'resources.host-catalog.form.provider.label'}} + <:description>{{t + 'resources.host-catalog.form.provider.description' + }} + <:body> {{t 'form.type.label'}} <:body> + + <:title>{{t 'resources.host-catalog.form.provider.label'}} + + <:title>{{t - 'resources.host-catalog.form.provider_details.label' + 'resources.host-catalog.form.provider.choose_a_provider.label' }} + <:description>{{t + 'resources.host-catalog.form.provider.choose_a_provider.description' + }} + <:body> Date: Tue, 8 Feb 2022 13:11:08 -0500 Subject: [PATCH 39/40] =?UTF-8?q?chore:=20=F0=9F=A4=96=20clean=20up=20unus?= =?UTF-8?q?ed=20new=20instances?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/routes/scopes/scope/host-catalogs/new.js | 8 ++++++++ 1 file changed, 8 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 40cf6f01a..588ecac90 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/new.js @@ -17,6 +17,14 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route { // =methods + /** + * Rollback/destroy any new, unsaved instances from this route before + * creating another. + */ + beforeModel() { + if (this.currentModel?.isNew) this.currentModel.rollbackAttributes(); + } + /** * Creates a new unsaved host catalog belonging to the current scope. * @return {HostCatalogModel} From 353a7f94ad40ffbc91e7423a7058a50e9c31990b Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 8 Feb 2022 10:30:11 -0800 Subject: [PATCH 40/40] =?UTF-8?q?test:=20=F0=9F=92=8D=20update=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acceptance/host-catalogs/create-test.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ui/admin/tests/acceptance/host-catalogs/create-test.js b/ui/admin/tests/acceptance/host-catalogs/create-test.js index f07467f8e..19fc1dd3d 100644 --- a/ui/admin/tests/acceptance/host-catalogs/create-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/create-test.js @@ -97,7 +97,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { assert.equal(gethostCatalogCount(), count + 1); }); - test('Users can cancel create new host catalogs', async function (assert) { + test('Users can cancel creation of new static host catalogs', async function (assert) { assert.expect(2); const count = gethostCatalogCount(); await visit(urls.newStaticHostCatalog); @@ -107,7 +107,17 @@ module('Acceptance | host-catalogs | create', function (hooks) { assert.equal(gethostCatalogCount(), count); }); - test('Users can navigate to new host catalogs route with proper authorization', async function (assert) { + test('Users can cancel creation of new dynamic host catalogs', async function (assert) { + assert.expect(2); + const count = gethostCatalogCount(); + await visit(urls.newDynamicHostCatalog); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.equal(currentURL(), urls.hostCatalogs); + assert.equal(gethostCatalogCount(), count); + }); + + test('Users can navigate to new static host catalogs route with proper authorization', async function (assert) { assert.expect(2); await visit(urls.hostCatalogs); assert.ok( @@ -118,7 +128,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { assert.ok(find(`[href="${urls.newHostCatalog}"]`)); }); - test('Users cannot navigate to new host catalogs route without proper authorization', async function (assert) { + test('Users cannot navigate to new static host catalogs route without proper authorization', async function (assert) { assert.expect(2); instances.scopes.project.authorized_collection_actions['host-catalogs'] = []; @@ -131,7 +141,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { assert.notOk(find(`[href="${urls.newStaticHostCatalog}"]`)); }); - test('saving a new host catalog with invalid fields displays error messages', async function (assert) { + test('saving a new static host catalog with invalid fields displays error messages', async function (assert) { assert.expect(2); this.server.post('/host-catalogs', () => { return new Response(