Create not explicitly defined intentions banner

This commit is contained in:
kenia 2021-04-12 09:19:49 -04:00
parent eb2b804211
commit 3f86e22a05
3 changed files with 47 additions and 0 deletions

View File

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

View File

@ -1,4 +1,5 @@
import Model, { attr } from '@ember-data/model'; import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
export const PRIMARY_KEY = 'uid'; export const PRIMARY_KEY = 'uid';
export const SLUG_KEY = 'ServiceName'; export const SLUG_KEY = 'ServiceName';
@ -17,4 +18,24 @@ export default class Topology extends Model {
@attr() Upstreams; // Service[] @attr() Upstreams; // Service[]
@attr() Downstreams; // Service[], @attr() Downstreams; // Service[],
@attr() meta; // {} @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;
}
} }

View File

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