mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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
This commit is contained in:
parent
b7d26b12dd
commit
f704d103bb
@ -88,7 +88,7 @@ class UnThemedRichHistory extends PureComponent<RichHistoryProps, RichHistorySta
|
||||
datasourceFilters: store.getObject(RICH_HISTORY_SETTING_KEYS.datasourceFilters, null),
|
||||
retentionPeriod: store.getObject(RICH_HISTORY_SETTING_KEYS.retentionPeriod, 7),
|
||||
starredTabAsFirstTab: store.getBool(RICH_HISTORY_SETTING_KEYS.starredTabAsFirstTab, false),
|
||||
activeDatasourceOnly: store.getBool(RICH_HISTORY_SETTING_KEYS.activeDatasourceOnly, false),
|
||||
activeDatasourceOnly: store.getBool(RICH_HISTORY_SETTING_KEYS.activeDatasourceOnly, true),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import { GrafanaTheme, AppEvents, DataSourceApi } from '@grafana/data';
|
||||
import { RichHistoryQuery, ExploreId } from 'app/types/explore';
|
||||
import { copyStringToClipboard, createUrlFromRichHistory, createQueryText } from 'app/core/utils/richHistory';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { StoreState } from 'app/types';
|
||||
import { StoreState, CoreEvents } from 'app/types';
|
||||
|
||||
import { changeDatasource, updateRichHistory, setQueries } from '../state/actions';
|
||||
export interface Props {
|
||||
@ -183,8 +183,22 @@ export function RichHistoryCard(props: Props) {
|
||||
};
|
||||
|
||||
const onDeleteQuery = () => {
|
||||
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 = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user