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';
|
2021-02-17 21:01:44 +00:00
|
|
|
import { attr } from '@ember-data/model';
|
2018-05-08 16:39:27 +00:00
|
|
|
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
|
|
|
|
2021-10-12 20:36:10 +00:00
|
|
|
@fragment('structured-attributes') attributes;
|
2018-05-13 03:22:45 +00:00
|
|
|
|
2021-10-12 20:36:10 +00:00
|
|
|
@computed('name', 'attributes.structured')
|
2020-06-10 13:49:16 +00:00
|
|
|
get attributesShort() {
|
2021-10-12 20:36:10 +00:00
|
|
|
const attributes = this.get('attributes.structured');
|
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
|
|
|
}
|
|
|
|
}
|