diff --git a/.changelog/19586.txt b/.changelog/19586.txt new file mode 100644 index 0000000000..2c58b38b55 --- /dev/null +++ b/.changelog/19586.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: fix being able to view peered services from non-default namnespaces +``` diff --git a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs index 5f8dfc5b55..2e3b0f375c 100644 --- a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs +++ b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs @@ -4,7 +4,6 @@ }} {{#let @list (env "CONSUL_HCP_URL") as |SNL hcpUrl|}} - {{log hcpUrl}} {{#if (and SNL hcpUrl)}} {{t "components.hashicorp-consul.side-nav.nspaces.title"}} + {{t + "components.hashicorp-consul.side-nav.nspaces.title" + }} - {{t "components.hashicorp-consul.side-nav.partitions.title"}} + {{t + "components.hashicorp-consul.side-nav.partitions.title" + }} {{/if}} -{{/let}} +{{/let}} \ No newline at end of file diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs index c7d32b3b16..763306cb70 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/show/imported.hbs @@ -83,6 +83,7 @@ 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 2dc1b4742b..36f5467c21 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 @@ -10,85 +10,5 @@ @linkable='linkable service' as |item index| > - -
-
- Health -
-
-
- {{#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}} - {{! we are displaying imported-services - don't show bucket-list }} - {{#unless @isPeerDetail}} - - {{/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}} - -
+ diff --git a/ui/packages/consul-ui/app/components/consul/service/list/item/index.hbs b/ui/packages/consul-ui/app/components/consul/service/list/item/index.hbs new file mode 100644 index 0000000000..9f7f555ba6 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/service/list/item/index.hbs @@ -0,0 +1,82 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +}} + + +
+
+ Health +
+
+
+ {{#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}} + {{! we are displaying imported-services - don't show bucket-list }} + {{#unless @isPeerDetail}} + + {{/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/consul/service/list/item/index.js b/ui/packages/consul-ui/app/components/consul/service/list/item/index.js new file mode 100644 index 0000000000..9bc75dbd45 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/service/list/item/index.js @@ -0,0 +1,25 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Component from '@glimmer/component'; + +export default class ConsulServiceListItem extends Component { + get linkParams() { + const hash = {}; + + if (this.args.item.Partition && this.args.partition !== this.args.item.Partition) { + hash.partition = this.args.item.Partition; + hash.nspace = this.args.Namespace; + } else if (this.args.item.Namespace && this.args.nspace !== this.args.item.Namespace) { + hash.nspace = this.args.item.Namespace; + } + + if (this.args.item.PeerName) { + hash.peer = this.args.item.PeerName; + } + + return hash; + } +} diff --git a/ui/packages/consul-ui/app/locations/fsm-with-optional.js b/ui/packages/consul-ui/app/locations/fsm-with-optional.js index 9f096d18a0..f1ddec3f3c 100644 --- a/ui/packages/consul-ui/app/locations/fsm-with-optional.js +++ b/ui/packages/consul-ui/app/locations/fsm-with-optional.js @@ -149,7 +149,10 @@ export default class FSMWithOptionalLocation { url = this.getURLFrom(url) .split('/') .filter((item, i) => { - if (i < 3) { + // the max optional parameters we have is 3 (partition, namespace, peer). When we split the path + // by '/' it has a prefixed empty '' in the array. So we know we only have to check up to the 4th + // index for optional parameters. + if (i < 4) { let found = false; Object.entries(OPTIONAL).reduce((prev, [key, re]) => { const res = re.exec(item); diff --git a/ui/packages/consul-ui/app/templates/dc/services/index.hbs b/ui/packages/consul-ui/app/templates/dc/services/index.hbs index 37a73c419f..100e7c2d97 100644 --- a/ui/packages/consul-ui/app/templates/dc/services/index.hbs +++ b/ui/packages/consul-ui/app/templates/dc/services/index.hbs @@ -101,6 +101,7 @@ as |sort filters items partition nspace|}}