Update all job links

This commit is contained in:
Michael Lange 2017-10-23 10:27:22 -07:00
parent d967a9eb30
commit eb59f76601
7 changed files with 28 additions and 8 deletions

View File

@ -6,7 +6,10 @@ export default Controller.extend({
breadcrumbs: computed('model.{name,id}', function() {
return [
{ label: 'Jobs', args: ['jobs'] },
{ label: this.get('model.name'), args: ['jobs.job', this.get('model.id')] },
{
label: this.get('model.name'),
args: ['jobs.job', this.get('model')],
},
];
}),
});

View File

@ -8,7 +8,7 @@ const Router = Ember.Router.extend({
Router.map(function() {
this.route('jobs', function() {
this.route('job', { path: '/:job_id' }, function() {
this.route('job', { path: '/:job_name' }, function() {
this.route('task-group', { path: '/:name' });
this.route('definition');
this.route('versions');

View File

@ -6,9 +6,19 @@ const { Route, inject } = Ember;
export default Route.extend({
store: inject.service(),
model({ job_id }) {
serialize(model) {
return { job_name: model.get('plainId') };
},
model(params, transition) {
const namespace = transition.queryParams.namespace || this.get('system.activeNamespace.id');
const name = params.job_name;
const fullId = JSON.stringify([name, namespace]);
return this.get('store')
.findRecord('job', job_id, { reload: true })
.findRecord('job', fullId, { reload: true })
.then(job => {
return job.get('allocations').then(() => job);
})
.catch(notifyError(this));
},
});

View File

@ -1,7 +1,7 @@
<section class="section">
<h1 class="title">Allocation {{model.name}}</h1>
<h3 class="subtitle">
For job {{#link-to "jobs.job" model.job}}{{model.job.name}}{{/link-to}}
For job {{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id)}}{{model.job.name}}{{/link-to}}
on node {{#link-to "nodes.node" model.node}}{{model.node.shortId}}{{/link-to}}
</h3>

View File

@ -16,7 +16,7 @@
{{#if (or allocation.job.isPending allocation.job.isReloading)}}
...
{{else}}
{{#link-to "jobs.job" allocation.job}}{{allocation.job.name}}{{/link-to}}
{{#link-to "jobs.job" allocation.job (query-params jobNamespace=allocation.job.namespace.id)}}{{allocation.job.name}}{{/link-to}}
<span class="is-faded">/ {{allocation.taskGroup.name}}</span>
{{/if}}
</td>

View File

@ -1,4 +1,4 @@
<td>{{#link-to "jobs.job" job.id class="is-primary"}}{{job.name}}{{/link-to}}</td>
<td>{{#link-to "jobs.job" job class="is-primary"}}{{job.name}}{{/link-to}}</td>
<td>
<span class="tag {{job.statusClass}}">{{job.status}}</span>
</td>

View File

@ -1,6 +1,13 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{#link-to
params=(append
breadcrumb.args
(query-params jobNamespace=(or model.namespace.id "default"))
)
class="breadcrumb"}}
{{breadcrumb.label}}
{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}