Sort gauge thresholds by value before rendering

pull/10616/head
Alex P 2017-11-21 12:11:56 -08:00
parent 52775c040b
commit 3d095b012d
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import React, {PropTypes} from 'react'
import _ from 'lodash'
import FancyScrollbar from 'shared/components/FancyScrollbar'
import GaugeThreshold from 'src/dashboards/components/GaugeThreshold'
@ -20,6 +21,8 @@ const GaugeOptions = ({
const disableAddThreshold = colors.length > MAX_THRESHOLDS
const sortedColors = _.sortBy(colors, color => Number(color.value))
return (
<FancyScrollbar
className="display-options--cell y-axis-controls"
@ -28,7 +31,7 @@ const GaugeOptions = ({
<div className="display-options--cell-wrapper">
<h5 className="display-options--header">Gauge Controls</h5>
<div className="gauge-controls">
{colors.map(color =>
{sortedColors.map(color =>
<GaugeThreshold
threshold={color}
key={color.id}