Sort allocation by status type, not simply alphanumeric
This commit is contained in:
parent
97569f5c70
commit
a10466a68d
|
@ -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');
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue