State periodic or parameterized as the job type when applicable
This commit is contained in:
parent
64b99276ca
commit
1f5e9998e9
|
@ -34,6 +34,18 @@ export default Model.extend({
|
|||
parent: belongsTo('job', { inverse: 'children' }),
|
||||
children: hasMany('job', { inverse: 'parent' }),
|
||||
|
||||
// A composite of type and other job attributes to determine
|
||||
// a better type descriptor for human interpretation rather
|
||||
// than for scheduling.
|
||||
displayType: computed('type', 'periodic', 'parameterized', function() {
|
||||
if (this.get('periodic')) {
|
||||
return 'periodic';
|
||||
} else if (this.get('parameterized')) {
|
||||
return 'parameterized';
|
||||
}
|
||||
return this.get('type');
|
||||
}),
|
||||
|
||||
// A composite of type and other job attributes to determine
|
||||
// type for templating rather than scheduling
|
||||
templateType: computed(
|
||||
|
@ -57,10 +69,10 @@ export default Model.extend({
|
|||
// Guard against the API introducing a new type before the UI
|
||||
// is prepared to handle it.
|
||||
return this.get('type');
|
||||
} else {
|
||||
// A fail-safe in the event the API introduces a new type.
|
||||
return 'service';
|
||||
}
|
||||
|
||||
// A fail-safe in the event the API introduces a new type.
|
||||
return 'service';
|
||||
}
|
||||
),
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<td data-test-job-status>
|
||||
<span class="tag {{job.statusClass}}">{{job.status}}</span>
|
||||
</td>
|
||||
<td data-test-job-type>{{job.type}}</td>
|
||||
<td data-test-job-type>{{job.displayType}}</td>
|
||||
<td data-test-job-priority>{{job.priority}}</td>
|
||||
<td data-test-job-task-groups>
|
||||
{{#if job.isReloading}}
|
||||
|
|
|
@ -59,7 +59,7 @@ test('each job row should contain information about the job', function(assert) {
|
|||
job.status,
|
||||
'Status'
|
||||
);
|
||||
assert.equal(jobRow.querySelector('[data-test-job-type]').textContent, job.type, 'Type');
|
||||
assert.equal(jobRow.querySelector('[data-test-job-type]').textContent, typeForJob(job), 'Type');
|
||||
assert.equal(
|
||||
jobRow.querySelector('[data-test-job-priority]').textContent,
|
||||
job.priority,
|
||||
|
@ -99,9 +99,7 @@ test('when there are no jobs, there is an empty message', function(assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('when there are jobs, but no matches for a search result, there is an empty message', function(
|
||||
assert
|
||||
) {
|
||||
test('when there are jobs, but no matches for a search result, there is an empty message', function(assert) {
|
||||
server.create('job', { name: 'cat 1' });
|
||||
server.create('job', { name: 'cat 2' });
|
||||
|
||||
|
@ -117,9 +115,7 @@ test('when there are jobs, but no matches for a search result, there is an empty
|
|||
});
|
||||
});
|
||||
|
||||
test('when the namespace query param is set, only matching jobs are shown and the namespace value is forwarded to app state', function(
|
||||
assert
|
||||
) {
|
||||
test('when the namespace query param is set, only matching jobs are shown and the namespace value is forwarded to app state', function(assert) {
|
||||
server.createList('namespace', 2);
|
||||
const job1 = server.create('job', { namespaceId: server.db.namespaces[0].id });
|
||||
const job2 = server.create('job', { namespaceId: server.db.namespaces[1].id });
|
||||
|
@ -144,9 +140,7 @@ test('when the namespace query param is set, only matching jobs are shown and th
|
|||
});
|
||||
});
|
||||
|
||||
test('when accessing jobs is forbidden, show a message with a link to the tokens page', function(
|
||||
assert
|
||||
) {
|
||||
test('when accessing jobs is forbidden, show a message with a link to the tokens page', function(assert) {
|
||||
server.pretender.get('/v1/jobs', () => [403, {}, null]);
|
||||
|
||||
visit('/jobs');
|
||||
|
@ -163,3 +157,7 @@ test('when accessing jobs is forbidden, show a message with a link to the tokens
|
|||
assert.equal(currentURL(), '/settings/tokens');
|
||||
});
|
||||
});
|
||||
|
||||
function typeForJob(job) {
|
||||
return job.periodic ? 'periodic' : job.parameterized ? 'parameterized' : job.type;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue