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