From 239888f22983010576bb3a9135a7294e88c0c74a Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Tue, 13 Dec 2022 05:48:54 -0800 Subject: [PATCH] Snapshots: Build snapshot originalUrl on the backend (#60232) * Snapshots: Fix originalUrl spoof security issue * Store relative URL only & validate UID * use existing modal management tools * Dummy commit to nudge CI * Remove unused hooks file * Fix import after backport * Backport fixes Co-authored-by: kay delaney --- .../components/ConfirmModal/ConfirmModal.tsx | 8 ++- pkg/api/dashboard_snapshot.go | 23 ++++++-- .../dashboard/components/DashNav/DashNav.tsx | 56 +++++++++++++++++-- .../components/ShareModal/ShareSnapshot.tsx | 4 -- 4 files changed, 76 insertions(+), 15 deletions(-) diff --git a/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx b/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx index 86058fa945f..e7ce2635b1e 100644 --- a/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx +++ b/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx @@ -21,8 +21,12 @@ export interface ConfirmModalProps { description?: React.ReactNode; /** Text for confirm button */ confirmText: string; + /** Variant for confirm button */ + confirmVariant?: ButtonVariant; /** Text for dismiss button */ dismissText?: string; + /** Variant for dismiss button */ + dismissVariant?: ButtonVariant; /** Icon for the modal header */ icon?: IconName; /** Additional styling for modal container */ @@ -47,8 +51,10 @@ export const ConfirmModal = ({ body, description, confirmText, + confirmVariant = 'destructive', confirmationText, dismissText = 'Cancel', + dismissVariant = 'secondary', alternativeText, modalClass, icon = 'exclamation-triangle', @@ -85,7 +91,7 @@ export const ConfirmModal = ({ ) : null} -