summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Vargas <jvargas@gitlab.com>2019-07-23 12:53:53 -0500
committerJose Vargas <jvargas@gitlab.com>2019-07-24 17:55:29 -0500
commit87356052a8934ea550976e7c39f49c2077f171cb (patch)
treeecbccbd918c40bcf9f89e9d6effde1fc5cd23e72
parent4543cce94a77fa972b5b646ac98baa1754e7c471 (diff)
downloadgitlab-ce-64481-project-defined-metrics-dashboards-always-show-no-data-found-state.tar.gz
This commit reduces the param reassignment for a map function, also adds the changelog entry
-rw-r--r--changelogs/unreleased/64481-project-defined-metrics-dashboards-always-show-no-data-found-state.yml5
-rw-r--r--spec/javascripts/monitoring/store/mutations_spec.js36
2 files changed, 22 insertions, 19 deletions
diff --git a/changelogs/unreleased/64481-project-defined-metrics-dashboards-always-show-no-data-found-state.yml b/changelogs/unreleased/64481-project-defined-metrics-dashboards-always-show-no-data-found-state.yml
new file mode 100644
index 00000000000..3c88d5863be
--- /dev/null
+++ b/changelogs/unreleased/64481-project-defined-metrics-dashboards-always-show-no-data-found-state.yml
@@ -0,0 +1,5 @@
+---
+title: Fix project defined dashboards not rendering
+merge_request: 30970
+author:
+type: fixed
diff --git a/spec/javascripts/monitoring/store/mutations_spec.js b/spec/javascripts/monitoring/store/mutations_spec.js
index 81fe1eab4d3..10614cabcf3 100644
--- a/spec/javascripts/monitoring/store/mutations_spec.js
+++ b/spec/javascripts/monitoring/store/mutations_spec.js
@@ -163,25 +163,23 @@ describe('Monitoring mutations', () => {
expect(stateCopy.metricsWithData).toEqual([]);
});
- it('sets metricsWithData value when using the id field', () => {
- stateCopy.groups.map(group => {
- const modGroup = group;
- const metrics = group.metrics.map(metric => {
- const modMetric = metric;
- const queries = metric.queries.map(query => {
- const modQuery = query;
-
- delete modQuery.metric_id;
- return modQuery;
- });
-
- modMetric.queries = queries;
- return modMetric;
- });
-
- modGroup.metrics = metrics;
- return modGroup;
- });
+ it('sets metricsWithData values when no metric_id is present but the id field is', () => {
+ stateCopy.groups.map(group => ({
+ group: {
+ ...group,
+ metrics: group.metrics.map(metric => ({
+ metric: {
+ ...metric,
+ queries: metric.queries.map(query => {
+ const queryNoMetricId = query;
+ delete queryNoMetricId.metric_id;
+
+ return queryNoMetricId;
+ }),
+ },
+ })),
+ },
+ }));
mutations[types.SET_QUERY_RESULT](stateCopy, {
metricId: 'system_metrics_kubernetes_container_memory_total',