ui: Update helper to return Proxy and Service Health if the Service has a Proxy (#8168)
This commit is contained in:
parent
ed8d148502
commit
6bc1b2be44
|
@ -1,17 +1,16 @@
|
|||
{{#if (gt items.length 0)}}
|
||||
<ListCollection @items={{items}} class="consul-service-list" as |item index|>
|
||||
<BlockSlot @name="header">
|
||||
<dl class={{service/health-checks item}}>
|
||||
<dt>
|
||||
Health
|
||||
</dt>
|
||||
{{#let (get proxies item.Name) as |proxy|}}
|
||||
{{#let (service/health-checks item proxy) as |health|}}
|
||||
<dl class={{health}}>
|
||||
<dd>
|
||||
<Tooltip @position="top-start">
|
||||
{{#if (eq 'critical' (service/health-checks item))}}
|
||||
{{#if (eq 'critical' health)}}
|
||||
At least one health check on one instance is failing.
|
||||
{{else if (eq 'warning' (service/health-checks item))}}
|
||||
{{else if (eq 'warning' health)}}
|
||||
At least one health check on one instance has a warning.
|
||||
{{else if (eq 'passing' (service/health-checks item))}}
|
||||
{{else if (eq 'passing' health)}}
|
||||
All health checks are passing.
|
||||
{{else}}
|
||||
There are no health checks.
|
||||
|
@ -19,6 +18,8 @@
|
|||
</Tooltip>
|
||||
</dd>
|
||||
</dl>
|
||||
{{/let}}
|
||||
{{/let}}
|
||||
{{#if (eq item.Kind 'terminating-gateway')}}
|
||||
<a data-test-service-name href={{href-to "dc.services.show.services" item.Name}}>
|
||||
{{item.Name}}
|
||||
|
|
|
@ -24,7 +24,7 @@ export default Controller.extend({
|
|||
// used by more than one service
|
||||
if (item.ProxyFor) {
|
||||
item.ProxyFor.forEach(service => {
|
||||
proxies[service] = true;
|
||||
proxies[service] = item;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
import { helper } from '@ember/component/helper';
|
||||
|
||||
export function healthChecks([item], hash) {
|
||||
export function healthChecks(
|
||||
[item, proxy = { ChecksCritical: 0, ChecksWarning: 0, ChecksPassing: 0 }],
|
||||
hash
|
||||
) {
|
||||
switch (true) {
|
||||
case item.ChecksCritical !== 0:
|
||||
case item.ChecksCritical !== 0 || proxy.ChecksCritical !== 0:
|
||||
return 'critical';
|
||||
case item.ChecksWarning !== 0:
|
||||
case item.ChecksWarning !== 0 || proxy.ChecksWarning !== 0:
|
||||
return 'warning';
|
||||
case item.ChecksPassing !== 0:
|
||||
case item.ChecksPassing !== 0 || proxy.ChecksPassing !== 0:
|
||||
return 'passing';
|
||||
default:
|
||||
return 'empty';
|
||||
|
|
Loading…
Reference in New Issue