mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Nested folders: Redo search query when actions complete (#68102)
redo search query if searching when actions complete
This commit is contained in:
parent
1e8cad625b
commit
135b0a25aa
@ -4,6 +4,7 @@ import React from 'react';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { Button, useStyles2 } from '@grafana/ui';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { useSearchStateManager } from 'app/features/search/state/SearchStateManager';
|
||||
import { useDispatch, useSelector } from 'app/types';
|
||||
import { ShowModalReactEvent } from 'app/types/events';
|
||||
|
||||
@ -33,6 +34,8 @@ export function BrowseActions() {
|
||||
const selectedFolders = Object.keys(selectedItems.folder).filter((uid) => selectedItems.folder[uid]);
|
||||
const rootItems = useSelector(rootItemsSelector);
|
||||
const childrenByParentUID = useSelector(childrenByParentUIDSelector);
|
||||
const [, stateManager] = useSearchStateManager();
|
||||
const isSearching = stateManager.hasSearchFilters();
|
||||
|
||||
const onActionComplete = (parentsToRefresh: Set<string | undefined>) => {
|
||||
dispatch(
|
||||
@ -40,9 +43,15 @@ export function BrowseActions() {
|
||||
isSelected: false,
|
||||
})
|
||||
);
|
||||
if (isSearching) {
|
||||
// Redo search query
|
||||
stateManager.doSearchWithDebounce();
|
||||
} else {
|
||||
// Refetch parents
|
||||
for (const parentUID of parentsToRefresh) {
|
||||
dispatch(fetchChildren(parentUID));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onDelete = async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user