open-nomad/ui/app/models/node-driver.js

27 lines
897 B
JavaScript
Raw Normal View History

import Fragment from 'ember-data-model-fragments/fragment';
import { computed, get } from '@ember/object';
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'),
attributesShort: computed('name', 'attributes.attributesStructured', function() {
const attributes = this.get('attributes.attributesStructured');
2019-03-26 07:46:44 +00:00
return get(attributes, `driver.${this.name}`);
}),
name: attr('string'),
detected: attr('boolean', { defaultValue: false }),
healthy: attr('boolean', { defaultValue: false }),
healthDescription: attr('string'),
updateTime: attr('date'),
healthClass: computed('healthy', function() {
2019-03-26 07:46:44 +00:00
return this.healthy ? 'running' : 'failed';
}),
});