diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 4243d97b5..eb486f950 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -29,6 +29,7 @@ Router.map(function () { }); }); }); + this.route('targets', function() {}); }); this.route('new'); }); diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets.js b/ui/core/app/routes/scopes/scope/projects/project/targets.js new file mode 100644 index 000000000..91f399648 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/projects/project/targets.js @@ -0,0 +1,14 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeProjectsProjectTargetsRoute extends Route { + // =methods + + /** + * Loads all targets under current project scope. + * @return {Promise{[TargetModel]}} + */ + async model() { + const scopeID = this.modelFor('scopes.scope.projects.project').id; + return this.store.findAll('target', { adapterOptions: { scopeID } }); + } +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/index.js b/ui/core/app/routes/scopes/scope/projects/project/targets/index.js new file mode 100644 index 000000000..0506aa8da --- /dev/null +++ b/ui/core/app/routes/scopes/scope/projects/project/targets/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeProjectsProjectTargetsIndexRoute extends Route { +} diff --git a/ui/core/app/templates/scopes/scope/projects/project/_sidebar.hbs b/ui/core/app/templates/scopes/scope/projects/project/_sidebar.hbs index 8f46f6113..ae4f79e0b 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/_sidebar.hbs +++ b/ui/core/app/templates/scopes/scope/projects/project/_sidebar.hbs @@ -1,4 +1,7 @@ + + {{t "resources.targets"}} + {{t "resources.host-catalogs"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets.hbs new file mode 100644 index 000000000..744cee2b2 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/targets.hbs @@ -0,0 +1,3 @@ +{{title (t "resources.targets")}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs new file mode 100644 index 000000000..113b126dc --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs @@ -0,0 +1,53 @@ + + + +

{{t "resources.targets"}}

+
+ + + + {{#if @model}} + + + + + {{t "form.label.name"}} + {{t "form.label.protocol"}} + {{t "form.label.id"}} + + + + {{#each @model as |target|}} + + + {{target.displayName}} +

{{target.description}}

+
+ + + {{t (concat "target.protocols." target.protocol)}} + + + + {{target.id}} + +
+ {{/each}} +
+
+ + {{else}} + + + + + {{t "descriptions.targets-welcome"}} + + + + + {{/if}} + +
+ +
diff --git a/ui/core/mirage/scenarios/default.js b/ui/core/mirage/scenarios/default.js index f09f7dac8..439b9fd01 100644 --- a/ui/core/mirage/scenarios/default.js +++ b/ui/core/mirage/scenarios/default.js @@ -33,10 +33,7 @@ export default function(server) { server.db.scopes.where({type: 'project'}).forEach(({ id, type }) => { const scope = { id, type }; server.createList('host-catalog', 2, { scope }, 'withChildren'); + server.createList('target', 2, { scope }); }); - - // Target - - server.createList('target', 5, { scope }); - + } diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets-test.js new file mode 100644 index 000000000..ca2ead9ca --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/projects/project/targets', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/projects/project/targets'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/index-test.js new file mode 100644 index 000000000..fa478cbe9 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/projects/project/targets/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/projects/project/targets/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index 125b3b75c..b2d630279 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -31,6 +31,10 @@ auth: host-set: types: static: Static +target: + protocols: + ssh: SSH + SSH: SSH resources: user: User users: Users @@ -48,6 +52,7 @@ resources: auth-methods: Auth Methods host-set: Host Set host-sets: Host Sets + targets: Targets titles: iam: IAM new: New @@ -64,10 +69,12 @@ titles: roles-welcome: Welcome to Roles groups-welcome: Welcome to Groups auth-methods-welcome: Welcome to Auth Methods + targets-welcome: Create your first Target grants: Permissions new-grant: New Grant principals: Principals host-sets: Host Sets + targets: Targets global: Global descriptions: host-catalogs: Overview of collections of hosts and host sets. @@ -79,6 +86,7 @@ descriptions: roles-welcome: Roles are collections of capabilities that can be granted to user and/or groups. 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. states: info: Info success: Success @@ -95,6 +103,7 @@ form: manage: Manage grant: Grant principal: Principal + protocol: Protocol errors: titles: unauthenticated-error: You are not signed in