From 5025fa847e36d1665a6ac35936d8615f00dd3c26 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 26 Aug 2020 13:39:39 -0400 Subject: [PATCH] chore: Add breadcrumbs for host-sets in a target Remove unused target/host-sets/index route. Unlink host-sets in a target. --- .../project/targets/target/host-sets.js | 19 ++++++ .../project/targets/target/host-sets.hbs | 68 +++++++++++-------- .../targets/target/host-sets/index.hbs | 1 - ui/core/mirage/generated/factories/target.js | 2 +- .../project/targets/target/host-sets-test.js | 12 ++++ .../targets/target/host-sets/index-test.js | 11 --- ui/core/translations/en-us.yaml | 4 +- 7 files changed, 73 insertions(+), 44 deletions(-) create mode 100644 ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js delete mode 100644 ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/index.hbs create mode 100644 ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/host-sets-test.js delete mode 100644 ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/index-test.js diff --git a/ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js b/ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js new file mode 100644 index 000000000..a8fb5fd35 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js @@ -0,0 +1,19 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeProjectsProjectTargetsTargetHostSetsController 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/templates/scopes/scope/projects/project/targets/target/host-sets.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs index f156172d3..8f04eb6e0 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs +++ b/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs @@ -1,33 +1,41 @@ {{title (t "resources.host-sets")}} - - - - {{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}} -
-
+{{#if @model}} + + + + {{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.target-host-sets-welcome"}} + + + + +{{/if}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/index.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/index.hbs deleted file mode 100644 index 262f42662..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/index.hbs +++ /dev/null @@ -1 +0,0 @@ -Target/host-sets \ No newline at end of file diff --git a/ui/core/mirage/generated/factories/target.js b/ui/core/mirage/generated/factories/target.js index 134cc7c02..2fca0871d 100644 --- a/ui/core/mirage/generated/factories/target.js +++ b/ui/core/mirage/generated/factories/target.js @@ -6,7 +6,7 @@ import { random, date } from 'faker'; */ export default Factory.extend({ - protocol: 'SSH', + protocol: 'tcp', name: () => random.words(), description: () => random.words(), created_time: () => date.recent(), diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/host-sets-test.js new file mode 100644 index 000000000..796ce6793 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/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/targets/target/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/targets/target/host-sets'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/index-test.js deleted file mode 100644 index 285fcc909..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/targets/target/host-sets/index', function(hooks) { - setupTest(hooks); - - test('it exists', function(assert) { - let route = this.owner.lookup('route:scopes/scope/projects/project/targets/target/host-sets/index'); - assert.ok(route); - }); -}); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index 69b41f0cc..8e2ffd179 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -36,7 +36,7 @@ host-set: static: Static target: protocols: - SSH: SSH + tcp: TCP host: types: static: Static @@ -79,6 +79,7 @@ titles: groups-welcome: Welcome to Groups auth-methods-welcome: Welcome to Auth Methods targets-welcome: Create your first Target + target-host-sets-welcome: No Host Sets Associated grants: Permissions new-grant: New Grant principals: Principals @@ -99,6 +100,7 @@ descriptions: groups-welcome: Groups are collections of users. auth-methods-welcome: Auth methods are configurations to authenticate users. targets-welcome: Targets provide Users the means to connect to and interact networked services. A Target contains a collection of Hosts and a collection of Credentials. + target-host-sets-welcome: Add Host Sets to this target to provide access. no-host-set-hosts: Before associating hosts with this host set, create hosts within the host catalog. states: info: Info