diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 34435c631..a047d9042 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -31,6 +31,7 @@ Router.map(function () { }); this.route('targets', function() { this.route('target', { path: ':target_id' }, function() {}); + this.route('new'); }); }); this.route('new'); diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/new.js b/ui/core/app/routes/scopes/scope/projects/project/targets/new.js new file mode 100644 index 000000000..000752c13 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/projects/project/targets/new.js @@ -0,0 +1,16 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route { + + // =methods + + /** + * Creates a new unsaved target in current project scope. + * @return {TargetModel} + */ + model() { + const scopeModel = this.modelFor('scopes.scope.projects.project'); + return this.store.createRecord('target', { scopeModel }); + } + +} 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 index 8d330854c..20b6f19ee 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs +++ b/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs @@ -4,6 +4,14 @@

{{t "resources.targets"}}

+ + {{#if @model}} + + {{t "titles.new"}} + + {{/if}} + + {{#if @model}} @@ -29,9 +37,11 @@

{{target.description}}

- - {{t (concat "target.protocols." target.protocol)}} - + {{#if target.protocol}} + + {{t (concat "target.protocols." target.protocol)}} + + {{/if}} {{target.id}} @@ -48,6 +58,10 @@ {{t "descriptions.targets-welcome"}} + + + {{t "titles.new"}} + diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/new.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/new.hbs new file mode 100644 index 000000000..df5cde8f1 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/targets/new.hbs @@ -0,0 +1,17 @@ +{{title (t 'titles.new')}} + + + + +

{{t "titles.new"}}

+
+ + + + + +
diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/new-test.js new file mode 100644 index 000000000..dea235c50 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/projects/project/targets/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/projects/project/targets/new'); + assert.ok(route); + }); +});