From 410044fa05af375adc4fe8e41e068d9fd3c08520 Mon Sep 17 00:00:00 2001 From: Victor Marin <36818606+mdvictor@users.noreply.github.com> Date: Tue, 23 Nov 2021 14:16:11 +0200 Subject: [PATCH] annotations editor menu should not appear if annotations are disabled (#42068) --- .../panel/timeseries/TimeSeriesPanel.tsx | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx index 56ed14fd73d..359cf475ad6 100644 --- a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx +++ b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx @@ -71,39 +71,45 @@ export const TimeSeriesPanel: React.FC = ({ )} {/* Enables annotations creation*/} - - {({ startAnnotating }) => { - return ( - + {({ startAnnotating }) => { + return ( + { - if (!p) { - return; - } - startAnnotating({ coords: p.coords }); - }, - }, - ], + label: 'Add annotation', + ariaLabel: 'Add annotation', + icon: 'comment-alt', + onClick: (e, p) => { + if (!p) { + return; + } + startAnnotating({ coords: p.coords }); + }, }, - ] - : [] - } - /> - ); - }} - + ], + }, + ]} + /> + ); + }} + + ) : ( + + )} {data.annotations && (