From c1b4e33deedbf8bf4cba0952da25e9dda7ad8895 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Fri, 11 Feb 2022 09:52:27 +0000 Subject: [PATCH] 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 --- .changelog/12248.txt | 3 ++ .../app/components/consul/node/list/index.hbs | 2 +- ui/packages/consul-ui/app/models/node.js | 16 +++++----- .../tests/acceptance/dc/nodes/index.feature | 30 +++++++++++++++++++ .../tests/acceptance/dc/nodes/sorting.feature | 6 ++++ .../consul-ui/tests/pages/dc/nodes/index.js | 1 + 6 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 .changelog/12248.txt diff --git a/.changelog/12248.txt b/.changelog/12248.txt new file mode 100644 index 0000000000..cfa3077bec --- /dev/null +++ b/.changelog/12248.txt @@ -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. +``` diff --git a/ui/packages/consul-ui/app/components/consul/node/list/index.hbs b/ui/packages/consul-ui/app/components/consul/node/list/index.hbs index b4ff074252..2fd449b120 100644 --- a/ui/packages/consul-ui/app/components/consul/node/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/node/list/index.hbs @@ -3,7 +3,7 @@ @items={{@items}} as |item index|> -
+
Health
diff --git a/ui/packages/consul-ui/app/models/node.js b/ui/packages/consul-ui/app/models/node.js index a403291cfe..1d5787ea75 100644 --- a/ui/packages/consul-ui/app/models/node.js +++ b/ui/packages/consul-ui/app/models/node.js @@ -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; } } diff --git a/ui/packages/consul-ui/tests/acceptance/dc/nodes/index.feature b/ui/packages/consul-ui/tests/acceptance/dc/nodes/index.feature index 59158038b2..8bcd61f2ed 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/nodes/index.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/nodes/index.feature @@ -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 diff --git a/ui/packages/consul-ui/tests/acceptance/dc/nodes/sorting.feature b/ui/packages/consul-ui/tests/acceptance/dc/nodes/sorting.feature index dc09fec40c..452a2eeea5 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/nodes/sorting.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/nodes/sorting.feature @@ -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 --- diff --git a/ui/packages/consul-ui/tests/pages/dc/nodes/index.js b/ui/packages/consul-ui/tests/pages/dc/nodes/index.js index 81aabe3ff2..b4a4308cf1 100644 --- a/ui/packages/consul-ui/tests/pages/dc/nodes/index.js +++ b/ui/packages/consul-ui/tests/pages/dc/nodes/index.js @@ -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'),