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