From 23adad684b7d10542b174656fd204459d7c04859 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 7 Dec 2020 09:14:30 +0000 Subject: [PATCH] ui: HealthCheck Search/Sort/Filtering (#9314) * Adds model layer changes around HealthChecks 1. Makes a HealthCheck model fragment and uses it in ServiceInstances and Nodes 2. Manually adds a relationship between a ServiceInstance and its potential ServiceInstanceProxy 3. Misc changes related to the above such as an Exposed property on MeshChecks, MeshChecks itself * Add a potential temporary endpoint to distinguish ProxyServiceInstance * Fix up Node search bar class * Add search/sort/filter logic * Fixup Service default sort key * Add Healthcheck search/sort/filtering * Tweak CSS add a default Type of 'Serf' when type is blank * Fix up tests and new test support * Add ability to search on Service/Node name depending on where you are * Fixup CheckID search predicate * Use computed for DataCollection to use caching * Alpha sort the Type menu * Temporary fix for new non-changing style Ember Proxys * Only special case EventSource proxies --- .../consul/health-check/list/index.hbs | 8 +- .../consul/health-check/list/layout.scss | 1 + .../consul/health-check/list/pageobject.js | 10 ++ .../consul/health-check/search-bar/index.hbs | 140 ++++++++++++++++++ .../consul/node/search-bar/index.hbs | 2 +- .../app/components/data-collection/index.js | 22 ++- .../app/filter/predicates/health-check.js | 21 +++ .../consul-ui/app/models/health-check.js | 41 +++++ ui/packages/consul-ui/app/models/node.js | 3 +- ui/packages/consul-ui/app/models/proxy.js | 3 +- .../consul-ui/app/models/service-instance.js | 36 ++++- .../app/routes/dc/nodes/show/healthchecks.js | 20 ++- .../app/routes/dc/services/instance.js | 2 +- .../dc/services/instance/healthchecks.js | 20 ++- .../app/search/predicates/health-check.js | 32 ++++ .../services/data-source/protocols/http.js | 8 + ui/packages/consul-ui/app/services/filter.js | 2 + .../services/repository/service-instance.js | 31 +++- ui/packages/consul-ui/app/services/search.js | 2 + ui/packages/consul-ui/app/services/sort.js | 4 +- .../comparators/{check.js => health-check.js} | 4 +- .../consul-ui/app/sort/comparators/service.js | 2 +- ui/packages/consul-ui/app/styles/layout.scss | 3 +- .../templates/dc/nodes/show/healthchecks.hbs | 73 +++++++-- .../dc/services/instance/healthchecks.hbs | 72 ++++++--- .../services/repository/node-test.js | 34 +---- ui/packages/consul-ui/tests/pages.js | 26 +++- .../consul-ui/tests/pages/dc/nodes/show.js | 15 +- .../tests/pages/dc/services/instance.js | 15 +- 29 files changed, 558 insertions(+), 94 deletions(-) create mode 100644 ui/packages/consul-ui/app/components/consul/health-check/list/pageobject.js create mode 100644 ui/packages/consul-ui/app/components/consul/health-check/search-bar/index.hbs create mode 100644 ui/packages/consul-ui/app/filter/predicates/health-check.js create mode 100644 ui/packages/consul-ui/app/models/health-check.js create mode 100644 ui/packages/consul-ui/app/search/predicates/health-check.js rename ui/packages/consul-ui/app/sort/comparators/{check.js => health-check.js} (91%) diff --git a/ui/packages/consul-ui/app/components/consul/health-check/list/index.hbs b/ui/packages/consul-ui/app/components/consul/health-check/list/index.hbs index 0c5fd6309..b196029f5 100644 --- a/ui/packages/consul-ui/app/components/consul/health-check/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/health-check/list/index.hbs @@ -10,7 +10,7 @@

{{item.Name}}

- {{#if (eq item.ServiceName "")}} + {{#if (eq item.Kind "node")}}
NodeName
{{item.Node}}
{{else}} @@ -24,9 +24,9 @@
Type
-
- {{item.Type}} - {{#if (and @exposed (contains item.Type (array 'http' 'grpc')))}} +
+ {{or item.Type 'serf'}} + {{#if item.Exposed}} (scope = '.consul-health-check-list') => { + return { + scope, + item: collection('li', { + name: text('header h3'), + type: text('[data-health-check-type]'), + exposed: text('[data-test-exposed]'), + }), + }; +}; diff --git a/ui/packages/consul-ui/app/components/consul/health-check/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/health-check/search-bar/index.hbs new file mode 100644 index 000000000..abf590933 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/health-check/search-bar/index.hbs @@ -0,0 +1,140 @@ + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs index eb377d583..c87fec9e4 100644 --- a/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs @@ -1,5 +1,5 @@