From d595f8eaa891a25b2246df849e21e1a2175d2b16 Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 8 Dec 2017 14:39:40 -0800 Subject: [PATCH] Prevent addition of thresholds with a nonexistent color --- ui/src/dashboards/components/CellEditorOverlay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/dashboards/components/CellEditorOverlay.js b/ui/src/dashboards/components/CellEditorOverlay.js index da51bc3464..352c1c61ad 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.js +++ b/ui/src/dashboards/components/CellEditorOverlay.js @@ -79,7 +79,7 @@ class CellEditorOverlay extends Component { const sortedColors = _.sortBy(colors, color => Number(color.value)) if (sortedColors.length <= MAX_THRESHOLDS) { - const randomColor = _.random(0, GAUGE_COLORS.length) + const randomColor = _.random(0, GAUGE_COLORS.length - 1) const maxValue = cellWorkingType === 'gauge'