diff --git a/.changelog/10002.txt b/.changelog/10002.txt new file mode 100644 index 000000000..207daf005 --- /dev/null +++ b/.changelog/10002.txt @@ -0,0 +1,3 @@ +```ui:enhancement +Transparent Proxy - Service mesh visualization updates +``` diff --git a/ui/packages/consul-ui/app/components/consul/transparent-proxy/index.hbs b/ui/packages/consul-ui/app/components/consul/transparent-proxy/index.hbs new file mode 100644 index 000000000..0475d964f --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/transparent-proxy/index.hbs @@ -0,0 +1,3 @@ + + {{t "components.consul.transparent-proxy"}} + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/informed-action/layout.scss b/ui/packages/consul-ui/app/components/informed-action/layout.scss index 726eb31e4..b90fc6111 100644 --- a/ui/packages/consul-ui/app/components/informed-action/layout.scss +++ b/ui/packages/consul-ui/app/components/informed-action/layout.scss @@ -2,6 +2,9 @@ & { min-width: 190px; } + &.documentation { + min-width: 270px; + } > div { padding: 1rem; } diff --git a/ui/packages/consul-ui/app/components/topology-metrics/card.hbs b/ui/packages/consul-ui/app/components/topology-metrics/card/index.hbs similarity index 82% rename from ui/packages/consul-ui/app/components/topology-metrics/card.hbs rename to ui/packages/consul-ui/app/components/topology-metrics/card/index.hbs index ed392e5f5..aaae528ad 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/card.hbs +++ b/ui/packages/consul-ui/app/components/topology-metrics/card/index.hbs @@ -1,4 +1,11 @@ - +

+ {{@item.Name}} +

+
+{{else}} + {{@item.Name}}

