From 7930d0e68c4c5b04da22dd268c8d87ea95b82bd2 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 20 Aug 2020 11:56:37 -0400 Subject: [PATCH 1/4] chore: Add new host set route --- .../app/components/form/host-set/index.hbs | 6 ++ ui/core/app/router.js | 1 + .../host-catalogs/host-catalog/host-sets.js | 7 +- .../host-catalog/host-sets/new.js | 46 +++++++++++ .../host-catalog/host-sets/index.hbs | 80 ++++++++++++------- .../host-catalog/host-sets/new.hbs | 7 ++ .../host-catalog/host-sets/new/-actions.hbs | 0 .../host-catalog/host-sets/new/-header.hbs | 1 + .../host-sets/new/-navigation.hbs | 0 ui/core/tests/acceptance/host-sets-test.js | 12 +++ .../host-catalog/host-sets/new-test.js | 11 +++ ui/core/translations/en-us.yaml | 6 ++ 12 files changed, 146 insertions(+), 31 deletions(-) create mode 100644 ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js create mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs create mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions.hbs create mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header.hbs create mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation.hbs create mode 100644 ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js diff --git a/ui/core/app/components/form/host-set/index.hbs b/ui/core/app/components/form/host-set/index.hbs index 45adc26d0..beb85b652 100644 --- a/ui/core/app/components/form/host-set/index.hbs +++ b/ui/core/app/components/form/host-set/index.hbs @@ -6,6 +6,12 @@ as |form| > + + - - - {{t "form.label.name"}} - {{t "form.label.type"}} - {{t "form.label.id"}} - - - - {{#each @model as |hostSet|}} - - - - {{hostSet.displayName}} - -

{{hostSet.description}}

-
- - {{hostSet.type}} - - - {{hostSet.id}} - -
- {{/each}} -
- \ No newline at end of file +{{#if @model}} + + {{t "actions.add-host-set"}} + + + + + {{t "form.label.name"}} + {{t "form.label.type"}} + {{t "form.label.id"}} + + + + {{#each @model as |hostSet|}} + + + + {{hostSet.displayName}} + +

{{hostSet.description}}

+
+ + {{hostSet.type}} + + + {{hostSet.id}} + +
+ {{/each}} +
+
+{{else}} + + + + {{t "descriptions.host-sets-welcome"}} + + + + {{t "titles.new"}} + + + +{{/if}} \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs new file mode 100644 index 000000000..1d5d73000 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs @@ -0,0 +1,7 @@ +{{title (t 'titles.new')}} + + \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions.hbs new file mode 100644 index 000000000..e69de29bb diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header.hbs new file mode 100644 index 000000000..ace8ccb08 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header.hbs @@ -0,0 +1 @@ +

{{t "titles.new"}}

\ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation.hbs new file mode 100644 index 000000000..e69de29bb diff --git a/ui/core/tests/acceptance/host-sets-test.js b/ui/core/tests/acceptance/host-sets-test.js index d01bb6796..87c0ab9dc 100644 --- a/ui/core/tests/acceptance/host-sets-test.js +++ b/ui/core/tests/acceptance/host-sets-test.js @@ -88,6 +88,18 @@ module('Acceptance | host sets', function (hooks) { assert.expect(0); }); + test('can create new host set', async function (assert) { + assert.expect(0); + }); + + test('can cancel new host set creation', async function (assert) { + assert.expect(0); + }); + + test('saving a new host set with invalid fields displays error messages', async function (assert) { + assert.expect(0); + }); + test('errors are displayed when save on auth method fails', async function (assert) { assert.expect(0); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js new file mode 100644 index 000000000..7d915db00 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index b274633f8..7fbe18417 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -15,6 +15,7 @@ actions: delete-project: Delete project delete-host-catalog: Delete host catalog delete-host-set: Delete host set + add-host-set: Create Host Set auth: titles: no-scopes: No Scopes Available @@ -26,6 +27,9 @@ auth: authenticating-with-org: "You're authenticating with {name}." method-types: password: Password +host-set: + types: + static: Static resources: user: User users: Users @@ -54,6 +58,7 @@ titles: empty-set: No Items Yet projects-welcome: Welcome to Projects host-catalogs-welcome: Welcome to Host Catalogs + host-sets-welcome: Welcome to Host Sets users-welcome: Welcome to Users roles-welcome: Welcome to Roles groups-welcome: Welcome to Groups @@ -68,6 +73,7 @@ descriptions: empty-set: There are no items to display yet. You may be able to add items or try back later. projects-welcome: Projects allow you to create and manage host catalogs. To start, create a project. host-catalogs-welcome: Host catalogs allow you to configure to collect and create hosts and host sets. To start, create a host catalog. + host-sets-welcome: Configure a static host set in this host catalog. users-welcome: Users are authorized to access Boundary. roles-welcome: Roles are collections of capabilities that can be granted to user and/or groups. groups-welcome: Groups are collections of users. From e3f8158fda14d6bc9de59d6f49a424bb60e54d51 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 20 Aug 2020 12:08:51 -0400 Subject: [PATCH 2/4] chore: Add breadcrumbs to host sets --- .../host-catalogs/host-catalog/host-sets.js | 20 +++++++++++++++++++ .../host-catalog/host-sets/host-set.js | 15 ++++++++++++++ .../host-catalog/host-sets/new.js | 19 ++++++++++++++++++ .../host-catalog/host-sets-test.js | 12 +++++++++++ .../host-catalog/host-sets/host-set-test.js | 12 +++++++++++ .../host-catalog/host-sets/new-test.js | 12 +++++++++++ 6 files changed, 90 insertions(+) create mode 100644 ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js create mode 100644 ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js create mode 100644 ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js new file mode 100644 index 000000000..e7b0ab912 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js @@ -0,0 +1,20 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsController extends Controller { + + // =services + + @service intl; + + // =attributes + + /** + * Host sets breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.host-sets'); + } + +} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js new file mode 100644 index 000000000..97210f306 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js @@ -0,0 +1,15 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetController extends Controller { + + // =attributes + + /** + * Host set breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.displayName; + } + +} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js new file mode 100644 index 000000000..8c048369d --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js @@ -0,0 +1,19 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewController extends Controller { + + // =services + + @service intl; + + // =attributes + + /** + * Translated new host set breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('titles.new'); + } +} diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js new file mode 100644 index 000000000..c42783690 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js new file mode 100644 index 000000000..4c138b857 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js new file mode 100644 index 000000000..168a1c576 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new'); + assert.ok(controller); + }); +}); From 4282a037836b24a5bde147143aaa47560359f70b Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 20 Aug 2020 13:13:11 -0400 Subject: [PATCH 3/4] chore: Remove duplicated projects routes --- ui/core/app/router.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ui/core/app/router.js b/ui/core/app/router.js index a14c71087..4243d97b5 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -22,7 +22,12 @@ Router.map(function () { this.route('project', { path: ':project_id' }, function() { this.route('host-catalogs', function() { this.route('new'); - this.route('host-catalog', { path: ':host_catalog_id' }, function() {}); + this.route('host-catalog', { path: ':host_catalog_id' }, function() { + this.route('host-sets', function() { + this.route('host-set', { path: ':host_set_id' }, function() {}); + this.route('new'); + }); + }); }); }); this.route('new'); @@ -46,20 +51,6 @@ Router.map(function () { this.route('new'); }); - this.route('projects', function() { - this.route('project', { path: ':project_id' }, function() { - this.route('host-catalogs', function() { - this.route('new'); - this.route('host-catalog', { path: ':host_catalog_id' }, function() { - this.route('host-sets', function() { - this.route('host-set', { path: ':host_set_id' }, function() {}); - this.route('new'); - }); - }); - }); - }); - this.route('new'); - }); this.route('auth-methods', function() { this.route('auth-method', { path: ':auth_method_id' }, function() {}); this.route('new'); From ca06a19411fda5fc7ae690eb89775b6c5384cde7 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 20 Aug 2020 13:40:16 -0400 Subject: [PATCH 4/4] chore: Add emptyoutlet to render instead of null named outlet --- ui/core/app/routes/scopes/scope/projects/project.js | 3 ++- .../projects/project/host-catalogs/host-catalog.js | 2 +- .../host-catalogs/host-catalog/host-sets/new.js | 6 +++--- .../host-sets/new/-actions.hbs => _empty.hbs} | 0 .../project/host-catalogs/host-catalog/-actions.hbs | 7 +++++++ .../host-catalogs/host-catalog/host-sets/index.hbs | 12 +++++------- .../host-catalog/host-sets/new/-navigation.hbs | 0 7 files changed, 18 insertions(+), 12 deletions(-) rename ui/core/app/templates/{scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions.hbs => _empty.hbs} (100%) delete mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation.hbs diff --git a/ui/core/app/routes/scopes/scope/projects/project.js b/ui/core/app/routes/scopes/scope/projects/project.js index dae7bbcd3..5907122b9 100644 --- a/ui/core/app/routes/scopes/scope/projects/project.js +++ b/ui/core/app/routes/scopes/scope/projects/project.js @@ -20,11 +20,12 @@ export default class ScopesScopeProjectsProjectRoute extends Route { * @param {object} model */ renderTemplate(controller, model) { + super.renderTemplate(...arguments); + this.render('scopes/scope/projects/project/_sidebar', { into: 'scopes/scope', outlet: 'sidebar', model: model }); - super.renderTemplate(...arguments); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js index 00768575f..7247e9446 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js @@ -24,7 +24,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte * @param {object} model */ renderTemplate(controller, model) { - this.render('scopes/scope/projects/project/host-catalogs/host-catalog'); + super.renderTemplate(...arguments); this.render('scopes/scope/projects/project/host-catalogs/host-catalog/-header', { into: 'scopes/scope/projects/project/host-catalogs/host-catalog', diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js index 01bb5caad..87f67abc7 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js @@ -23,7 +23,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe * @param {object} model */ renderTemplate(controller, model) { - this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new'); + super.renderTemplate(...arguments); this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header', { into: 'scopes/scope/projects/project/host-catalogs/host-catalog', @@ -31,13 +31,13 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe model: model }); - this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation', { + this.render('_empty', { into: 'scopes/scope/projects/project/host-catalogs/host-catalog', outlet: 'navigation', model: model }); - this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions', { + this.render('_empty', { into: 'scopes/scope/projects/project/host-catalogs/host-catalog', outlet: 'actions', model: model diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions.hbs b/ui/core/app/templates/_empty.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-actions.hbs rename to ui/core/app/templates/_empty.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs index b905f8d7d..9f1032438 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs +++ b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs @@ -1,4 +1,11 @@ + + {{t "actions.add-host-set"}} + + - {{t "actions.add-host-set"}} - + @@ -35,7 +30,9 @@ {{/each}} + {{else}} + @@ -47,4 +44,5 @@ -{{/if}} \ No newline at end of file + +{{/if}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-navigation.hbs deleted file mode 100644 index e69de29bb..000000000