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;
|
return threshold;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Setting value to a value between the new threshold.
|
||||||
const value = newThresholds[index].value - (newThresholds[index].value - newThresholds[index - 1].value) / 2;
|
const value = newThresholds[index].value - (newThresholds[index].value - newThresholds[index - 1].value) / 2;
|
||||||
|
|
||||||
this.setState(
|
this.setState(
|
||||||
@ -57,12 +58,12 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
|||||||
onChangeThresholdValue = (event, threshold) => {
|
onChangeThresholdValue = (event, threshold) => {
|
||||||
const { thresholds } = this.state;
|
const { thresholds } = this.state;
|
||||||
|
|
||||||
const newThresholds = thresholds.map(currentThreshold => {
|
const newThresholds = thresholds.map(t => {
|
||||||
if (currentThreshold === threshold) {
|
if (t === threshold) {
|
||||||
currentThreshold = { ...currentThreshold, value: event.target.value };
|
t = { ...t, value: event.target.value };
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentThreshold;
|
return t;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -73,12 +74,12 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
|||||||
onChangeThresholdColor = (threshold, color) => {
|
onChangeThresholdColor = (threshold, color) => {
|
||||||
const { thresholds } = this.state;
|
const { thresholds } = this.state;
|
||||||
|
|
||||||
const newThresholds = thresholds.map(currentThreshold => {
|
const newThresholds = thresholds.map(t => {
|
||||||
if (currentThreshold === threshold) {
|
if (t === threshold) {
|
||||||
currentThreshold = { ...currentThreshold, color: color };
|
t = { ...t, color: color };
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentThreshold;
|
return t;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState(
|
this.setState(
|
||||||
@ -112,11 +113,9 @@ export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsP
|
|||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return thresholds[0].color;
|
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() {
|
renderNoThresholds() {
|
||||||
|
@ -41,7 +41,6 @@ export class Gauge extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
console.log('did update');
|
|
||||||
this.draw();
|
this.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +81,6 @@ export class Gauge extends PureComponent<Props> {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(formattedThresholds);
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
series: {
|
series: {
|
||||||
gauges: {
|
gauges: {
|
||||||
|
Loading…
Reference in New Issue
Block a user