diff --git a/ui/packages/consul-ui/app/components/topology-metrics/notice/undefined-intention.hbs b/ui/packages/consul-ui/app/components/topology-metrics/notice/undefined-intention.hbs new file mode 100644 index 0000000000..21ab999d73 --- /dev/null +++ b/ui/packages/consul-ui/app/components/topology-metrics/notice/undefined-intention.hbs @@ -0,0 +1,23 @@ + + +

+ {{t "components.consul.topology-metrics.notice.undefined-intention.header"}} +

+
+ +

+ {{t "components.consul.topology-metrics.notice.undefined-intention.body"}} +

+
+ +

+ + {{t "components.consul.topology-metrics.notice.undefined-intention.footer"}} + +

+
+
\ No newline at end of file diff --git a/ui/packages/consul-ui/app/models/topology.js b/ui/packages/consul-ui/app/models/topology.js index 1c1984a151..29bfb448e0 100644 --- a/ui/packages/consul-ui/app/models/topology.js +++ b/ui/packages/consul-ui/app/models/topology.js @@ -1,4 +1,5 @@ import Model, { attr } from '@ember-data/model'; +import { computed } from '@ember/object'; export const PRIMARY_KEY = 'uid'; export const SLUG_KEY = 'ServiceName'; @@ -17,4 +18,24 @@ export default class Topology extends Model { @attr() Upstreams; // Service[] @attr() Downstreams; // Service[], @attr() meta; // {} + + @computed('Upstreams', 'Downstreams') + get undefinedIntention() { + let undefinedUpstream = false; + let undefinedDownstream = false; + + undefinedUpstream = + this.Upstreams.filter( + item => + item.Source === 'specific-intention' && !item.TransparentProxy && item.Intention.Allowed + ).length !== 0; + + undefinedDownstream = + this.Downstreams.filter( + item => + item.Source === 'specific-intention' && !item.TransparentProxy && item.Intention.Allowed + ).length !== 0; + + return undefinedUpstream || undefinedDownstream; + } } diff --git a/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs b/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs index 2bc9bfa3d3..9bf72cf3d8 100644 --- a/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs +++ b/ui/packages/consul-ui/app/templates/dc/services/show/topology.hbs @@ -31,6 +31,9 @@ as |route|> {{#if topology.WildcardIntention}} {{/if}} + {{#if topology.undefinedIntention}} + + {{/if}}