QueryHistory: Add tracking for copy query button (#61042)

* QueryHistory: Add tracking for copy query button

* add datasources to payload
This commit is contained in:
Giordano Ricci 2023-01-06 14:24:53 +00:00 committed by GitHub
parent fafae26068
commit 19c8f45a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,6 +189,11 @@ export function RichHistoryCard(props: Props) {
};
const onCopyQuery = () => {
const datasources = [...query.queries.map((q) => q.datasource?.type || 'unknown')];
reportInteraction('grafana_explore_query_history_copy_query', {
datasources,
mixed: Boolean(queryDsInstance?.meta.mixed),
});
const queriesToCopy = query.queries.map((q) => createQueryText(q, queryDsInstance)).join('\n');
copyStringToClipboard(queriesToCopy);
dispatch(notifyApp(createSuccessNotification('Query copied to clipboard')));