diff --git a/public/app/features/search/components/DashboardSearch.tsx b/public/app/features/search/components/DashboardSearch.tsx
index 813f4329f63..ed0054f8648 100644
--- a/public/app/features/search/components/DashboardSearch.tsx
+++ b/public/app/features/search/components/DashboardSearch.tsx
@@ -60,7 +60,13 @@ function DashboardSearchNew({ onCloseSearch }: Props) {
-
+ {
+ setInputValue(newQueryText);
+ }}
+ />
diff --git a/public/app/features/search/components/ManageDashboardsNew.tsx b/public/app/features/search/components/ManageDashboardsNew.tsx
index 22468b9fc1f..9651f3f8b96 100644
--- a/public/app/features/search/components/ManageDashboardsNew.tsx
+++ b/public/app/features/search/components/ManageDashboardsNew.tsx
@@ -57,6 +57,9 @@ export const ManageDashboardsNew = React.memo(({ folder }: Props) => {
showManage={isEditor || hasEditPermissionInFolders || canSave}
folderDTO={folder}
queryText={query.query}
+ onQueryTextChange={(newQueryText) => {
+ setInputValue(newQueryText);
+ }}
hidePseudoFolders={true}
/>
>
diff --git a/public/app/features/search/page/components/SearchView.tsx b/public/app/features/search/page/components/SearchView.tsx
index 52a7dfabeed..df486eaa32e 100644
--- a/public/app/features/search/page/components/SearchView.tsx
+++ b/public/app/features/search/page/components/SearchView.tsx
@@ -27,13 +27,19 @@ type SearchViewProps = {
showManage: boolean;
folderDTO?: FolderDTO;
hidePseudoFolders?: boolean; // Recent + starred
+ onQueryTextChange: (newQueryText: string) => void;
};
-export const SearchView = ({ showManage, folderDTO, queryText, hidePseudoFolders }: SearchViewProps) => {
+export const SearchView = ({
+ showManage,
+ folderDTO,
+ queryText,
+ hidePseudoFolders,
+ onQueryTextChange,
+}: 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());
@@ -101,7 +107,7 @@ export const SearchView = ({ showManage, folderDTO, queryText, hidePseudoFolders
clearSelection();
setListKey(Date.now());
// trigger again the search to the backend
- onQueryChange(query.query);
+ onQueryTextChange(query.query);
};
const renderResults = () => {
@@ -120,7 +126,7 @@ export const SearchView = ({ showManage, folderDTO, queryText, hidePseudoFolders
variant="secondary"
onClick={() => {
if (query.query) {
- onQueryChange('');
+ onQueryTextChange('');
}
if (query.tag?.length) {
onTagFilterChange([]);
@@ -202,7 +208,7 @@ export const SearchView = ({ showManage, folderDTO, queryText, hidePseudoFolders
onLayoutChange={(v) => {
if (v === SearchLayout.Folders) {
if (query.query) {
- onQueryChange(''); // parent will clear the sort
+ onQueryTextChange(''); // parent will clear the sort
}
}
onLayoutChange(v);