From 45f06149d49cc459da164ba95071fa802657aa6f Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Tue, 11 Oct 2022 16:53:09 +0200 Subject: [PATCH] Always transition to imported peers.edit --- .../app/controllers/dc/peers/edit/index.js | 8 +- .../app/templates/dc/peers/edit/exported.hbs | 1 + .../app/templates/dc/peers/edit/imported.hbs | 1 + .../app/templates/dc/peers/edit/index.hbs | 2 +- .../components/consul/service/list/index.hbs | 184 ++++++++++-------- .../app/components/icon-definition/index.scss | 5 + .../consul-ui/app/services/repository/peer.js | 22 ++- 7 files changed, 123 insertions(+), 100 deletions(-) diff --git a/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js b/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js index d262ef02be..0f4af5e828 100644 --- a/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js +++ b/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js @@ -5,11 +5,7 @@ import { action } from "@ember/object"; export default class DcPeersEditIndexController extends Controller { @service router; - @action transitionToStartSubRouteByType(peerModel) { - if (peerModel.isDialer) { - this.router.replaceWith("dc.peers.edit.exported"); - } else { - this.router.replaceWith("dc.peers.edit.imported"); - } + @action transitionToImported() { + this.router.replaceWith("dc.peers.edit.imported"); } } diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs index a525b841fe..246097f772 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs @@ -31,6 +31,7 @@ @type="search" @value={{this.search}} placeholder="Search" + class="rounded-sm border-hds-border-faint" {{on "input" (pick "target.value" this.updateSearch)}} /> diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/edit/imported.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/edit/imported.hbs index ebed120b43..1c2d11d5ee 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/edit/imported.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/edit/imported.hbs @@ -76,6 +76,7 @@ diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs index 75042b4395..25acb7e4c2 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs @@ -1,3 +1,3 @@ - {{did-insert (fn this.transitionToStartSubRouteByType route.model.peer)}} + {{did-insert this.transitionToImported}} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/service/list/index.hbs b/ui/packages/consul-ui/app/components/consul/service/list/index.hbs index a97184b984..773af36154 100644 --- a/ui/packages/consul-ui/app/components/consul/service/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service/list/index.hbs @@ -1,97 +1,111 @@ - -
-
- Health -
-
- - {{#if (eq 'critical' item.MeshStatus)}} - At least one health check on one instance is failing. - {{else if (eq 'warning' item.MeshStatus)}} - At least one health check on one instance has a warning. - {{else if (eq 'passing' item.MeshStatus)}} - All health checks are passing. - {{else}} - There are no health checks. - {{/if}} - -
-
-{{#if (gt item.InstanceCount 0)}} - + {{#let + (eq @peer.State 'FAILING') + (and @peer (eq item.InstanceCount 0)) + as |peerIsFailing peeredAndInstanceCountZero| }} - > - {{item.Name}} - -{{else}} -

- {{item.Name}} -

-{{/if}} +
+
+ Health +
+
+ + {{#if peerIsFailing}} + This peer is out of sync, so the current health statuses of its services are unknown. + {{else if peeredAndInstanceCountZero}} + This service currently has 0 instances. Check with the operator of its peer to make + sure this is expected behavior. + {{else if (eq 'critical' item.MeshStatus)}} + At least one health check on one instance is failing. + {{else if (eq 'warning' item.MeshStatus)}} + At least one health check on one instance has a warning. + {{else if (eq 'passing' item.MeshStatus)}} + All health checks are passing. + {{else}} + There are no health checks. + {{/if}} + +
+
+ {{/let}} + {{#if (gt item.InstanceCount 0)}} + + {{item.Name}} + + {{else}} +

+ {{item.Name}} +

+ {{/if}}
- + - {{#if (and (not-eq item.InstanceCount 0) (and (not-eq item.Kind 'terminating-gateway') (not-eq item.Kind 'ingress-gateway'))) }} - - {{format-number item.InstanceCount}} {{pluralize item.InstanceCount 'instance' without-count=true}} - - {{/if}} - - {{#if (eq item.Kind 'terminating-gateway')}} - - {{format-number item.GatewayConfig.AssociatedServiceCount}} {{pluralize item.GatewayConfig.AssociatedServiceCount 'linked service' without-count=true}} - - {{else if (eq item.Kind 'ingress-gateway')}} - - {{format-number item.GatewayConfig.AssociatedServiceCount}} {{pluralize item.GatewayConfig.AssociatedServiceCount 'upstream' without-count=true}} - - {{/if}} - {{#if (or item.ConnectedWithGateway item.ConnectedWithProxy)}} -
-
- - This service uses a proxy for the Consul service mesh - -
- {{#if (and item.ConnectedWithGateway item.ConnectedWithProxy )}} -
- in service mesh with proxy and gateway -
- {{else if item.ConnectedWithProxy}} -
- in service mesh with proxy -
- {{else if item.ConnectedWithGateway}} -
- in service mesh with gateway -
- {{/if}} -
- {{/if}} + {{#if + (and + (not-eq item.InstanceCount 0) + (and (not-eq item.Kind 'terminating-gateway') (not-eq item.Kind 'ingress-gateway')) + ) + }} + + {{format-number item.InstanceCount}} + {{pluralize item.InstanceCount 'instance' without-count=true}} + + {{/if}} + {{#unless @peer}} + + {{/unless}} + {{#if (eq item.Kind 'terminating-gateway')}} + + {{format-number item.GatewayConfig.AssociatedServiceCount}} + {{pluralize item.GatewayConfig.AssociatedServiceCount 'linked service' without-count=true}} + + {{else if (eq item.Kind 'ingress-gateway')}} + + {{format-number item.GatewayConfig.AssociatedServiceCount}} + {{pluralize item.GatewayConfig.AssociatedServiceCount 'upstream' without-count=true}} + + {{/if}} + {{#if (or item.ConnectedWithGateway item.ConnectedWithProxy)}} +
+
+ + This service uses a proxy for the Consul service mesh + +
+ {{#if (and item.ConnectedWithGateway item.ConnectedWithProxy)}} +
+ in service mesh with proxy and gateway +
+ {{else if item.ConnectedWithProxy}} +
+ in service mesh with proxy +
+ {{else if item.ConnectedWithGateway}} +
+ in service mesh with gateway +
+ {{/if}} +
+ {{/if}}
\ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/icon-definition/index.scss b/ui/packages/consul-ui/app/components/icon-definition/index.scss index 9595850e50..d8d9dda77b 100644 --- a/ui/packages/consul-ui/app/components/icon-definition/index.scss +++ b/ui/packages/consul-ui/app/components/icon-definition/index.scss @@ -25,6 +25,11 @@ @extend %with-minus-square-fill-mask, %as-pseudo; color: rgb(var(--tone-gray-500)); } +%icon-definition.empty dt::before, +%composite-row-header .help dd::before { + @extend %with-help-circle-outline-mask, %as-pseudo; + color: rgb(var(--tone-gray-500)); +} %composite-row-header [rel='me'] dd::before { @extend %with-check-circle-fill-mask, %as-pseudo; diff --git a/ui/packages/consul-ui/app/services/repository/peer.js b/ui/packages/consul-ui/app/services/repository/peer.js index 838de8fb1e..c39accbb51 100644 --- a/ui/packages/consul-ui/app/services/repository/peer.js +++ b/ui/packages/consul-ui/app/services/repository/peer.js @@ -107,16 +107,22 @@ export default class PeerService extends RepositoryService { }} ` )((headers, body, cache) => { + // we can't easily use fragments as we are working around the serializer + // layer const { StreamStatus } = body; - if (StreamStatus.LastHeartbeat) { - StreamStatus.LastHeartbeat = new Date(StreamStatus.LastHeartbeat); - } - if (StreamStatus.LastReceive) { - StreamStatus.LastReceive = new Date(StreamStatus.LastReceive); - } - if (StreamStatus.LastSend) { - StreamStatus.LastSend = new Date(StreamStatus.LastSend); + + if (StreamStatus) { + if (StreamStatus.LastHeartbeat) { + StreamStatus.LastHeartbeat = new Date(StreamStatus.LastHeartbeat); + } + if (StreamStatus.LastReceive) { + StreamStatus.LastReceive = new Date(StreamStatus.LastReceive); + } + if (StreamStatus.LastSend) { + StreamStatus.LastSend = new Date(StreamStatus.LastSend); + } } + return { meta: { version: 2,