Refactor TopologyMetrics Notices

This commit is contained in:
kenia 2021-04-13 15:21:19 -04:00
parent a7672cc5ba
commit 4662f1f35b
6 changed files with 55 additions and 89 deletions

View File

@ -1,23 +0,0 @@
<Notice
class="topology-metrics-notice-default-allow"
...attributes
@type={{or @type "warning"}}
as |notice|>
<notice.Header>
<h3>
{{t "components.consul.topology-metrics.notice.default-allow.header"}}
</h3>
</notice.Header>
<notice.Body>
<p>
{{t "components.consul.topology-metrics.notice.default-allow.body"}}
</p>
</notice.Body>
<notice.Footer>
<p>
<a href={{href-to 'dc.services.show.intentions'}}>
{{t "components.consul.topology-metrics.notice.default-allow.footer"}}
</a>
</p>
</notice.Footer>
</Notice>

View File

@ -0,0 +1,31 @@
<Notice
class="topology-metrics-notice"
...attributes
@type={{or @type}}
as |notice|>
<notice.Header>
<h3>
{{t (concat "components.consul.topology-metrics.notice." @for ".header")}}
</h3>
</notice.Header>
<notice.Body>
<p>
{{t (concat "components.consul.topology-metrics.notice." @for ".body")}}
</p>
</notice.Body>
{{#if @action}}
<notice.Footer>
<p>
{{#if @internal}}
<Action @href={{href-to (t (concat "components.consul.topology-metrics.notice." @for ".footer.URL"))}}>
{{t (concat "components.consul.topology-metrics.notice." @for ".footer.name")}}
</Action>
{{else}}
<Action @href={{@link}} @external={{true}}>
{{t (concat "components.consul.topology-metrics.notice." @for ".footer")}}
</Action>
{{/if}}
</p>
</notice.Footer>
{{/if}}
</Notice>

View File

@ -1,16 +0,0 @@
<Notice
class="topology-metrics-notice-limited-access"
...attributes
@type={{or @type "info"}}
as |notice|>
<notice.Header>
<h3>
{{t "components.consul.topology-metrics.notice.limited-access.header"}}
</h3>
</notice.Header>
<notice.Body>
<p>
{{t "components.consul.topology-metrics.notice.limited-access.body"}}
</p>
</notice.Body>
</Notice>

View File

@ -1,23 +0,0 @@
<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,23 +0,0 @@
<Notice
class="topology-metrics-notice-wildcard-intention"
...attributes
@type={{or @type "warning"}}
as |notice|>
<notice.Header>
<h3>
{{t "components.consul.topology-metrics.notice.wildcard-intention.header"}}
</h3>
</notice.Header>
<notice.Body>
<p>
{{t "components.consul.topology-metrics.notice.wildcard-intention.body"}}
</p>
</notice.Body>
<notice.Footer>
<p>
<a href={{href-to 'dc.services.show.intentions'}}>
{{t "components.consul.topology-metrics.notice.wildcard-intention.footer"}}
</a>
</p>
</notice.Footer>
</Notice>

View File

@ -23,16 +23,36 @@ as |route|>
</EmptyState>
{{else}}
{{#if topology.FilteredByACLs}}
<TopologyMetrics::Notice::LimitedAccess />
<TopologyMetrics::Notice
@type="info"
@for="limited-access"
@action={{false}}
/>
{{/if}}
{{#if topology.DefaultAllow}}
<TopologyMetrics::Notice::DefaultAllow />
<TopologyMetrics::Notice
@type="warning"
@for="default-allow"
@internal={{true}}
@action={{true}}
/>
{{/if}}
{{#if topology.WildcardIntention}}
<TopologyMetrics::Notice::WildcardIntention />
<TopologyMetrics::Notice
@type="warning"
@for="wildcard-intention"
@internal={{true}}
@action={{true}}
/>
{{/if}}
{{#if topology.undefinedIntention}}
<TopologyMetrics::Notice::UndefinedIntention />
<TopologyMetrics::Notice
@type="warning"
@for="not-defined-intention"
@link="{{env 'CONSUL_DOCS_URL'}}/connect/registration/service-registration#upstreams"
@internal={{false}}
@action={{true}}
/>
{{/if}}
<TopologyMetrics
@nspace={{nspace}}