mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 05:23:04 +00:00
Create placeholder *(All Services) Card
This commit is contained in:
parent
934db376f4
commit
041245c7dd
@ -1,3 +1,10 @@
|
|||||||
|
{{#if (eq @item.Name '*(All Services)')}}
|
||||||
|
<a class="topology-metrics-card" href={{href-to 'dc.services.index'}}>
|
||||||
|
<p class="empty">
|
||||||
|
{{@item.Name}}
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
{{else}}
|
||||||
<a class="topology-metrics-card"
|
<a class="topology-metrics-card"
|
||||||
href={{if
|
href={{if
|
||||||
(and (env 'CONSUL_NSPACES_ENABLED') (not-eq @item.Namespace @service.Namespace))
|
(and (env 'CONSUL_NSPACES_ENABLED') (not-eq @item.Namespace @service.Namespace))
|
||||||
@ -56,4 +63,5 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{yield}}
|
{{yield}}
|
||||||
</a>
|
</a>
|
||||||
|
{{/if}}
|
@ -16,6 +16,9 @@
|
|||||||
font-weight: $typo-weight-semibold;
|
font-weight: $typo-weight-semibold;
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
p.empty {
|
||||||
|
padding: 12px !important;
|
||||||
|
}
|
||||||
div {
|
div {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
dl {
|
dl {
|
||||||
|
@ -81,15 +81,17 @@
|
|||||||
@oncreate={{action @oncreate}}
|
@oncreate={{action @oncreate}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{{#if (gt @topology.Upstreams.length 0)}}
|
{{#if (gt this.upstreams.length 0)}}
|
||||||
<div id="upstream-column">
|
<div id="upstream-column">
|
||||||
{{#each-in (group-by "Datacenter" @topology.Upstreams) as |dc upstreams|}}
|
{{#each-in (group-by "Datacenter" this.upstreams) as |dc upstreams|}}
|
||||||
<div
|
<div
|
||||||
id="upstream-container"
|
id="upstream-container"
|
||||||
{{did-insert this.setHeight 'upstream-lines'}}
|
{{did-insert this.setHeight 'upstream-lines'}}
|
||||||
{{did-update this.setHeight 'upstream-lines' @topology.Upstreams}}
|
{{did-update this.setHeight 'upstream-lines' this.upstreams}}
|
||||||
>
|
>
|
||||||
|
{{#if dc}}
|
||||||
<p>{{dc}}</p>
|
<p>{{dc}}</p>
|
||||||
|
{{/if}}
|
||||||
{{#each upstreams as |item|}}
|
{{#each upstreams as |item|}}
|
||||||
<TopologyMetrics::Card
|
<TopologyMetrics::Card
|
||||||
@dc={{@dc}}
|
@dc={{@dc}}
|
||||||
@ -119,7 +121,7 @@
|
|||||||
@view={{this.upView}}
|
@view={{this.upView}}
|
||||||
@center={{this.centerDimensions}}
|
@center={{this.centerDimensions}}
|
||||||
@lines={{this.upLines}}
|
@lines={{this.upLines}}
|
||||||
@items={{@topology.Upstreams}}
|
@items={{this.upstreams}}
|
||||||
@oncreate={{action @oncreate}}
|
@oncreate={{action @oncreate}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
import { action } from '@ember/object';
|
import { action, get } from '@ember/object';
|
||||||
|
|
||||||
export default class TopologyMetrics extends Component {
|
export default class TopologyMetrics extends Component {
|
||||||
// =attributes
|
// =attributes
|
||||||
@ -66,6 +66,24 @@ export default class TopologyMetrics extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get upstreams() {
|
||||||
|
const upstreams = get(this.args.topology, 'Upstreams') || [];
|
||||||
|
const items = [...upstreams];
|
||||||
|
const defaultAllow = get(this.args.topology, 'DefaultAllow');
|
||||||
|
const wildcardIntention = get(this.args.topology, 'WildcardIntention');
|
||||||
|
if (defaultAllow || wildcardIntention) {
|
||||||
|
items.push({
|
||||||
|
Name: '*(All Services)',
|
||||||
|
Datacenter: '',
|
||||||
|
Namespace: '',
|
||||||
|
Intention: {
|
||||||
|
Allowed: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
// =actions
|
// =actions
|
||||||
@action
|
@action
|
||||||
setHeight(el, item) {
|
setHeight(el, item) {
|
||||||
@ -89,7 +107,15 @@ export default class TopologyMetrics extends Component {
|
|||||||
|
|
||||||
// Calculate viewBox dimensions
|
// Calculate viewBox dimensions
|
||||||
this.downView = document.getElementById('downstream-lines').getBoundingClientRect();
|
this.downView = document.getElementById('downstream-lines').getBoundingClientRect();
|
||||||
this.upView = document.getElementById('upstream-lines').getBoundingClientRect();
|
const upstreamLines = document.getElementById('upstream-lines').getBoundingClientRect();
|
||||||
|
const upstreamColumn = document.getElementById('upstream-column').getBoundingClientRect();
|
||||||
|
|
||||||
|
this.upView = {
|
||||||
|
x: upstreamLines.x,
|
||||||
|
y: upstreamLines.y,
|
||||||
|
width: upstreamLines.width,
|
||||||
|
height: upstreamColumn.height,
|
||||||
|
};
|
||||||
|
|
||||||
// Get Card elements positions
|
// Get Card elements positions
|
||||||
const downCards = [
|
const downCards = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user