ui: Remove downstream dc filter (#9040)

* Remove datacenter filter and update props passed down

* Merging changes fixed

* Fixup tests for metrics link
This commit is contained in:
Kenia 2020-10-27 10:25:23 -04:00 committed by GitHub
parent b5a7137cf4
commit 166f40837a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 26 deletions

View File

@ -1,10 +1,10 @@
{{on-window 'resize' (action this.calculate)}}
<div {{did-insert (action this.calculate)}} {{did-update (action this.calculate) @upstreams @downstreams}} class="topology-container">
{{#if (gt @downstreams.length 0)}}
<div {{did-insert (action this.calculate)}} {{did-update (action this.calculate) @topology}} class="topology-container">
{{#if (gt @topology.Downstreams.length 0)}}
<div id="downstream-container">
<div>
<p>{{@dc}}</p>
<p>{{@topology.Datacenter}}</p>
<span>
<Tooltip>
Only showing downstreams within the current datacenter for {{@service.Service.Service}}.
@ -12,11 +12,11 @@
</span>
</div>
<TopologyMetrics::Card
@items={{@downstreams}}
@items={{@topology.Downstreams}}
@service={{@service.Service.Service}}
@dc={{@dc}}
@dc={{@topology.Datacenter}}
@hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{noMetricsReason}}
@noMetricsReason={{this.noMetricsReason}}
/>
</div>
{{/if}}
@ -27,21 +27,21 @@
{{#if this.hasMetricsProvider }}
<TopologyMetrics::Series
@service={{@service.Service.Service}}
@dc={{@dc}}
@protocol={{@protocol}}
@noMetricsReason={{noMetricsReason}}
@dc={{@topology.Datacenter}}
@protocol={{@topology.Protocol}}
@noMetricsReason={{this.noMetricsReason}}
/>
<TopologyMetrics::Stats
@endpoint='summary-for-service'
@service={{@service.Service.Service}}
@dc={{@dc}}
@protocol={{@protocol}}
@noMetricsReason={{noMetricsReason}}
@dc={{@topology.Datacenter}}
@protocol={{@topology.Protocol}}
@noMetricsReason={{this.noMetricsReason}}
/>
{{/if}}
<div class="link">
{{#if @metricsHref}}
<a class="metrics-link" href={{@metricsHref}} target="_blank" rel="noopener noreferrer" data-test-dashboard-anchor>Open metrics Dashboard</a>
<a class="metrics-link" href={{@metricsHref}} target="_blank" rel="noopener noreferrer" data-test-metrics-anchor>Open metrics Dashboard</a>
{{else}}
<a class="config-link" href="{{env 'CONSUL_DOCS_URL'}}/agent/options.html#ui_config" target="_blank" rel="noopener noreferrer">Configure metrics dashboard</a>
{{/if}}
@ -53,21 +53,21 @@
@view={{this.downView}}
@center={{this.centerDimensions}}
@lines={{this.downLines}}
@items={{@downstreams}}
@items={{@topology.Downstreams}}
/>
</div>
{{#if (gt @upstreams.length 0)}}
{{#if (gt @topology.Upstreams.length 0)}}
<div id="upstream-column">
{{#each-in (group-by "Datacenter" @upstreams) as |dc upstreams|}}
{{#each-in (group-by "Datacenter" @topology.Upstreams) as |dc upstreams|}}
<div id="upstream-container">
<p>{{dc}}</p>
<TopologyMetrics::Card
@items={{upstreams}}
@service={{@service.Service.Service}}
@dc={{@dc}}
@dc={{@topology.Datacenter}}
@type='upstream'
@hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{noMetricsReason}}
@noMetricsReason={{this.noMetricsReason}}
/>
</div>
{{/each-in}}
@ -79,7 +79,7 @@
@view={{this.upView}}
@center={{this.centerDimensions}}
@lines={{this.upLines}}
@items={{@upstreams}}
@items={{@topology.Upstreams}}
/>
</div>
</div>

View File

@ -6,11 +6,8 @@
{{#if topology}}
<TopologyMetrics
@service={{items.firstObject}}
@protocol={{topology.Protocol}}
@upstreams={{topology.Upstreams}}
@downstreams={{filter-by 'Datacenter' topology.Datacenter topology.Downstreams}}
@dc={{topology.Datacenter}}
@metricsHref={{render-template urls.services (hash
@topology={{topology}}
@metricsHref={{render-template urls.service (hash
Datacenter=dc
Service=items.firstObject
)}}

View File

@ -8,7 +8,7 @@ module.exports = ({ appName, environment, rootURL, config }) => `
metrics_provider: 'prometheus',
metrics_proxy_enabled: true,
dashboard_url_template: {
services: 'https://example.com?{{Service.Name}}&{{Datacenter}}',
service: 'https://example.com?{{Service.Name}}&{{Datacenter}}',
},
})
)

View File

@ -108,4 +108,4 @@ Feature: dc / services / show: Show Service
dc: dc1
service: service-0
---
And I see href on the dashboardAnchor like "https://example.com?service-0-with-id&dc1"
And I see href on the metricsAnchor like "https://example.com?service-0-with-id&dc1"

View File

@ -7,6 +7,9 @@ export default function(visitable, attribute, collection, text, intentions, filt
dashboardAnchor: {
href: attribute('href', '[data-test-dashboard-anchor]'),
},
metricsAnchor: {
href: attribute('href', '[data-test-metrics-anchor]'),
},
tabs: tabs('tab', [
'topology',
'instances',