mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 04:12:19 +08:00

* markup timeseries panel edit * mark up matchers ui * mark up bar chart * mark up stat panel * mark up gauge * mark up bar gauge * mark up table component * mark up pie chart * mark up state timeline * mark up heatmap * mark up status history * mark up histogram * mark up text panel * mark up alert list * mark up dashboard list * mark up news panel * mark up annolist * mark up logs panel * mark up node-graph * mark up traces * mark up trend * mark up xychart * fix build
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { StandardEditorProps, SelectableValue } from '@grafana/data';
|
|
import { t } from '@grafana/i18n';
|
|
import { HorizontalGroup, RadioButtonGroup } from '@grafana/ui';
|
|
|
|
import { InputPrefix, NullsThresholdInput } from './NullsThresholdInput';
|
|
|
|
type Props = StandardEditorProps<boolean | number, { isTime: boolean }>;
|
|
|
|
export const SpanNullsEditor = ({ value, onChange, item }: Props) => {
|
|
const GAPS_OPTIONS: Array<SelectableValue<boolean | number>> = [
|
|
{
|
|
label: t('timeseries.span-nulls-editor.gaps-options.label-never', 'Never'),
|
|
value: false,
|
|
},
|
|
{
|
|
label: t('timeseries.span-nulls-editor.gaps-options.label-always', 'Always'),
|
|
value: true,
|
|
},
|
|
{
|
|
label: t('timeseries.span-nulls-editor.gaps-options.label-threshold', 'Threshold'),
|
|
value: 3600000, // 1h
|
|
},
|
|
];
|
|
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>
|
|
);
|
|
};
|