mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Fixed so that we can not change base threshold
This commit is contained in:
parent
aaaf3f7ff1
commit
0b1aea905a
@ -111,6 +111,21 @@ describe('Remove threshold', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('change threshold value', () => {
|
describe('change threshold value', () => {
|
||||||
|
it('should not change threshold at index 0', () => {
|
||||||
|
const thresholds = [
|
||||||
|
{ index: 0, value: -Infinity, color: '#7EB26D' },
|
||||||
|
{ index: 1, value: 50, color: '#EAB839' },
|
||||||
|
{ index: 2, value: 75, color: '#6ED0E0' },
|
||||||
|
];
|
||||||
|
const instance = setup({ thresholds });
|
||||||
|
|
||||||
|
const mockEvent = { target: { value: 12 } };
|
||||||
|
|
||||||
|
instance.onChangeThresholdValue(mockEvent, thresholds[0]);
|
||||||
|
|
||||||
|
expect(instance.state.thresholds).toEqual(thresholds);
|
||||||
|
});
|
||||||
|
|
||||||
it('should update value', () => {
|
it('should update value', () => {
|
||||||
const instance = setup();
|
const instance = setup();
|
||||||
const thresholds = [
|
const thresholds = [
|
||||||
|
@ -91,6 +91,10 @@ export class ThresholdsEditor extends PureComponent<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onChangeThresholdValue = (event: any, threshold: Threshold) => {
|
onChangeThresholdValue = (event: any, threshold: Threshold) => {
|
||||||
|
if (threshold.index === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { thresholds } = this.state;
|
const { thresholds } = this.state;
|
||||||
|
|
||||||
const newThresholds = thresholds.map(t => {
|
const newThresholds = thresholds.map(t => {
|
||||||
|
Loading…
Reference in New Issue
Block a user