2020-06-10 13:49:16 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2018-05-08 16:39:27 +00:00
|
|
|
import Fragment from 'ember-data-model-fragments/fragment';
|
2020-06-10 13:49:16 +00:00
|
|
|
import { get, computed } 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';
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
|
|
|
export default class NodeDriver extends Fragment {
|
|
|
|
@fragmentOwner() node;
|
2018-05-08 16:39:27 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@fragment('node-attributes') attributes;
|
2018-05-13 03:22:45 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('name', 'attributes.attributesStructured')
|
|
|
|
get attributesShort() {
|
2018-05-13 03:22:45 +00:00
|
|
|
const attributes = this.get('attributes.attributesStructured');
|
2019-03-26 07:46:44 +00:00
|
|
|
return get(attributes, `driver.${this.name}`);
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2018-05-13 03:22:45 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@attr('string') name;
|
|
|
|
@attr('boolean', { defaultValue: false }) detected;
|
|
|
|
@attr('boolean', { defaultValue: false }) healthy;
|
|
|
|
@attr('string') healthDescription;
|
|
|
|
@attr('date') updateTime;
|
2018-05-09 01:09:20 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('healthy')
|
|
|
|
get healthClass() {
|
2019-03-26 07:46:44 +00:00
|
|
|
return this.healthy ? 'running' : 'failed';
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|