+ {{#if (eq @item.Source 'proxy-registration')}} + + {{/if}}
{{#if (and (env 'CONSUL_NSPACES_ENABLED') (not-eq @item.Namespace @service.Namespace))}}
@@ -53,4 +63,5 @@ {{/if}}
{{yield}} -
\ No newline at end of file + +{{/if}} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/topology-metrics/card/index.scss b/ui/packages/consul-ui/app/components/topology-metrics/card/index.scss new file mode 100644 index 000000000..3567c5db7 --- /dev/null +++ b/ui/packages/consul-ui/app/components/topology-metrics/card/index.scss @@ -0,0 +1,81 @@ +#upstream-container .topology-metrics-card:not(:last-child), +#downstream-container .topology-metrics-card:not(:last-child) { + margin-bottom: 8px; +} +#upstream-container .topology-metrics-card, +#downstream-container .topology-metrics-card { + display: block; + color: $gray-700; + overflow: hidden; + background-color: $white; + border-radius: $decor-radius-100; + border: 1px solid $gray-200; + p { + padding: 12px 12px 0 12px; + font-size: $typo-size-500; + font-weight: $typo-weight-semibold; + margin-bottom: 0 !important; + } + p.empty { + padding: 12px !important; + } + div { + display: inline-flex; + dl { + display: inline-flex; + margin-right: 8px; + } + dd { + color: $gray-700; + } + span { + margin-right: 8px; + } + span::before, + dt::before { + margin-right: 4px; + } + .nspace dt::before, + .health dt::before { + margin-top: 2px; + } + .nspace dt::before { + @extend %with-folder-outline-mask, %as-pseudo; + } + .health dt::before { + @extend %with-help-circle-outline-mask, %as-pseudo; + } + .nspace dt::before { + @extend %with-folder-outline-mask, %as-pseudo; + } + .health dt::before { + @extend %with-help-circle-outline-mask, %as-pseudo; + } + .nspace dt::before, + .health dt::before { + background-color: $gray-500; + } + .passing::before { + @extend %with-check-circle-fill-color-mask, %as-pseudo; + background-color: $green-500; + } + .warning::before { + @extend %with-alert-triangle-color-mask, %as-pseudo; + background-color: $orange-500; + } + .critical::before { + @extend %with-cancel-square-fill-color-mask, %as-pseudo; + background-color: $red-500; + } + .empty::before { + @extend %with-minus-square-fill-mask, %as-pseudo; + color: $gray-500; + } + } + .details { + padding: 0 12px 12px 12px; + } + div.stats { + border-top: 1px solid $gray-200; + } +} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/topology-metrics/down-lines/index.hbs b/ui/packages/consul-ui/app/components/topology-metrics/down-lines/index.hbs index 681e799a8..e5ee6a80e 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/down-lines/index.hbs +++ b/ui/packages/consul-ui/app/components/topology-metrics/down-lines/index.hbs @@ -90,6 +90,13 @@ @item={{item}} @oncreate={{action @oncreate item @service}} /> + {{else if (and item.Intention.Allowed (not item.TransparentProxy) (eq item.Source 'specific-intention'))}} + {{/if}} {{/each}} diff --git a/ui/packages/consul-ui/app/components/topology-metrics/index.hbs b/ui/packages/consul-ui/app/components/topology-metrics/index.hbs index 43bbeac1e..72d78f584 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/index.hbs +++ b/ui/packages/consul-ui/app/components/topology-metrics/index.hbs @@ -81,15 +81,17 @@ @oncreate={{action @oncreate}} /> -{{#if (gt @topology.Upstreams.length 0)}} +{{#if (gt this.upstreams.length 0)}}
- {{#each-in (group-by "Datacenter" @topology.Upstreams) as |dc upstreams|}} + {{#each-in (group-by "Datacenter" this.upstreams) as |dc upstreams|}}
+ {{#if dc}}

{{dc}}

+ {{/if}} {{#each upstreams as |item|}}
diff --git a/ui/packages/consul-ui/app/components/topology-metrics/index.js b/ui/packages/consul-ui/app/components/topology-metrics/index.js index 3704342e5..cb19b9e82 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/index.js +++ b/ui/packages/consul-ui/app/components/topology-metrics/index.js @@ -1,6 +1,6 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; -import { action } from '@ember/object'; +import { action, get } from '@ember/object'; export default class TopologyMetrics extends Component { // =attributes @@ -66,6 +66,24 @@ export default class TopologyMetrics extends Component { }); } + get upstreams() { + const upstreams = get(this.args.topology, 'Upstreams') || []; + const items = [...upstreams]; + const defaultAllow = get(this.args.topology, 'DefaultAllow'); + const wildcardIntention = get(this.args.topology, 'WildcardIntention'); + if (defaultAllow || wildcardIntention) { + items.push({ + Name: '* (All Services)', + Datacenter: '', + Namespace: '', + Intention: { + Allowed: true, + }, + }); + } + return items; + } + // =actions @action setHeight(el, item) { @@ -89,12 +107,22 @@ export default class TopologyMetrics extends Component { // Calculate viewBox dimensions this.downView = document.getElementById('downstream-lines').getBoundingClientRect(); - this.upView = document.getElementById('upstream-lines').getBoundingClientRect(); + const upstreamLines = document.getElementById('upstream-lines').getBoundingClientRect(); + const upstreamColumn = document.getElementById('upstream-column').getBoundingClientRect(); + + this.upView = { + x: upstreamLines.x, + y: upstreamLines.y, + width: upstreamLines.width, + height: upstreamColumn.height, + }; // Get Card elements positions - const downCards = [...document.querySelectorAll('#downstream-container .card')]; + const downCards = [ + ...document.querySelectorAll('#downstream-container .topology-metrics-card'), + ]; const grafanaCard = document.querySelector('.metrics-header'); - const upCards = [...document.querySelectorAll('#upstream-column .card')]; + const upCards = [...document.querySelectorAll('#upstream-column .topology-metrics-card')]; // Set center positioning points this.centerDimensions = grafanaCard.getBoundingClientRect(); diff --git a/ui/packages/consul-ui/app/components/topology-metrics/layout.scss b/ui/packages/consul-ui/app/components/topology-metrics/layout.scss index 1bd386dac..8a2064709 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/layout.scss +++ b/ui/packages/consul-ui/app/components/topology-metrics/layout.scss @@ -49,44 +49,6 @@ #upstream-column #upstream-container:not(:last-child) { margin-bottom: 8px; } -#upstream-container .card:not(:last-child), -#downstream-container .card:not(:last-child) { - margin-bottom: 8px; -} -#upstream-container .card, -#downstream-container .card { - display: block; - color: $gray-700; - overflow: hidden; - p { - padding: 12px 12px 0 12px; - font-size: 16px; - font-weight: 600; - margin-bottom: 0 !important; - } - div { - display: inline-flex; - dl { - display: inline-flex; - margin-right: 8px; - } - span { - margin-right: 8px; - } - span::before, - dt::before { - margin-right: 4px; - } - .nspace dt::before, - .health dt::before { - margin-top: 2px; - } - } - .details { - padding: 0 12px 12px 12px; - } - -} // Metrics Container #metrics-container { diff --git a/ui/packages/consul-ui/app/components/topology-metrics/notice/index.hbs b/ui/packages/consul-ui/app/components/topology-metrics/notice/index.hbs new file mode 100644 index 000000000..db8ac82bb --- /dev/null +++ b/ui/packages/consul-ui/app/components/topology-metrics/notice/index.hbs @@ -0,0 +1,31 @@ + + +

+ {{t (concat "components.consul.topology-metrics.notice." @for ".header")}} +

+
+ +

+ {{t (concat "components.consul.topology-metrics.notice." @for ".body")}} +

+
+{{#if @action}} + +

+ {{#if @internal}} + + {{t (concat "components.consul.topology-metrics.notice." @for ".footer.name")}} + + {{else}} + + {{t (concat "components.consul.topology-metrics.notice." @for ".footer")}} + + {{/if}} +

+
+{{/if}} +
\ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/topology-metrics/notice/limited-access.hbs b/ui/packages/consul-ui/app/components/topology-metrics/notice/limited-access.hbs deleted file mode 100644 index 733418b6a..000000000 --- a/ui/packages/consul-ui/app/components/topology-metrics/notice/limited-access.hbs +++ /dev/null @@ -1,16 +0,0 @@ - - -

- Limited Access -

-
- -

- This service may have dependencies you won’t see because you don’t have access to them. -

-
-
\ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/topology-metrics/popover/index.hbs b/ui/packages/consul-ui/app/components/topology-metrics/popover/index.hbs index 3c11d0fdc..04e3316e9 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/popover/index.hbs +++ b/ui/packages/consul-ui/app/components/topology-metrics/popover/index.hbs @@ -4,22 +4,21 @@ > {{#if (eq @type 'deny')}} - <:header>

- Connection Denied + {{t "components.consul.topology-metrics.popover.deny.header"}}

<:body>

{{#if @item.Intention.HasExact}} - Change the action of this intention to allow. + {{t "components.consul.topology-metrics.popover.deny.body.isExact"}} {{else}} - Add an intention that allows these two services to connect. + {{t "components.consul.topology-metrics.popover.deny.body.notExact"}} {{/if}}

@@ -31,9 +30,9 @@ type="button" > {{#if @item.Intention.HasExact}} - Allow + {{t "components.consul.topology-metrics.popover.deny.action.isExact"}} {{else}} - Create + {{t "components.consul.topology-metrics.popover.deny.action.notExact"}} {{/if}} @@ -48,29 +47,57 @@
- -{{else}} - +{{else if (eq @type 'not-defined')}} <:header>

- Layer 7 permissions + {{t "components.consul.topology-metrics.popover.not-defined.header"}}

<:body>

- Certain HTTP request info must be identified. + {{t "components.consul.topology-metrics.popover.not-defined.body"}}

<:actions as |Actions|> - - View + + {{t "components.consul.topology-metrics.popover.not-defined.action"}} + + + + + + +
+{{else}} + + <:header> +

+ {{t "components.consul.topology-metrics.popover.l7.header"}} +

+ + <:body> +

+ {{t "components.consul.topology-metrics.popover.l7.body"}} +

+ + <:actions as |Actions|> + + + {{t "components.consul.topology-metrics.popover.l7.action"}} @@ -84,7 +111,6 @@
- {{/if}}