feat: Add /targets/:target_id route
This commit is contained in:
10 files changed
+97
-2
No files matched your search
@@ -13,7 +13,9 @@ Router.map(function () {
|
||||
this.route('method', { path: ':auth_method_id' });
|
||||
});
|
||||
this.route('projects', function () {
|
||||
this.route('targets', function () {});
|
||||
this.route('targets', function () {
|
||||
this.route('target', { path: ':target_id' }, function() {});
|
||||
});
|
||||
this.route('sessions', function() {});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeProjectsTargetsTargetRoute extends Route {
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Load a target.
|
||||
* @param {object} params
|
||||
* @param {string} params.target_id
|
||||
* @return {TargetModel}
|
||||
*/
|
||||
async model({ target_id }) {
|
||||
return this.store.findRecord('target', target_id, { reload: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the target-specific templates for header and navigation
|
||||
* page sections.
|
||||
* @override
|
||||
*/
|
||||
renderTemplate() {
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/projects/targets/target/-header', {
|
||||
into: 'scopes/scope/projects/targets/target',
|
||||
outlet: 'header',
|
||||
});
|
||||
|
||||
this.render('scopes/scope/projects/targets/target/-navigation', {
|
||||
into: 'scopes/scope/projects/targets/target',
|
||||
outlet: 'navigation',
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeProjectsTargetsTargetIndexRoute extends Route {
|
||||
}
|
||||
@@ -21,7 +21,12 @@
|
||||
{{#each @model as |model|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
{{model.target.name}}
|
||||
<LinkTo
|
||||
@route="scopes.scope.projects.targets.target"
|
||||
@model={{model.target.id}}
|
||||
>
|
||||
{{model.target.displayName}}
|
||||
</LinkTo>
|
||||
<p>{{model.target.description}}</p>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{{page-title @model.displayName}}
|
||||
|
||||
<Rose::Layout::Page as |page|>
|
||||
|
||||
<page.header>
|
||||
{{outlet "header"}}
|
||||
</page.header>
|
||||
|
||||
<page.navigation>
|
||||
{{outlet "navigation"}}
|
||||
</page.navigation>
|
||||
|
||||
<page.body>
|
||||
{{outlet}}
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
@@ -0,0 +1,4 @@
|
||||
<h2>
|
||||
{{model.displayName}}
|
||||
</h2>
|
||||
<p>{{model.description}}</p>
|
||||
@@ -0,0 +1,5 @@
|
||||
<Rose::Nav::Tabs as |nav|>
|
||||
<nav.link @route='scopes.scope.projects.targets.target.index'>
|
||||
{{t 'resources.host-set.title_plural'}}
|
||||
</nav.link>
|
||||
</Rose::Nav::Tabs>
|
||||
@@ -0,0 +1 @@
|
||||
{{outlet}}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | scopes/scope/projects/targets/target', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/projects/targets/target');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | scopes/scope/projects/targets/target/index', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/projects/targets/target/index');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user