2020-12-07 09:14:30 +00:00
|
|
|
import Fragment from 'ember-data-model-fragments/fragment';
|
|
|
|
import { array } from 'ember-data-model-fragments/attributes';
|
|
|
|
import { attr } from '@ember-data/model';
|
|
|
|
import { computed } from '@ember/object';
|
2021-05-13 10:36:51 +00:00
|
|
|
import { replace, nullValue } from 'consul-ui/decorators/replace';
|
2020-12-07 09:14:30 +00:00
|
|
|
|
|
|
|
export const schema = {
|
|
|
|
Status: {
|
|
|
|
allowedValues: ['passing', 'warning', 'critical'],
|
|
|
|
},
|
|
|
|
Type: {
|
2021-05-13 10:36:51 +00:00
|
|
|
allowedValues: ['serf', 'script', 'http', 'tcp', 'ttl', 'docker', 'grpc', 'alias'],
|
2020-12-07 09:14:30 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default class HealthCheck extends Fragment {
|
|
|
|
@attr('string') Name;
|
|
|
|
@attr('string') CheckID;
|
2021-05-13 10:36:51 +00:00
|
|
|
// an empty Type means its the Consul serf Check
|
|
|
|
@replace('', 'serf') @attr('string') Type;
|
2020-12-07 09:14:30 +00:00
|
|
|
@attr('string') Status;
|
|
|
|
@attr('string') Notes;
|
|
|
|
@attr('string') Output;
|
|
|
|
@attr('string') ServiceName;
|
|
|
|
@attr('string') ServiceID;
|
|
|
|
@attr('string') Node;
|
2021-05-13 10:36:51 +00:00
|
|
|
@nullValue([]) @array('string') ServiceTags;
|
2020-12-07 09:14:30 +00:00
|
|
|
@attr() Definition; // {}
|
|
|
|
|
|
|
|
// Exposed is only set correct if this Check is accessed via instance.MeshChecks
|
|
|
|
// essentially this is a lazy MeshHealthCheckModel
|
|
|
|
@attr('boolean') Exposed;
|
|
|
|
|
|
|
|
@computed('ServiceID')
|
|
|
|
get Kind() {
|
|
|
|
return this.ServiceID === '' ? 'node' : 'service';
|
|
|
|
}
|
|
|
|
|
|
|
|
@computed('Type')
|
|
|
|
get Exposable() {
|
|
|
|
return ['http', 'grpc'].includes(this.Type);
|
|
|
|
}
|
|
|
|
}
|