ui: Refactor detailed health checks to use more of the service/instance-checks helper (#8119)

This commit is contained in:
Kenia 2020-06-16 12:33:11 -04:00 committed by GitHub
parent 44d79ddde6
commit fe784f6f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 26 deletions

View File

@ -12,23 +12,17 @@
</ConsulExternalSource> </ConsulExternalSource>
{{#let (reject-by 'ServiceID' '' item.Checks) as |checks|}} {{#let (reject-by 'ServiceID' '' item.Checks) as |checks|}}
{{#let (service/instance-checks checks) as |serviceCheck| }} {{#let (service/instance-checks checks) as |serviceCheck| }}
{{#if (eq serviceCheck.status 'empty') }} {{#if (eq serviceCheck.check 'empty') }}
<li class={{serviceCheck.status}}> <li class={{serviceCheck.check}}>
No service checks No service checks
</li> </li>
{{else}} {{else}}
{{#if (eq serviceCheck.count checks.length)}} {{#if (eq serviceCheck.count checks.length)}}
{{#if (eq serviceCheck.status 'warning') }} <li class={{serviceCheck.check}}>
<li class={{serviceCheck.status}}>
All service checks with {{serviceCheck.status}}
</li>
{{else}}
<li class={{serviceCheck.status}}>
All service checks {{serviceCheck.status}} All service checks {{serviceCheck.status}}
</li> </li>
{{/if}}
{{else}} {{else}}
<li class={{serviceCheck.status}}> <li class={{serviceCheck.check}}>
{{serviceCheck.count}}/{{checks.length}} service checks {{serviceCheck.status}} {{serviceCheck.count}}/{{checks.length}} service checks {{serviceCheck.status}}
</li> </li>
{{/if}} {{/if}}
@ -37,23 +31,17 @@
{{/let}} {{/let}}
{{#let (filter-by 'ServiceID' '' item.Checks) as |checks|}} {{#let (filter-by 'ServiceID' '' item.Checks) as |checks|}}
{{#let (service/instance-checks checks) as |nodeCheck| }} {{#let (service/instance-checks checks) as |nodeCheck| }}
{{#if (eq nodeCheck.status 'empty') }} {{#if (eq nodeCheck.check 'empty') }}
<li class={{nodeCheck.status}}> <li class={{nodeCheck.check}}>
No node checks No node checks
</li> </li>
{{else}} {{else}}
{{#if (eq nodeCheck.count checks.length)}} {{#if (eq nodeCheck.count checks.length)}}
{{#if (eq nodeCheck.status 'warning') }} <li class={{nodeCheck.check}}>
<li class={{nodeCheck.status}}>
All node checks with {{nodeCheck.status}}
</li>
{{else}}
<li class={{nodeCheck.status}}>
All node checks {{nodeCheck.status}} All node checks {{nodeCheck.status}}
</li> </li>
{{/if}}
{{else}} {{else}}
<li class={{nodeCheck.status}}> <li class={{nodeCheck.check}}>
{{nodeCheck.count}}/{{checks.length}} node checks {{nodeCheck.status}} {{nodeCheck.count}}/{{checks.length}} node checks {{nodeCheck.status}}
</li> </li>
{{/if}} {{/if}}

View File

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

View File

@ -27,8 +27,7 @@
@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;
} }