mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
29 lines
840 B
TypeScript
29 lines
840 B
TypeScript
import React from 'react';
|
|
import { FieldConfigEditorProps, ThresholdsConfig, ThresholdsMode, ThresholdsFieldConfigSettings } from '@grafana/data';
|
|
import { ThresholdsEditor } from './ThresholdsEditor';
|
|
|
|
export class ThresholdsValueEditor extends React.PureComponent<
|
|
FieldConfigEditorProps<ThresholdsConfig, ThresholdsFieldConfigSettings>
|
|
> {
|
|
constructor(props: FieldConfigEditorProps<ThresholdsConfig, ThresholdsFieldConfigSettings>) {
|
|
super(props);
|
|
}
|
|
|
|
render() {
|
|
const { onChange } = this.props;
|
|
let value = this.props.value;
|
|
if (!value) {
|
|
value = {
|
|
mode: ThresholdsMode.Percentage,
|
|
|
|
// Must be sorted by 'value', first value is always -Infinity
|
|
steps: [
|
|
// anything?
|
|
],
|
|
};
|
|
}
|
|
|
|
return <ThresholdsEditor thresholds={value} onChange={onChange} />;
|
|
}
|
|
}
|