TimeSeriesPanel: Allow threshold indicators without change handler (#60575)

This commit is contained in:
Gilles De Mey
2022-12-21 16:18:35 +01:00
committed by GitHub
parent 44232569a8
commit 16c6f223ba
8 changed files with 53 additions and 68 deletions

View File

@@ -38,7 +38,8 @@ export const CandlestickPanel: React.FC<CandlestickPanelProps> = ({
onChangeTimeRange,
replaceVariables,
}) => {
const { sync, canAddAnnotations, onThresholdsChange, canEditThresholds, onSplitOpen } = usePanelContext();
const { sync, canAddAnnotations, onThresholdsChange, canEditThresholds, showThresholds, onSplitOpen } =
usePanelContext();
const getFieldLinks = (field: Field, rowIndex: number) => {
return getFieldLinksForExplore({ field, rowIndex, splitOpenFn: onSplitOpen, range: timeRange });
@@ -320,11 +321,11 @@ export const CandlestickPanel: React.FC<CandlestickPanelProps> = ({
/>
)}
{canEditThresholds && onThresholdsChange && (
{((canEditThresholds && onThresholdsChange) || showThresholds) && (
<ThresholdControlsPlugin
config={config}
fieldConfig={fieldConfig}
onThresholdsChange={onThresholdsChange}
onThresholdsChange={canEditThresholds ? onThresholdsChange : undefined}
/>
)}