2018-05-08 16:39:27 +00:00
|
|
|
import Fragment from 'ember-data-model-fragments/fragment';
|
2018-05-13 03:22:45 +00:00
|
|
|
import { computed, get } from '@ember/object';
|
2018-05-08 16:39:27 +00:00
|
|
|
import attr from 'ember-data/attr';
|
|
|
|
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
|
|
|
|
import { fragment } from 'ember-data-model-fragments/attributes';
|
|
|
|
|
|
|
|
export default Fragment.extend({
|
|
|
|
node: fragmentOwner(),
|
|
|
|
|
|
|
|
attributes: fragment('node-attributes'),
|
2018-05-13 03:22:45 +00:00
|
|
|
|
|
|
|
attributesShort: computed('name', 'attributes.attributesStructured', function() {
|
|
|
|
const attributes = this.get('attributes.attributesStructured');
|
|
|
|
return get(attributes, `driver.${this.get('name')}`);
|
|
|
|
}),
|
|
|
|
|
2018-05-08 16:39:27 +00:00
|
|
|
name: attr('string'),
|
|
|
|
detected: attr('boolean', { defaultValue: false }),
|
|
|
|
healthy: attr('boolean', { defaultValue: false }),
|
|
|
|
healthDescription: attr('string'),
|
|
|
|
updateTime: attr('date'),
|
2018-05-09 01:09:20 +00:00
|
|
|
|
|
|
|
healthClass: computed('healthy', function() {
|
|
|
|
return this.get('healthy') ? 'running' : 'failed';
|
|
|
|
}),
|
2018-05-08 16:39:27 +00:00
|
|
|
});
|