From f0822e0aef19b0bafb30d8c7f13e1ed0e2a346d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Fern=C3=A1ndez?= Date: Thu, 29 Feb 2024 12:19:59 +0100 Subject: [PATCH] ReturnToPrevious: Add this functionality to the "Go to panel" button on Alert rules (#83630) Add RTP to the 'Go to panel' button --- .../unified/components/rules/RuleDetailsActionButtons.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx b/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx index ca3fed1f825..0051f562af8 100644 --- a/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx @@ -160,8 +160,11 @@ export const RuleDetailsActionButtons = ({ rule, rulesSource, isViewMode }: Prop key="panel" variant="primary" icon="apps" - target="_blank" + target={isReturnToPreviousEnabled ? undefined : '_blank'} href={`d/${encodeURIComponent(dashboardUID)}?viewPanel=${encodeURIComponent(panelId)}`} + onClick={() => { + setReturnToPrevious(rule.name); + }} > Go to panel