Create not explicitly defined intentions banner

pull/10002/head
kenia 4 years ago
parent 52e88bbf65
commit f5849fd500

@ -0,0 +1,23 @@
<Notice
class="topology-metrics-notice-wildcard-intention"
...attributes
@type={{or @type "warning"}}
as |notice|>
<notice.Header>
<h3>
{{t "components.consul.topology-metrics.notice.undefined-intention.header"}}
</h3>
</notice.Header>
<notice.Body>
<p>
{{t "components.consul.topology-metrics.notice.undefined-intention.body"}}
</p>
</notice.Body>
<notice.Footer>
<p>
<a href="{{env 'CONSUL_DOCS_URL'}}/connect/registration/service-registration#upstreams" rel="noopener noreferrer" target="_blank">
{{t "components.consul.topology-metrics.notice.undefined-intention.footer"}}
</a>
</p>
</notice.Footer>
</Notice>

@ -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;
}
}

@ -31,6 +31,9 @@ as |route|>
{{#if topology.WildcardIntention}}
<TopologyMetrics::Notice::WildcardIntention />
{{/if}}
{{#if topology.undefinedIntention}}
<TopologyMetrics::Notice::UndefinedIntention />
{{/if}}
<TopologyMetrics
@nspace={{nspace}}
@dc={{dc.Name}}

Loading…
Cancel
Save