diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-10-06 22:07:02 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-10-06 22:07:02 +0000 |
commit | b899e24bae33fd62274a7bf6affe7a8288444d6c (patch) | |
tree | 6a7e4967875dd4d6f602f05f69c662067cd42fbe /app/assets/javascripts | |
parent | 3cbab382f678cef273cde319aae55f050d27527d (diff) | |
parent | 39fc2d9c25b9f7e41d20ba623ab05a5dd8adb0b0 (diff) | |
download | gitlab-ce-b899e24bae33fd62274a7bf6affe7a8288444d6c.tar.gz |
Merge branch '36255-metrics-that-do-not-have-a-complete-history-are-not-shown-at-all' into 'master'
Resolve "Metrics that do not have a complete history are not shown at all"
Closes #36255
See merge request gitlab-org/gitlab-ce!14741
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/monitoring/components/graph/legend.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/monitoring/utils/multiple_time_series.js | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/monitoring/components/graph/legend.vue b/app/assets/javascripts/monitoring/components/graph/legend.vue index dbc48c63747..85b6d7f4cbe 100644 --- a/app/assets/javascripts/monitoring/components/graph/legend.vue +++ b/app/assets/javascripts/monitoring/components/graph/legend.vue @@ -79,7 +79,11 @@ }, formatMetricUsage(series) { - return `${formatRelevantDigits(series.values[this.currentDataIndex].value)} ${this.unitOfDisplay}`; + const value = series.values[this.currentDataIndex].value; + if (isNaN(value)) { + return '-'; + } + return `${formatRelevantDigits(value)} ${this.unitOfDisplay}`; }, createSeriesString(index, series) { diff --git a/app/assets/javascripts/monitoring/utils/multiple_time_series.js b/app/assets/javascripts/monitoring/utils/multiple_time_series.js index 3cbe06d8fd6..65eec0d8d02 100644 --- a/app/assets/javascripts/monitoring/utils/multiple_time_series.js +++ b/app/assets/javascripts/monitoring/utils/multiple_time_series.js @@ -56,12 +56,16 @@ export default function createTimeSeries(queryData, graphWidth, graphHeight, gra timeSeriesScaleX.ticks(d3.time.minute, 60); timeSeriesScaleY.domain([0, maxValueFromSeries.maxValue]); + const defined = d => !isNaN(d.value) && d.value != null; + const lineFunction = d3.svg.line() + .defined(defined) .interpolate('linear') .x(d => timeSeriesScaleX(d.time)) .y(d => timeSeriesScaleY(d.value)); const areaFunction = d3.svg.area() + .defined(defined) .interpolate('linear') .x(d => timeSeriesScaleX(d.time)) .y0(graphHeight - graphHeightOffset) |