diff --git a/public/app/features/search/components/DashboardSearch.tsx b/public/app/features/search/components/DashboardSearch.tsx index 51eb5316a47..d283e0e8c9a 100644 --- a/public/app/features/search/components/DashboardSearch.tsx +++ b/public/app/features/search/components/DashboardSearch.tsx @@ -67,6 +67,9 @@ function DashboardSearchNew({ onCloseSearch }: Props) {
{ + setInputValue(newQueryText); + }} showManage={false} queryText={query.query} includePanels={includePanels!} diff --git a/public/app/features/search/components/ManageDashboardsNew.tsx b/public/app/features/search/components/ManageDashboardsNew.tsx index 5e591176c99..8c40c37f389 100644 --- a/public/app/features/search/components/ManageDashboardsNew.tsx +++ b/public/app/features/search/components/ManageDashboardsNew.tsx @@ -64,6 +64,9 @@ export const ManageDashboardsNew = React.memo(({ folder }: Props) => { showManage={isEditor || hasEditPermissionInFolders || canSave} folderDTO={folder} queryText={query.query} + onQueryTextChange={(newQueryText) => { + setInputValue(newQueryText); + }} hidePseudoFolders={true} includePanels={includePanels!} setIncludePanels={setIncludePanels} diff --git a/public/app/features/search/page/components/SearchView.tsx b/public/app/features/search/page/components/SearchView.tsx index 5c8f45a9d54..5ee3c712f5f 100644 --- a/public/app/features/search/page/components/SearchView.tsx +++ b/public/app/features/search/page/components/SearchView.tsx @@ -28,6 +28,7 @@ type SearchViewProps = { showManage: boolean; folderDTO?: FolderDTO; hidePseudoFolders?: boolean; // Recent + starred + onQueryTextChange: (newQueryText: string) => void; includePanels: boolean; setIncludePanels: (v: boolean) => void; }; @@ -36,14 +37,14 @@ export const SearchView = ({ showManage, folderDTO, queryText, + onQueryTextChange, hidePseudoFolders, includePanels, setIncludePanels, }: SearchViewProps) => { const styles = useStyles2(getStyles); - const { query, onQueryChange, onTagFilterChange, onTagAdd, onDatasourceChange, onSortChange, onLayoutChange } = - useSearchQuery({}); + const { query, onTagFilterChange, onTagAdd, onDatasourceChange, onSortChange, onLayoutChange } = useSearchQuery({}); query.query = queryText; // Use the query value passed in from parent rather than from URL const [searchSelection, setSearchSelection] = useState(newSearchSelection()); @@ -126,7 +127,7 @@ export const SearchView = ({ clearSelection(); setListKey(Date.now()); // trigger again the search to the backend - onQueryChange(query.query); + onQueryTextChange(query.query); }; const renderResults = () => { @@ -145,7 +146,7 @@ export const SearchView = ({ variant="secondary" onClick={() => { if (query.query) { - onQueryChange(''); + onQueryTextChange(''); } if (query.tag?.length) { onTagFilterChange([]); @@ -238,7 +239,7 @@ export const SearchView = ({ onLayoutChange={(v) => { if (v === SearchLayout.Folders) { if (query.query) { - onQueryChange(''); // parent will clear the sort + onQueryTextChange(''); // parent will clear the sort } } onLayoutChange(v);