diff --git a/.changelog/11702.txt b/.changelog/11702.txt new file mode 100644 index 000000000..bd3b4f239 --- /dev/null +++ b/.changelog/11702.txt @@ -0,0 +1,3 @@ +```release-note:feature +ui: Adds basic support for showing Services exported from another partition. +``` diff --git a/ui/packages/consul-ui/app/components/consul/bucket/list/README.mdx b/ui/packages/consul-ui/app/components/consul/bucket/list/README.mdx new file mode 100644 index 000000000..939b220e8 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/bucket/list/README.mdx @@ -0,0 +1,44 @@ +# Consul::Bucket::List + +A presentational component for rendering a list of Consul 'buckets' +(a single partition and/or a single namepace). + +Please note this is not your usual "scrollable list component" more a list of +'buckets' that make up a partition / namespace combination. + +If only a the namespace is different to the currently selected namespace, then +the namespace will be displayed, whereas if the partition is different it will +show both the partition and namespace (as a namespace called 'team-1' in +`partition-1` is different to a namespace called 'team-1' in `partition-2`) + +If you don't need the nspace only support for the view you are building then +omit the `@nspace` argument. + +At the time of writing, this is not currently used across the entire UI +(specifically in intentions and maybe other areas) but eventually should be. + + +```hbs preview-template + + + +``` + +## Arguments + +| Argument/Attribute | Type | Default | Description | +| --- | --- | --- | --- | +| `item` | `array` | | A Consul object that could have both a `Partition` and a `Namespace` property | +| `nspace` | `string` | | The name of the current namespace | +| `partition` | `string` | | The name of the current partition | + +## See + +- [Template Source Code](./index.hbs) + +--- diff --git a/ui/packages/consul-ui/app/components/consul/bucket/list/index.hbs b/ui/packages/consul-ui/app/components/consul/bucket/list/index.hbs new file mode 100644 index 000000000..d9520749b --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/bucket/list/index.hbs @@ -0,0 +1,39 @@ +{{#if (and @partition (can 'use partitions'))}} + {{#if (not-eq @item.Partition @partition)}} +
+
+ Admin Partition +
+
+ {{@item.Partition}} +
+
+ Namespace +
+
+ {{@item.Namespace}} +
+
+ {{/if}} +{{else if (and @nspace (can 'use nspace'))}} + {{#if (not-eq @item.Namespace @nspace)}} +
+
+ Namespace +
+
+ {{@item.Namespace}} +
+
+ {{/if}} +{{/if}} + diff --git a/ui/packages/consul-ui/app/components/consul/bucket/list/index.scss b/ui/packages/consul-ui/app/components/consul/bucket/list/index.scss new file mode 100644 index 000000000..826ef4841 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/bucket/list/index.scss @@ -0,0 +1,26 @@ +%consul-bucket-list { + & { + @extend %horizontal-kv-list; + } + .partition::before { + @extend %with-user-team-mask, %as-pseudo; + } + .nspace::before { + @extend %with-folder-outline-mask, %as-pseudo; + } + /* potential for some sort of %composite-kv thing here */ + .partition + dd::after { + display: inline-block; + content: '/'; + margin: 0 3px; + /*TODO: In isolation this is not needed */ + margin-right: 6px; + } + .partition + dd + .nspace { + margin-left: 0 !important; + } + /**/ +} +.consul-bucket-list { + @extend %consul-bucket-list; +} diff --git a/ui/packages/consul-ui/app/components/consul/service/list/README.mdx b/ui/packages/consul-ui/app/components/consul/service/list/README.mdx new file mode 100644 index 000000000..3ffb50404 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/service/list/README.mdx @@ -0,0 +1,28 @@ +# Consul::Service::List + +A presentational component for rendering a list of Consul Services. + +```hbs preview-template + + + +``` + +## Arguments + +| Argument/Attribute | Type | Default | Description | +| --- | --- | --- | --- | +| `items` | `array` | | An array of Consul Services | +| `nspace` | `string` | | The name of the current namespace | +| `partition` | `string` | | The name of the current partition | + +## See + +- [Template Source Code](./index.hbs) + +--- 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 fd5eaa568..f7643af0f 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 @@ -25,7 +25,18 @@ {{#if (gt item.InstanceCount 0)}} - + {{item.Name}} {{else}} @@ -35,20 +46,6 @@ {{/if}} -{{#if (and nspace (env 'CONSUL_NSPACES_ENABLED'))}} - {{#if (not-eq item.Namespace nspace)}} -
-
- - Namespace - -
-
- {{item.Namespace}} -
-
- {{/if}} -{{/if}} {{#if (and (not-eq item.InstanceCount 0) (and (not-eq item.Kind 'terminating-gateway') (not-eq item.Kind 'ingress-gateway'))) }} @@ -87,6 +84,11 @@ {{/if}} {{/if}} +
\ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs index 4c487e9f3..3b300dbbc 100644 --- a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs @@ -140,11 +140,33 @@ as |key value|}} {{#let components.Optgroup components.Option as |Optgroup Option|}} +{{#let + (reject-by 'Partition' @partition @partitions) +as |nonDefaultPartitions|}} +{{#if (gt nonDefaultPartitions.length 0)}} + + {{#each @partitions as |partition|}} + + {{/each}} + +{{/if}} +{{/let}} + +{{#if (gt @sources.length 0)}} + {{#each @sources as |source|}} {{/each}} + +{{/if}} {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs index 7c605bb1b..1894bba9e 100644 --- a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs @@ -5,40 +5,26 @@