ui: Remove downstream dc filter (#9040)

* Remove datacenter filter and update props passed down

* Merging changes fixed

* Fixup tests for metrics link
pull/9051/head
Kenia 2020-10-27 10:25:23 -04:00 committed by GitHub
parent 094c8c8a29
commit cdf5ba703f
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)}} {{on-window 'resize' (action this.calculate)}}
<div {{did-insert (action this.calculate)}} {{did-update (action this.calculate) @upstreams @downstreams}} class="topology-container"> <div {{did-insert (action this.calculate)}} {{did-update (action this.calculate) @topology}} class="topology-container">
{{#if (gt @downstreams.length 0)}} {{#if (gt @topology.Downstreams.length 0)}}
<div id="downstream-container"> <div id="downstream-container">
<div> <div>
<p>{{@dc}}</p> <p>{{@topology.Datacenter}}</p>
<span> <span>
<Tooltip> <Tooltip>
Only showing downstreams within the current datacenter for {{@service.Service.Service}}. Only showing downstreams within the current datacenter for {{@service.Service.Service}}.
@ -12,11 +12,11 @@
</span> </span>
</div> </div>
<TopologyMetrics::Card <TopologyMetrics::Card
@items={{@downstreams}} @items={{@topology.Downstreams}}
@service={{@service.Service.Service}} @service={{@service.Service.Service}}
@dc={{@dc}} @dc={{@topology.Datacenter}}
@hasMetricsProvider={{this.hasMetricsProvider}} @hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{noMetricsReason}} @noMetricsReason={{this.noMetricsReason}}
/> />
</div> </div>
{{/if}} {{/if}}
@ -27,21 +27,21 @@
{{#if this.hasMetricsProvider }} {{#if this.hasMetricsProvider }}
<TopologyMetrics::Series <TopologyMetrics::Series
@service={{@service.Service.Service}} @service={{@service.Service.Service}}
@dc={{@dc}} @dc={{@topology.Datacenter}}
@protocol={{@protocol}} @protocol={{@topology.Protocol}}
@noMetricsReason={{noMetricsReason}} @noMetricsReason={{this.noMetricsReason}}
/> />
<TopologyMetrics::Stats <TopologyMetrics::Stats
@endpoint='summary-for-service' @endpoint='summary-for-service'
@service={{@service.Service.Service}} @service={{@service.Service.Service}}
@dc={{@dc}} @dc={{@topology.Datacenter}}
@protocol={{@protocol}} @protocol={{@topology.Protocol}}
@noMetricsReason={{noMetricsReason}} @noMetricsReason={{this.noMetricsReason}}
/> />
{{/if}} {{/if}}
<div class="link"> <div class="link">
{{#if @metricsHref}} {{#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}} {{else}}
<a class="config-link" href="{{env 'CONSUL_DOCS_URL'}}/agent/options.html#ui_config" target="_blank" rel="noopener noreferrer">Configure metrics dashboard</a> <a class="config-link" href="{{env 'CONSUL_DOCS_URL'}}/agent/options.html#ui_config" target="_blank" rel="noopener noreferrer">Configure metrics dashboard</a>
{{/if}} {{/if}}
@ -53,21 +53,21 @@
@view={{this.downView}} @view={{this.downView}}
@center={{this.centerDimensions}} @center={{this.centerDimensions}}
@lines={{this.downLines}} @lines={{this.downLines}}
@items={{@downstreams}} @items={{@topology.Downstreams}}
/> />
</div> </div>
{{#if (gt @upstreams.length 0)}} {{#if (gt @topology.Upstreams.length 0)}}
<div id="upstream-column"> <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"> <div id="upstream-container">
<p>{{dc}}</p> <p>{{dc}}</p>
<TopologyMetrics::Card <TopologyMetrics::Card
@items={{upstreams}} @items={{upstreams}}
@service={{@service.Service.Service}} @service={{@service.Service.Service}}
@dc={{@dc}} @dc={{@topology.Datacenter}}
@type='upstream' @type='upstream'
@hasMetricsProvider={{this.hasMetricsProvider}} @hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{noMetricsReason}} @noMetricsReason={{this.noMetricsReason}}
/> />
</div> </div>
{{/each-in}} {{/each-in}}
@ -79,7 +79,7 @@
@view={{this.upView}} @view={{this.upView}}
@center={{this.centerDimensions}} @center={{this.centerDimensions}}
@lines={{this.upLines}} @lines={{this.upLines}}
@items={{@upstreams}} @items={{@topology.Upstreams}}
/> />
</div> </div>
</div> </div>

View File

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

View File

@ -8,7 +8,7 @@ module.exports = ({ appName, environment, rootURL, config }) => `
metrics_provider: 'prometheus', metrics_provider: 'prometheus',
metrics_proxy_enabled: true, metrics_proxy_enabled: true,
dashboard_url_template: { 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 dc: dc1
service: service-0 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: { dashboardAnchor: {
href: attribute('href', '[data-test-dashboard-anchor]'), href: attribute('href', '[data-test-dashboard-anchor]'),
}, },
metricsAnchor: {
href: attribute('href', '[data-test-metrics-anchor]'),
},
tabs: tabs('tab', [ tabs: tabs('tab', [
'topology', 'topology',
'instances', 'instances',