github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/models/evaluation.js (about) 1 import { bool, equal } from '@ember/object/computed'; 2 import Model from '@ember-data/model'; 3 import { attr, belongsTo, hasMany } from '@ember-data/model'; 4 import { fragmentArray } from 'ember-data-model-fragments/attributes'; 5 import shortUUIDProperty from '../utils/properties/short-uuid'; 6 7 export default class Evaluation extends Model { 8 @shortUUIDProperty('id') shortId; 9 @shortUUIDProperty('nodeId') shortNodeId; 10 @attr('number') priority; 11 @attr('string') type; 12 @attr('string') triggeredBy; 13 @attr('string') status; 14 @attr('string') statusDescription; 15 @fragmentArray('placement-failure', { defaultValue: () => [] }) 16 failedTGAllocs; 17 18 @attr('string') previousEval; 19 @attr('string') nextEval; 20 @attr('string') blockedEval; 21 @hasMany('evaluation-stub', { async: false }) relatedEvals; 22 23 @bool('failedTGAllocs.length') hasPlacementFailures; 24 @equal('status', 'blocked') isBlocked; 25 26 @belongsTo('job') job; 27 @belongsTo('node') node; 28 29 @attr('number') modifyIndex; 30 @attr('date') modifyTime; 31 32 @attr('number') createIndex; 33 @attr('date') createTime; 34 35 @attr('date') waitUntil; 36 @attr('string') namespace; 37 @attr('string') plainJobId; 38 39 get hasJob() { 40 return !!this.plainJobId; 41 } 42 43 get hasNode() { 44 return !!this.belongsTo('node').id(); 45 } 46 47 get nodeId() { 48 return this.belongsTo('node').id(); 49 } 50 }