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

View File

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

View File

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