mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
console logs and code layout
This commit is contained in:
parent
b856ae3957
commit
efb71d1026
@ -33,6 +33,7 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
||||
return threshold;
|
||||
});
|
||||
|
||||
// Setting value to a value between the new threshold.
|
||||
const value = newThresholds[index].value - (newThresholds[index].value - newThresholds[index - 1].value) / 2;
|
||||
|
||||
this.setState(
|
||||
@ -57,12 +58,12 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
||||
onChangeThresholdValue = (event, threshold) => {
|
||||
const { thresholds } = this.state;
|
||||
|
||||
const newThresholds = thresholds.map(currentThreshold => {
|
||||
if (currentThreshold === threshold) {
|
||||
currentThreshold = { ...currentThreshold, value: event.target.value };
|
||||
const newThresholds = thresholds.map(t => {
|
||||
if (t === threshold) {
|
||||
t = { ...t, value: event.target.value };
|
||||
}
|
||||
|
||||
return currentThreshold;
|
||||
return t;
|
||||
});
|
||||
|
||||
this.setState({
|
||||
@ -73,12 +74,12 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
||||
onChangeThresholdColor = (threshold, color) => {
|
||||
const { thresholds } = this.state;
|
||||
|
||||
const newThresholds = thresholds.map(currentThreshold => {
|
||||
if (currentThreshold === threshold) {
|
||||
currentThreshold = { ...currentThreshold, color: color };
|
||||
const newThresholds = thresholds.map(t => {
|
||||
if (t === threshold) {
|
||||
t = { ...t, color: color };
|
||||
}
|
||||
|
||||
return currentThreshold;
|
||||
return t;
|
||||
});
|
||||
|
||||
this.setState(
|
||||
@ -112,11 +113,9 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
||||
|
||||
if (index === 0) {
|
||||
return thresholds[0].color;
|
||||
} else if (index < thresholds.length) {
|
||||
return thresholds[index].color;
|
||||
}
|
||||
|
||||
return 'rgb(212, 74, 58)';
|
||||
return index < thresholds.length ? thresholds[index].color : 'rgb(212, 74, 58)';
|
||||
}
|
||||
|
||||
renderNoThresholds() {
|
||||
|
@ -41,7 +41,6 @@ export class Gauge extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Props) {
|
||||
console.log('did update');
|
||||
this.draw();
|
||||
}
|
||||
|
||||
@ -82,8 +81,6 @@ export class Gauge extends PureComponent<Props> {
|
||||
};
|
||||
});
|
||||
|
||||
console.log(formattedThresholds);
|
||||
|
||||
const options = {
|
||||
series: {
|
||||
gauges: {
|
||||
|
Loading…
Reference in New Issue
Block a user