Sort allocation by status type, not simply alphanumeric

This commit is contained in:
Michael Lange 2017-10-17 17:48:52 -07:00
parent 97569f5c70
commit a10466a68d
3 changed files with 13 additions and 2 deletions

View File

@ -10,6 +10,14 @@ import shortUUIDProperty from '../utils/properties/short-uuid';
const { computed, RSVP } = Ember;
const STATUS_ORDER = {
pending: 1,
running: 2,
complete: 3,
failed: 4,
lost: 5,
};
export default Model.extend({
shortId: shortUUIDProperty('id'),
job: belongsTo('job'),
@ -24,6 +32,9 @@ export default Model.extend({
clientStatus: attr('string'),
desiredStatus: attr('string'),
statusIndex: computed('clientStatus', function() {
return STATUS_ORDER[this.get('clientStatus')] || 100;
}),
taskGroup: computed('taskGroupName', 'job.taskGroups.[]', function() {
const taskGroups = this.get('job.taskGroups');

View File

@ -68,7 +68,7 @@
{{#t.head}}
{{#t.sort-by prop="shortId"}}ID{{/t.sort-by}}
{{#t.sort-by prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="clientStatus"}}Status{{/t.sort-by}}
{{#t.sort-by prop="statusIndex"}}Status{{/t.sort-by}}
{{#t.sort-by prop="node.shortId"}}Node{{/t.sort-by}}
<th>CPU</th>
<th>Memory</th>

View File

@ -41,7 +41,7 @@
{{#t.head}}
{{#t.sort-by prop="shortId"}}ID{{/t.sort-by}}
{{#t.sort-by prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="clientStatus"}}Status{{/t.sort-by}}
{{#t.sort-by prop="statusIndex"}}Status{{/t.sort-by}}
{{#t.sort-by prop="job.name"}}Job{{/t.sort-by}}
<th>CPU</th>
<th>Memory</th>