From 9da3db1ddf02a29a037914991ba2e889940cb45d Mon Sep 17 00:00:00 2001 From: Adela Almasan <88068998+adela-almasan@users.noreply.github.com> Date: Wed, 24 Jan 2024 19:24:52 -0600 Subject: [PATCH] Annotations: Prevent creating on unsaved dashboard (#81200) --- public/app/plugins/panel/candlestick/CandlestickPanel.tsx | 6 +++--- public/app/plugins/panel/heatmap/HeatmapPanel.tsx | 2 +- .../app/plugins/panel/state-timeline/StateTimelinePanel.tsx | 2 +- .../app/plugins/panel/status-history/StatusHistoryPanel.tsx | 2 +- public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public/app/plugins/panel/candlestick/CandlestickPanel.tsx b/public/app/plugins/panel/candlestick/CandlestickPanel.tsx index 9f8e6c3c249..fdf2f395206 100644 --- a/public/app/plugins/panel/candlestick/CandlestickPanel.tsx +++ b/public/app/plugins/panel/candlestick/CandlestickPanel.tsx @@ -299,8 +299,8 @@ export const CandlestickPanel = ({ /> ); }} - maxWidth={options.tooltip.maxWidth} - maxHeight={options.tooltip.maxHeight} + maxWidth={options.tooltip?.maxWidth} + maxHeight={options.tooltip?.maxHeight} /> ) : ( <> @@ -320,7 +320,7 @@ export const CandlestickPanel = ({ annotations={data.annotations ?? []} config={uplotConfig} timeZone={timeZone} - newRange={newAnnotationRange} + newRange={enableAnnotationCreation ? newAnnotationRange : null} setNewRange={setNewAnnotationRange} /> ) : ( diff --git a/public/app/plugins/panel/heatmap/HeatmapPanel.tsx b/public/app/plugins/panel/heatmap/HeatmapPanel.tsx index 0751aaba3de..d8faa0f09a5 100644 --- a/public/app/plugins/panel/heatmap/HeatmapPanel.tsx +++ b/public/app/plugins/panel/heatmap/HeatmapPanel.tsx @@ -286,7 +286,7 @@ export const HeatmapPanel = ({ annotations={data.annotations ?? []} config={builder} timeZone={timeZone} - newRange={newAnnotationRange} + newRange={enableAnnotationCreation ? newAnnotationRange : null} setNewRange={setNewAnnotationRange} canvasRegionRendering={false} /> diff --git a/public/app/plugins/panel/state-timeline/StateTimelinePanel.tsx b/public/app/plugins/panel/state-timeline/StateTimelinePanel.tsx index 6c0c3ef7f0b..1dde9405064 100644 --- a/public/app/plugins/panel/state-timeline/StateTimelinePanel.tsx +++ b/public/app/plugins/panel/state-timeline/StateTimelinePanel.tsx @@ -249,7 +249,7 @@ export const StateTimelinePanel = ({ annotations={data.annotations ?? []} config={builder} timeZone={timeZone} - newRange={newAnnotationRange} + newRange={enableAnnotationCreation ? newAnnotationRange : null} setNewRange={setNewAnnotationRange} canvasRegionRendering={false} /> diff --git a/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx b/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx index 2cacd71287b..bbb724326ff 100644 --- a/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx +++ b/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx @@ -275,7 +275,7 @@ export const StatusHistoryPanel = ({ annotations={data.annotations ?? []} config={builder} timeZone={timeZone} - newRange={newAnnotationRange} + newRange={enableAnnotationCreation ? newAnnotationRange : null} setNewRange={setNewAnnotationRange} canvasRegionRendering={false} /> diff --git a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx index 6834fa6c3f0..951af4a0b40 100644 --- a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx +++ b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx @@ -170,7 +170,7 @@ export const TimeSeriesPanel = ({ annotations={data.annotations ?? []} config={uplotConfig} timeZone={timeZone} - newRange={newAnnotationRange} + newRange={enableAnnotationCreation ? newAnnotationRange : null} setNewRange={setNewAnnotationRange} /> ) : (