From f704d103bb78e4e30e49ed2d9557c846fd97ef9c Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Wed, 24 Jun 2020 09:50:46 +0200 Subject: [PATCH] Rich history: Updates for default settings and starred queries deletion (#25732) * Update show only queries for current data source to true * Add confirmation modal when deleting starred queries --- .../explore/RichHistory/RichHistory.tsx | 2 +- .../explore/RichHistory/RichHistoryCard.tsx | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/public/app/features/explore/RichHistory/RichHistory.tsx b/public/app/features/explore/RichHistory/RichHistory.tsx index 0c9e1a13859..3025c115f09 100644 --- a/public/app/features/explore/RichHistory/RichHistory.tsx +++ b/public/app/features/explore/RichHistory/RichHistory.tsx @@ -88,7 +88,7 @@ class UnThemedRichHistory extends PureComponent { - updateRichHistory(query.ts, 'delete'); - appEvents.emit(AppEvents.alertSuccess, ['Query deleted']); + // For starred queries, we want confirmation. For non-starred, we don't. + if (query.starred) { + appEvents.emit(CoreEvents.showConfirmModal, { + title: 'Delete', + text: 'Are you sure you want to permanently delete your starred query?', + yesText: 'Delete', + icon: 'trash-alt', + onConfirm: () => { + updateRichHistory(query.ts, 'delete'); + appEvents.emit(AppEvents.alertSuccess, ['Query deleted']); + }, + }); + } else { + updateRichHistory(query.ts, 'delete'); + appEvents.emit(AppEvents.alertSuccess, ['Query deleted']); + } }; const onStarrQuery = () => {