The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/plugins/panel/timeseries/SpanNullsEditor.tsx

40 lines
1.0 KiB

import { StandardEditorProps, SelectableValue } from '@grafana/data';
import { HorizontalGroup, RadioButtonGroup } from '@grafana/ui';
import { InputPrefix, NullsThresholdInput } from './NullsThresholdInput';
const GAPS_OPTIONS: Array<SelectableValue<boolean | number>> = [
{
label: 'Never',
value: false,
},
{
label: 'Always',
value: true,
},
{
label: 'Threshold',
value: 3600000, // 1h
},
];
type Props = StandardEditorProps<boolean | number, { isTime: boolean }>;
export const SpanNullsEditor = ({ value, onChange, item }: Props) => {
const isThreshold = typeof value === 'number';
GAPS_OPTIONS[2].value = isThreshold ? value : 3600000; // 1h
return (
<HorizontalGroup>
<RadioButtonGroup value={value} options={GAPS_OPTIONS} onChange={onChange} />
{isThreshold && (
<NullsThresholdInput
value={value}
onChange={onChange}
inputPrefix={InputPrefix.LessThan}
isTime={item.settings?.isTime ?? false}
/>
)}
</HorizontalGroup>
);
};