Rename constant to be consistent
parent
91950f2ef7
commit
364b863257
|
@ -11,7 +11,7 @@ import Threshold from 'src/dashboards/components/Threshold'
|
|||
|
||||
import {
|
||||
COLOR_TYPE_THRESHOLD,
|
||||
GAUGE_COLORS,
|
||||
THRESHOLD_COLORS,
|
||||
MAX_THRESHOLDS,
|
||||
MIN_THRESHOLDS,
|
||||
} from 'shared/constants/thresholds'
|
||||
|
@ -27,7 +27,7 @@ class GaugeOptions extends Component {
|
|||
const sortedColors = _.sortBy(gaugeColors, color => color.value)
|
||||
|
||||
if (sortedColors.length <= MAX_THRESHOLDS) {
|
||||
const randomColor = _.random(0, GAUGE_COLORS.length - 1)
|
||||
const randomColor = _.random(0, THRESHOLD_COLORS.length - 1)
|
||||
|
||||
const maxValue = sortedColors[sortedColors.length - 1].value
|
||||
const minValue = sortedColors[0].value
|
||||
|
@ -43,8 +43,8 @@ class GaugeOptions extends Component {
|
|||
type: COLOR_TYPE_THRESHOLD,
|
||||
id: uuid.v4(),
|
||||
value: randomValue,
|
||||
hex: GAUGE_COLORS[randomColor].hex,
|
||||
name: GAUGE_COLORS[randomColor].name,
|
||||
hex: THRESHOLD_COLORS[randomColor].hex,
|
||||
name: THRESHOLD_COLORS[randomColor].name,
|
||||
}
|
||||
|
||||
const updatedColors = _.sortBy(
|
||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
|||
|
||||
import ColorDropdown from 'shared/components/ColorDropdown'
|
||||
|
||||
import {GAUGE_COLORS} from 'shared/constants/thresholds'
|
||||
import {THRESHOLD_COLORS} from 'shared/constants/thresholds'
|
||||
|
||||
class Threshold extends Component {
|
||||
constructor(props) {
|
||||
|
@ -99,7 +99,7 @@ class Threshold extends Component {
|
|||
ref={r => (this.thresholdInputRef = r)}
|
||||
/>
|
||||
<ColorDropdown
|
||||
colors={GAUGE_COLORS}
|
||||
colors={THRESHOLD_COLORS}
|
||||
selected={selectedColor}
|
||||
onChoose={onChooseColor(threshold)}
|
||||
disabled={isMax && disableMaxColor}
|
||||
|
|
|
@ -11,7 +11,7 @@ import ColorDropdown from 'shared/components/ColorDropdown'
|
|||
import {updateThresholdsListColors} from 'src/dashboards/actions/cellEditorOverlay'
|
||||
|
||||
import {
|
||||
GAUGE_COLORS,
|
||||
THRESHOLD_COLORS,
|
||||
DEFAULT_VALUE_MIN,
|
||||
DEFAULT_VALUE_MAX,
|
||||
MAX_THRESHOLDS,
|
||||
|
@ -32,7 +32,7 @@ class ThresholdsList extends Component {
|
|||
onResetFocus,
|
||||
} = this.props
|
||||
|
||||
const randomColor = _.random(0, GAUGE_COLORS.length - 1)
|
||||
const randomColor = _.random(0, THRESHOLD_COLORS.length - 1)
|
||||
|
||||
const maxValue = DEFAULT_VALUE_MIN
|
||||
const minValue = DEFAULT_VALUE_MAX
|
||||
|
@ -50,8 +50,8 @@ class ThresholdsList extends Component {
|
|||
type: thresholdsListType,
|
||||
id: uuid.v4(),
|
||||
value: randomValue,
|
||||
hex: GAUGE_COLORS[randomColor].hex,
|
||||
name: GAUGE_COLORS[randomColor].name,
|
||||
hex: THRESHOLD_COLORS[randomColor].hex,
|
||||
name: THRESHOLD_COLORS[randomColor].name,
|
||||
}
|
||||
|
||||
const updatedColors = _.sortBy(
|
||||
|
@ -141,7 +141,7 @@ class ThresholdsList extends Component {
|
|||
? <div className="threshold-item" key={color.id}>
|
||||
<div className="threshold-item--label">Base Color</div>
|
||||
<ColorDropdown
|
||||
colors={GAUGE_COLORS}
|
||||
colors={THRESHOLD_COLORS}
|
||||
selected={formatColor(color)}
|
||||
onChoose={this.handleChooseColor(color)}
|
||||
stretchToFit={true}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'lodash'
|
||||
import {
|
||||
GAUGE_COLORS,
|
||||
THRESHOLD_COLORS,
|
||||
THRESHOLD_TYPE_BASE,
|
||||
THRESHOLD_TYPE_TEXT,
|
||||
} from 'shared/constants/thresholds'
|
||||
|
@ -51,7 +51,7 @@ export const generateThresholdsListHexs = (
|
|||
lastValue,
|
||||
containsLineGraph
|
||||
) => {
|
||||
const defaultColoring = {bgColor: null, textColor: GAUGE_COLORS[11].hex}
|
||||
const defaultColoring = {bgColor: null, textColor: THRESHOLD_COLORS[11].hex}
|
||||
const lastValueNumber = Number(lastValue) || 0
|
||||
|
||||
if (!colors.length || !lastValue) {
|
||||
|
|
|
@ -15,7 +15,7 @@ export const THRESHOLD_TYPE_BASE = 'base'
|
|||
|
||||
export const TIME_FORMAT_DEFAULT = 'MM/DD/YYYY HH:mm:ss.ss'
|
||||
|
||||
export const GAUGE_COLORS = [
|
||||
export const THRESHOLD_COLORS = [
|
||||
{
|
||||
hex: '#BF3D5E',
|
||||
name: 'ruby',
|
||||
|
@ -97,16 +97,16 @@ export const GAUGE_COLORS = [
|
|||
export const DEFAULT_GAUGE_COLORS = [
|
||||
{
|
||||
type: COLOR_TYPE_MIN,
|
||||
hex: GAUGE_COLORS[11].hex,
|
||||
hex: THRESHOLD_COLORS[11].hex,
|
||||
id: '0',
|
||||
name: GAUGE_COLORS[11].name,
|
||||
name: THRESHOLD_COLORS[11].name,
|
||||
value: DEFAULT_VALUE_MIN,
|
||||
},
|
||||
{
|
||||
type: COLOR_TYPE_MAX,
|
||||
hex: GAUGE_COLORS[14].hex,
|
||||
hex: THRESHOLD_COLORS[14].hex,
|
||||
id: '1',
|
||||
name: GAUGE_COLORS[14].name,
|
||||
name: THRESHOLD_COLORS[14].name,
|
||||
value: DEFAULT_VALUE_MAX,
|
||||
},
|
||||
]
|
||||
|
@ -114,9 +114,9 @@ export const DEFAULT_GAUGE_COLORS = [
|
|||
export const DEFAULT_THRESHOLDS_LIST_COLORS = [
|
||||
{
|
||||
type: THRESHOLD_TYPE_TEXT,
|
||||
hex: GAUGE_COLORS[11].hex,
|
||||
hex: THRESHOLD_COLORS[11].hex,
|
||||
id: THRESHOLD_TYPE_BASE,
|
||||
name: GAUGE_COLORS[11].name,
|
||||
name: THRESHOLD_COLORS[11].name,
|
||||
value: -999999999999999999,
|
||||
},
|
||||
]
|
||||
|
@ -124,9 +124,9 @@ export const DEFAULT_THRESHOLDS_LIST_COLORS = [
|
|||
export const DEFAULT_TABLE_COLORS = [
|
||||
{
|
||||
type: THRESHOLD_TYPE_BG,
|
||||
hex: GAUGE_COLORS[18].hex,
|
||||
hex: THRESHOLD_COLORS[18].hex,
|
||||
id: THRESHOLD_TYPE_BASE,
|
||||
name: GAUGE_COLORS[18].name,
|
||||
name: THRESHOLD_COLORS[18].name,
|
||||
value: 0,
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue