github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/models/scale-event.js (about) 1 import { computed } from '@ember/object'; 2 import Fragment from 'ember-data-model-fragments/fragment'; 3 import { attr } from '@ember-data/model'; 4 import { fragmentOwner } from 'ember-data-model-fragments/attributes'; 5 6 export default class ScaleEvent extends Fragment { 7 @fragmentOwner() taskGroupScale; 8 9 @attr('number') count; 10 @attr('number') previousCount; 11 @attr('boolean') error; 12 @attr('string') evalId; 13 14 @computed('count', function () { 15 return this.count != null; 16 }) 17 hasCount; 18 19 @computed('count', 'previousCount', function () { 20 return this.count > this.previousCount; 21 }) 22 increased; 23 24 @attr('date') time; 25 @attr('number') timeNanos; 26 27 @attr('string') message; 28 @attr() meta; 29 30 @computed('meta', function () { 31 return Object.keys(this.meta).length > 0; 32 }) 33 hasMeta; 34 35 // Since scale events don't have proper IDs, this UID is a compromise 36 @computed('time', 'timeNanos', 'message', function () { 37 return `${+this.time}${this.timeNanos}_${this.message}`; 38 }) 39 uid; 40 }