mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 18:52:34 +08:00
EmptyState: Add event tracking to CommandPalette
and BrowseDashboards
(#97780)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user