mirror of https://github.com/status-im/consul.git
ui: Fix empty state conditional for Series Graph (#9221)
This commit is contained in:
parent
a8024825fc
commit
cafbfec376
|
@ -8,20 +8,22 @@
|
||||||
|
|
||||||
{{on-window 'resize' (action 'redraw')}}
|
{{on-window 'resize' (action 'redraw')}}
|
||||||
|
|
||||||
|
{{#if (not empty)}}
|
||||||
{{#if data.labels}}
|
{{#if data.labels}}
|
||||||
<a class="sparkline-key-link" {{action (mut shouldShowKey) true}}>Key</a>
|
<a class="sparkline-key-link" {{action (mut shouldShowKey) true}}>Key</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="sparkline-wrapper">
|
<div class="sparkline-wrapper">
|
||||||
<div class="tooltip">
|
<div class="tooltip">
|
||||||
<div class="sparkline-time">Timestamp</div>
|
<div class="sparkline-time">Timestamp</div>
|
||||||
</div>
|
</div>
|
||||||
{{#unless data}}
|
{{#if empty}}
|
||||||
<TopologyMetrics::Status
|
<TopologyMetrics::Status
|
||||||
@noMetricsReason={{@noMetricsReason}}
|
@noMetricsReason={{@noMetricsReason}}
|
||||||
@error={{error}}
|
@error={{error}}
|
||||||
/>
|
/>
|
||||||
{{/unless}}
|
{{/if}}
|
||||||
<svg class="sparkline"></svg>
|
<svg class="sparkline"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { scaleLinear, scaleTime, scaleOrdinal } from 'd3-scale';
|
||||||
import { schemeTableau10 } from 'd3-scale-chromatic';
|
import { schemeTableau10 } from 'd3-scale-chromatic';
|
||||||
import { area, stack, stackOrderReverse } from 'd3-shape';
|
import { area, stack, stackOrderReverse } from 'd3-shape';
|
||||||
import { max, extent, bisector } from 'd3-array';
|
import { max, extent, bisector } from 'd3-array';
|
||||||
|
import { set } from '@ember/object';
|
||||||
|
|
||||||
dayjs.extend(Calendar);
|
dayjs.extend(Calendar);
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ function niceTimeWithSeconds(d) {
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
data: null,
|
data: null,
|
||||||
|
empty: false,
|
||||||
actions: {
|
actions: {
|
||||||
redraw: function(evt) {
|
redraw: function(evt) {
|
||||||
this.drawGraphs();
|
this.drawGraphs();
|
||||||
|
@ -35,6 +36,7 @@ export default Component.extend({
|
||||||
|
|
||||||
drawGraphs: function() {
|
drawGraphs: function() {
|
||||||
if (!this.data) {
|
if (!this.data) {
|
||||||
|
set(this, 'empty', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,10 +61,10 @@ export default Component.extend({
|
||||||
if (series.length == 0 || keys.length == 0) {
|
if (series.length == 0 || keys.length == 0) {
|
||||||
// Put the graph in an error state that might get fixed if metrics show up
|
// Put the graph in an error state that might get fixed if metrics show up
|
||||||
// on next poll.
|
// on next poll.
|
||||||
let loader = this.element.querySelector('.sparkline-loader');
|
set(this, 'empty', true);
|
||||||
loader.innerHTML = 'No Metrics Available';
|
|
||||||
loader.style.display = 'block';
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
set(this, 'empty', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let st = stack()
|
let st = stack()
|
||||||
|
|
Loading…
Reference in New Issue