ui: Exclude Service Health from Node listing page (#12248)

This commit excludes the health of any service instances from the Node Listing page. This means that if you are viewing the Node listing page you will only see failing nodes if there are any Node Checks failing, Service Instance Health checks are no longer taken into account.

Co-authored-by: Jamie White <jamie@jgwhite.co.uk>
This commit is contained in:
John Cowen 2022-02-11 09:52:27 +00:00 committed by GitHub
parent f45bec7779
commit c6342969c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 8 deletions

3
.changelog/12248.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:enhancement
ui: Exclude Service Instance Health from Health Check reporting on the Node listing page. The health icons on each individual row now only reflect Node health.
```

View File

@ -3,7 +3,7 @@
@items={{@items}}
as |item index|>
<BlockSlot @name="header">
<dl class={{item.Status}}>
<dl data-test-status={{item.Status}} class={{item.Status}}>
<dt>
Health
</dt>

View File

@ -31,7 +31,9 @@ export default class Node extends Model {
// ProxyServiceInstances are all instances that are connect-proxies
@filter('Services', item => item.Service.Kind === 'connect-proxy') ProxyServiceInstances;
@computed('Checks.[]', 'ChecksCritical', 'ChecksPassing', 'ChecksWarning')
@filter('Checks', item => item.ServiceID === '') NodeChecks;
@computed('ChecksCritical', 'ChecksPassing', 'ChecksWarning')
get Status() {
switch (true) {
case this.ChecksCritical !== 0:
@ -45,18 +47,18 @@ export default class Node extends Model {
}
}
@computed('Checks.[]')
@computed('NodeChecks.[]')
get ChecksCritical() {
return this.Checks.filter(item => item.Status === 'critical').length;
return this.NodeChecks.filter(item => item.Status === 'critical').length;
}
@computed('Checks.[]')
@computed('NodeChecks.[]')
get ChecksPassing() {
return this.Checks.filter(item => item.Status === 'passing').length;
return this.NodeChecks.filter(item => item.Status === 'passing').length;
}
@computed('Checks.[]')
@computed('NodeChecks.[]')
get ChecksWarning() {
return this.Checks.filter(item => item.Status === 'warning').length;
return this.NodeChecks.filter(item => item.Status === 'warning').length;
}
}

View File

@ -7,6 +7,36 @@ Feature: dc / nodes / index
body: |
"211.245.86.75:8500"
---
Scenario: Viewing a node with an unhealthy NodeCheck
Given 1 node model from yaml
---
- Checks:
- Status: critical
ServiceID: ""
---
When I visit the nodes page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/nodes
Then I see 1 node models
And I see status on the nodes.0 like "critical"
Scenario: Viewing a node with an unhealthy ServiceCheck
Given 1 node model from yaml
---
- Checks:
- Status: passing
ServiceID: ""
- Status: critical
ServiceID: web
---
When I visit the nodes page for yaml
---
dc: dc-1
---
Then the url should be /dc-1/nodes
Then I see 1 node models
And I see status on the nodes.0 like "passing"
Scenario: Viewing nodes in the listing
Given 3 node models
When I visit the nodes page for yaml

View File

@ -7,21 +7,27 @@ Feature: dc / nodes / sorting
- Node: Node-A
Checks:
- Status: critical
ServiceID: ""
- Node: Node-B
Checks:
- Status: passing
ServiceID: ""
- Node: Node-C
Checks:
- Status: warning
ServiceID: ""
- Node: Node-D
Checks:
- Status: critical
ServiceID: ""
- Node: Node-E
Checks:
- Status: critical
ServiceID: ""
- Node: Node-F
Checks:
- Status: warning
ServiceID: ""
---
When I visit the nodes page for yaml
---

View File

@ -3,6 +3,7 @@ export default function(visitable, text, clickable, attribute, collection, popov
name: text('[data-test-node]'),
leader: attribute('data-test-leader', '[data-test-leader]'),
node: clickable('a'),
status: attribute('data-test-status', '[data-test-status]'),
};
return {
visit: visitable('/:dc/nodes'),