2020-10-14 08:03:39 +00:00
|
|
|
import Component from '@glimmer/component';
|
2020-07-01 14:27:29 +00:00
|
|
|
|
2020-10-14 08:03:39 +00:00
|
|
|
export default class ConsulInstanceChecks extends Component {
|
|
|
|
get healthCheck() {
|
2020-07-01 14:27:29 +00:00
|
|
|
let ChecksCritical = 0;
|
|
|
|
let ChecksWarning = 0;
|
|
|
|
let ChecksPassing = 0;
|
|
|
|
|
2020-10-14 08:03:39 +00:00
|
|
|
this.args.items.forEach(item => {
|
2020-07-01 14:27:29 +00:00
|
|
|
switch (item.Status) {
|
|
|
|
case 'critical':
|
|
|
|
ChecksCritical += 1;
|
|
|
|
break;
|
|
|
|
case 'warning':
|
|
|
|
ChecksWarning += 1;
|
|
|
|
break;
|
|
|
|
case 'passing':
|
|
|
|
ChecksPassing += 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
switch (true) {
|
|
|
|
case ChecksCritical !== 0:
|
|
|
|
return {
|
|
|
|
check: 'critical',
|
|
|
|
status: 'failing',
|
|
|
|
count: ChecksCritical,
|
|
|
|
};
|
|
|
|
case ChecksWarning !== 0:
|
|
|
|
return {
|
|
|
|
check: 'warning',
|
|
|
|
status: 'with warning',
|
|
|
|
count: ChecksWarning,
|
|
|
|
};
|
|
|
|
case ChecksPassing !== 0:
|
|
|
|
return {
|
|
|
|
check: 'passing',
|
|
|
|
status: 'passing',
|
|
|
|
count: ChecksPassing,
|
|
|
|
};
|
|
|
|
default:
|
|
|
|
return {
|
|
|
|
check: 'empty',
|
|
|
|
};
|
|
|
|
}
|
2020-10-14 08:03:39 +00:00
|
|
|
}
|
|
|
|
}
|