ui: Add detailed Health Checks to Service Detail page (#8111)

This commit is contained in:
Kenia 2020-06-16 11:59:31 -04:00 committed by hashicorp-ci
parent c16f5e8fa7
commit 9fcad3e0c3
3 changed files with 65 additions and 13 deletions

View File

@ -10,16 +10,56 @@
<ExternalSource /> <ExternalSource />
</li> </li>
</ConsulExternalSource> </ConsulExternalSource>
{{#with (reject-by 'ServiceID' '' item.Checks) as |checks|}} {{#let (reject-by 'ServiceID' '' item.Checks) as |checks|}}
<li class={{service/instance-checks checks}}> {{#let (service/instance-checks checks) as |serviceCheck| }}
{{checks.length}} service checks {{#if (eq serviceCheck.status 'empty') }}
<li class={{serviceCheck.status}}>
No service checks
</li> </li>
{{/with}} {{else}}
{{#with (filter-by 'ServiceID' '' item.Checks) as |checks|}} {{#if (eq serviceCheck.count checks.length)}}
<li class={{service/instance-checks checks}}> {{#if (eq serviceCheck.status 'warning') }}
{{checks.length}} node checks <li class={{serviceCheck.status}}>
All service checks with {{serviceCheck.status}}
</li> </li>
{{/with}} {{else}}
<li class={{serviceCheck.status}}>
All service checks {{serviceCheck.status}}
</li>
{{/if}}
{{else}}
<li class={{serviceCheck.status}}>
{{serviceCheck.count}}/{{checks.length}} service checks {{serviceCheck.status}}
</li>
{{/if}}
{{/if}}
{{/let}}
{{/let}}
{{#let (filter-by 'ServiceID' '' item.Checks) as |checks|}}
{{#let (service/instance-checks checks) as |nodeCheck| }}
{{#if (eq nodeCheck.status 'empty') }}
<li class={{nodeCheck.status}}>
No node checks
</li>
{{else}}
{{#if (eq nodeCheck.count checks.length)}}
{{#if (eq nodeCheck.status 'warning') }}
<li class={{nodeCheck.status}}>
All node checks with {{nodeCheck.status}}
</li>
{{else}}
<li class={{nodeCheck.status}}>
All node checks {{nodeCheck.status}}
</li>
{{/if}}
{{else}}
<li class={{nodeCheck.status}}>
{{nodeCheck.count}}/{{checks.length}} node checks {{nodeCheck.status}}
</li>
{{/if}}
{{/if}}
{{/let}}
{{/let}}
{{#if (get proxies item.Service.ID)}} {{#if (get proxies item.Service.ID)}}
<li class="proxy"> <li class="proxy">
connected with proxy connected with proxy

View File

@ -23,13 +23,24 @@ export function healthChecks([items], hash) {
switch (true) { switch (true) {
case ChecksCritical !== 0: case ChecksCritical !== 0:
return 'critical'; return {
status: 'failing',
count: ChecksCritical,
};
case ChecksWarning !== 0: case ChecksWarning !== 0:
return 'warning'; return {
status: 'warning',
count: ChecksWarning,
};
case ChecksPassing !== 0: case ChecksPassing !== 0:
return 'passing'; return {
status: 'passing',
count: ChecksPassing,
};
default: default:
return 'empty'; return {
status: 'empty',
};
} }
} }

View File

@ -27,7 +27,8 @@
@extend %with-alert-triangle-color-mask, %as-pseudo; @extend %with-alert-triangle-color-mask, %as-pseudo;
background-color: $orange-500; background-color: $orange-500;
} }
%composite-row .critical::before { %composite-row .critical::before,
%composite-row .failing::before {
@extend %with-cancel-square-fill-color-mask, %as-pseudo; @extend %with-cancel-square-fill-color-mask, %as-pseudo;
background-color: $red-500; background-color: $red-500;
} }