github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/models/node-driver.js (about) 1 import classic from 'ember-classic-decorator'; 2 import Fragment from 'ember-data-model-fragments/fragment'; 3 import { get, computed } from '@ember/object'; 4 import { attr } from '@ember-data/model'; 5 import { fragmentOwner } from 'ember-data-model-fragments/attributes'; 6 import { fragment } from 'ember-data-model-fragments/attributes'; 7 8 @classic 9 export default class NodeDriver extends Fragment { 10 @fragmentOwner() node; 11 12 @fragment('structured-attributes') attributes; 13 14 @computed('name', 'attributes.structured') 15 get attributesShort() { 16 const attributes = this.get('attributes.structured'); 17 return get(attributes, `driver.${this.name}`); 18 } 19 20 @attr('string') name; 21 @attr('boolean', { defaultValue: false }) detected; 22 @attr('boolean', { defaultValue: false }) healthy; 23 @attr('string') healthDescription; 24 @attr('date') updateTime; 25 26 @computed('healthy') 27 get healthClass() { 28 return this.healthy ? 'running' : 'failed'; 29 } 30 }