From 049351ec5dcf81d78da989a79dac31a0d365e505 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Thu, 25 Nov 2021 04:55:28 -0500 Subject: [PATCH] annotations editor menu should not appear if annotations are disabled (#42068) (#42128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 410044fa05af375adc4fe8e41e068d9fd3c08520) Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com> Co-authored-by: Zoltán Bedi --- .../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 2a463322c97..725c13988cf 100644 --- a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx +++ b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx @@ -69,39 +69,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 && (