49 lines
1.3 KiB
Handlebars
49 lines
1.3 KiB
Handlebars
{{#let
|
|
(group-by "Status" (or @items (array)))
|
|
as |grouped|}}
|
|
{{! Check the status of each Status of checks in order }}
|
|
{{! First one to have more than one check wins }}
|
|
{{! Otherwise we are empty }}
|
|
{{#let
|
|
(or
|
|
(if (gt grouped.critical.length 0) grouped.critical)
|
|
(if (gt grouped.warning.length 0) grouped.warning)
|
|
(if (gt grouped.passing.length 0) grouped.passing)
|
|
(array)
|
|
)
|
|
as |checks|}}
|
|
{{#let
|
|
checks.firstObject.Status
|
|
as |status|}}
|
|
<dl
|
|
class={{class-map
|
|
'consul-instance-checks'
|
|
(array 'empty' (eq checks.length 0))
|
|
(array status (not-eq checks.length 0))
|
|
}}
|
|
...attributes
|
|
>
|
|
<dt>
|
|
<Tooltip>
|
|
{{capitalize @type}} Checks
|
|
</Tooltip>
|
|
</dt>
|
|
{{#let
|
|
(or
|
|
(if (eq status 'critical') 'failing')
|
|
(if (eq status 'warning') 'with a warning')
|
|
status
|
|
)
|
|
as |humanized|}}
|
|
<dd>
|
|
{{or
|
|
(if (eq checks.length 0) (concat 'No ' @type ' checks'))
|
|
(if (eq checks.length @items.length) (concat 'All ' @type ' checks ' humanized))
|
|
(concat checks.length '/' @items.length ' ' @type ' checks ' humanized)
|
|
}}
|
|
</dd>
|
|
{{/let}}
|
|
</dl>
|
|
{{/let}}
|
|
{{/let}}
|
|
{{/let}} |