EmptyState: Add event tracking to `CommandPalette` and `BrowseDashboards` (#97780)

pull/97736/head^2
Laura Fernández 7 months ago committed by GitHub
parent 61d71ec5b1
commit f51b58488c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      public/app/features/browse-dashboards/BrowseDashboardsPage.tsx
  2. 3
      public/app/features/commandPalette/CommandPalette.tsx

@ -60,6 +60,9 @@ const BrowseDashboardsPage = memo(() => {
if (!isSearching && searchState.result) {
stateManager.setState({ result: undefined, includePanels: undefined });
}
if (isSearching && searchState.result?.totalRows === 0) {
reportInteraction('grafana_empty_state_shown', { source: 'browse_dashboards' });
}
}, [isSearching, searchState.result, stateManager]);
const { data: folderDTO } = useGetFolderQuery(folderUID ?? skipToken);
@ -114,7 +117,6 @@ const BrowseDashboardsPage = memo(() => {
origin: window.location.pathname === getConfig().appSubUrl + '/dashboards' ? 'Dashboards' : 'Folder view',
});
};
return (
<Page
navId="dashboards/browse"

@ -122,6 +122,9 @@ const RenderResults = ({ isFetchingSearchResults, searchResults }: RenderResults
}, [kbarResults, dashboardsSectionTitle, dashboardResultItems, foldersSectionTitle, folderResultItems]);
const showEmptyState = !isFetchingSearchResults && items.length === 0;
useEffect(() => {
showEmptyState && reportInteraction('grafana_empty_state_shown', { source: 'command_palette' });
}, [showEmptyState]);
return showEmptyState ? (
<EmptyState

Loading…
Cancel
Save