From 4994b8256bc91ece8d8123b64bafcadb8781b29f Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 16 Feb 2022 15:05:35 -0500 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20read-only=20h?= =?UTF-8?q?ost=20route=20for=20dynamic=20hosts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../host-sets/host-set/hosts/host.js | 3 + ui/admin/app/router.js | 4 +- .../host-sets/host-set/hosts/host.js | 3 + .../host-sets/host-set/hosts/host/index.js | 3 + .../host-sets/host-set/hosts/index.js | 3 + .../host-catalog/host-sets/host-set/hosts.hbs | 82 +---------------- .../host-sets/host-set/hosts/host.hbs | 3 + .../host-sets/host-set/hosts/host/index.hbs | 9 ++ .../host-sets/host-set/hosts/index.hbs | 91 +++++++++++++++++++ .../host-sets/host-set/hosts/host-test.js | 17 ++++ .../host-sets/host-set/hosts/host-test.js | 16 ++++ .../host-set/hosts/host/index-test.js | 16 ++++ .../host-sets/host-set/hosts/index-test.js | 16 ++++ 13 files changed, 184 insertions(+), 82 deletions(-) create mode 100644 ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js create mode 100644 ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js create mode 100644 ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.js create mode 100644 ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.js create mode 100644 ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.hbs create mode 100644 ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.hbs create mode 100644 ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.hbs create mode 100644 ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js create mode 100644 ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js create mode 100644 ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index-test.js create mode 100644 ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index-test.js diff --git a/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js b/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js new file mode 100644 index 000000000..6ef77b91f --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js @@ -0,0 +1,3 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsHostController extends Controller {} diff --git a/ui/admin/app/router.js b/ui/admin/app/router.js index ef557fbc8..75ce77c2c 100644 --- a/ui/admin/app/router.js +++ b/ui/admin/app/router.js @@ -91,7 +91,9 @@ Router.map(function () { this.route('host-sets', function () { this.route('new'); this.route('host-set', { path: ':host_set_id' }, function () { - this.route('hosts'); + this.route('hosts', function () { + this.route('host', { path: ':host_id' }, function () {}); + }); this.route('add-hosts'); this.route('create-and-add-host'); }); diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js new file mode 100644 index 000000000..3773e93c5 --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsHostRoute extends Route {} diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.js new file mode 100644 index 000000000..873e01b71 --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsHostIndexRoute extends Route {} diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.js new file mode 100644 index 000000000..30f72878b --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsIndexRoute extends Route {} diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs index 21d06fcb9..c78470ec0 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs @@ -1,83 +1,3 @@ {{page-title (t 'resources.host.title_plural')}} -{{#if @model.hosts}} - - - - - {{t 'form.name.label'}} - {{t 'form.type.label'}} - {{t 'form.id.label'}} - {{#if @model.isStatic}} - {{t 'titles.actions'}} - {{/if}} - - - - {{#each @model.hosts as |host|}} - - - - {{host.displayName}} - -

{{host.description}}

-
- - - - - - {{host.id}} - - - - {{#if (can 'removeHosts hostSet' @model.hostSet)}} - - - {{t 'actions.remove'}} - - - {{/if}} - -
- {{/each}} -
-
- -{{/if}} - -{{#unless @model.hosts}} - - - - {{t 'resources.host-set.host.messages.none.description'}} - - {{!-- - - - {{t "resources.host-set.actions.create-and-add-host"}} - - --}} - - -{{/unless}} \ No newline at end of file +{{outlet}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.hbs new file mode 100644 index 000000000..7d32ecb0d --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.hbs @@ -0,0 +1,3 @@ +{{page-title @model.displayName}} + +{{outlet}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.hbs new file mode 100644 index 000000000..2a0249dfa --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index.hbs @@ -0,0 +1,9 @@ + + +{{!-- + +--}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.hbs new file mode 100644 index 000000000..3d1189b2e --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index.hbs @@ -0,0 +1,91 @@ +{{#if @model.hosts}} + + + + + {{t 'form.name.label'}} + {{t 'form.type.label'}} + {{t 'form.id.label'}} + {{#if @model.isStatic}} + {{t 'titles.actions'}} + {{/if}} + + + + {{#each @model.hosts as |host|}} + + + {{#if host.isStatic}} + + {{host.displayName}} + + {{else}} + {{! Link to a different subroute for dynamic/plugin hosts }} + + {{host.displayName}} + + {{/if}} +

{{host.description}}

+
+ + + + + + {{host.id}} + + + + {{#if (can 'removeHosts hostSet' @model.hostSet)}} + + + {{t 'actions.remove'}} + + + {{/if}} + +
+ {{/each}} +
+
+ +{{/if}} + +{{#unless @model.hosts}} + + + + {{t 'resources.host-set.host.messages.none.description'}} + + {{!-- + + + {{t "resources.host-set.actions.create-and-add-host"}} + + --}} + + +{{/unless}} \ No newline at end of file diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js new file mode 100644 index 000000000..7779bde77 --- /dev/null +++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js @@ -0,0 +1,17 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host', + 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/host-catalog/host-sets/host-set/hosts/host' + ); + assert.ok(controller); + }); + } +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js b/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js new file mode 100644 index 000000000..6fc01e757 --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host' + ); + assert.ok(route); + }); + } +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index-test.js b/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index-test.js new file mode 100644 index 000000000..94e8acb8f --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host/index' + ); + assert.ok(route); + }); + } +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index-test.js b/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index-test.js new file mode 100644 index 000000000..53eabbeab --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index' + ); + assert.ok(route); + }); + } +); From e15198d944f5a7c313b1e79926394c3c81184c99 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 16 Feb 2022 15:20:27 -0500 Subject: [PATCH 2/2] chore: add missing breadcrumb --- .../host-catalog/host-sets/host-set/hosts/host.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js b/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js index 6ef77b91f..97ce819cc 100644 --- a/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js +++ b/ui/admin/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/host.js @@ -1,3 +1,13 @@ import Controller from '@ember/controller'; -export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsHostController extends Controller {} +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsHostController extends Controller { + // =attributes + + /** + * A role breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.displayName; + } +}