mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-16 09:22:57 +00:00
The search drawer searches notes when the notes-search setting is enabled, but the "view all results" link only carried the plain search term - so results that matched only via their notes were missing from the full results table. Pass the search_notes flag through to the overview table URL when notes search is active; the table forwards URL query parameters to the API, where InvenTreeSearchFilter already supports search_notes.
This commit is contained in:
@@ -78,7 +78,8 @@ function QueryResultGroup({
|
|||||||
navigate,
|
navigate,
|
||||||
onClose,
|
onClose,
|
||||||
onRemove,
|
onRemove,
|
||||||
onResultClick
|
onResultClick,
|
||||||
|
searchNotes
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
searchText: string;
|
searchText: string;
|
||||||
query: SearchQuery;
|
query: SearchQuery;
|
||||||
@@ -86,6 +87,7 @@ function QueryResultGroup({
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onRemove: (query: ModelType) => void;
|
onRemove: (query: ModelType) => void;
|
||||||
onResultClick: (query: ModelType, pk: number, event: any) => void;
|
onResultClick: (query: ModelType, pk: number, event: any) => void;
|
||||||
|
searchNotes: boolean;
|
||||||
}>) {
|
}>) {
|
||||||
const modelInfo = useMemo(() => getModelInfo(query.model), [query.model]);
|
const modelInfo = useMemo(() => getModelInfo(query.model), [query.model]);
|
||||||
|
|
||||||
@@ -104,7 +106,11 @@ function QueryResultGroup({
|
|||||||
cancelEvent(event);
|
cancelEvent(event);
|
||||||
|
|
||||||
if (overviewUrl) {
|
if (overviewUrl) {
|
||||||
const url = `${overviewUrl}?search=${searchText}`;
|
// Keep the notes-search context so results found via their notes
|
||||||
|
// are also present in the full results table view
|
||||||
|
const url = `${overviewUrl}?search=${searchText}${
|
||||||
|
searchNotes ? '&search_notes=true' : ''
|
||||||
|
}`;
|
||||||
|
|
||||||
// Close drawer if opening in the same tab
|
// Close drawer if opening in the same tab
|
||||||
if (!eventModified(event)) {
|
if (!eventModified(event)) {
|
||||||
@@ -121,7 +127,7 @@ function QueryResultGroup({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[overviewUrl, searchText]
|
[overviewUrl, searchText, searchNotes]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (query.results.count == 0) {
|
if (query.results.count == 0) {
|
||||||
@@ -592,6 +598,7 @@ export function SearchDrawer({
|
|||||||
query={query}
|
query={query}
|
||||||
navigate={navigate}
|
navigate={navigate}
|
||||||
onClose={closeDrawer}
|
onClose={closeDrawer}
|
||||||
|
searchNotes={searchNotes}
|
||||||
onRemove={(query) => removeResults(query)}
|
onRemove={(query) => removeResults(query)}
|
||||||
onResultClick={(query, pk, event) =>
|
onResultClick={(query, pk, event) =>
|
||||||
onResultClick(query, pk, event)
|
onResultClick(query, pk, event)
|
||||||
|
|||||||
Reference in New Issue
Block a user