[UI] Add search result preview (#12475)

* [UI] Add search result preview

* Updated search docs
This commit is contained in:
Oliver
2026-07-27 16:02:33 +10:00
committed by GitHub
parent 35f2f1aab6
commit eb5138127b
5 changed files with 33 additions and 0 deletions
+11
View File
@@ -16,6 +16,17 @@ Search results are organized by category (e.g. Parts, Stock, Manufacturing, etc.
To navigate to the detail page for a particular search result, simply click on the desired result from the search results list. This will take you directly to the relevant page within the InvenTree system, allowing you to view and interact with the specific item or information you were searching for.
### Preview Panel
Instead of navigating directly to a result's detail page, search results can be configured to open in the [preview panel](./preview_panels.md), keeping the global search menu open behind it.
To enable this behavior, both of the following user settings must be enabled, found in the *Search* tab of the [user settings](../../settings/user.md) page:
- **Table Preview Panel** - enables the preview panel feature generally
- **Search Results Preview Panel** - enables the preview panel specifically for global search results
With both settings enabled, clicking on a search result opens the preview drawer instead of navigating away. As with other preview panel usages, hold `Ctrl` (or `Cmd` on macOS) while clicking, or middle-click, to bypass the preview and navigate directly to the detail page.
### Full Results
The "global search" menu provides a limited set of search results for each category, typically showing the most relevant or recent results. To view the full set of search results for a particular category, click on the "View all results" button located at the top-left of the search results list for that category:
+1
View File
@@ -43,6 +43,7 @@ Customize settings for search results:
{{ usersetting("SEARCH_WHOLE") }}
{{ usersetting("SEARCH_REGEX") }}
{{ usersetting("SEARCH_NOTES") }}
{{ usersetting("SEARCH_RESULTS_PREVIEW_PANEL") }}
{{ usersetting("SEARCH_PREVIEW_RESULTS") }}
{{ usersetting("SEARCH_PREVIEW_SHOW_PARTS") }}
{{ usersetting("SEARCH_HIDE_INACTIVE_PARTS") }}
@@ -159,6 +159,14 @@ USER_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
'default': 10,
'validator': [int, MinValueValidator(1)],
},
'SEARCH_RESULTS_PREVIEW_PANEL': {
'name': _('Search Results Preview Panel'),
'description': _(
'Open search results in the preview panel, rather than navigating directly to the result'
),
'default': False,
'validator': bool,
},
'SEARCH_REGEX': {
'name': _('Regex Search'),
'description': _('Enable regular expressions in search queries'),
@@ -47,6 +47,7 @@ import {
} from '@lib/functions/Navigation';
import { showNotification } from '@mantine/notifications';
import { api } from '../../App';
import { openGlobalPreview } from '../../states/PreviewDrawerState';
import { useUserSettingsState } from '../../states/SettingsStates';
import { useUserState } from '../../states/UserState';
import { RenderInstance } from '../render/Instance';
@@ -468,6 +469,17 @@ export function SearchDrawer({
return;
}
const showPreviewPanel =
userSettings.isSet('ENABLE_PREVIEW_PANEL') &&
userSettings.isSet('SEARCH_RESULTS_PREVIEW_PANEL');
if (showPreviewPanel && !eventModified(event)) {
// Open the result in the preview panel, keeping the search drawer open
cancelEvent(event);
openGlobalPreview(query, pk);
return;
}
if (eventModified(event)) {
// Keep the drawer open in this condition
} else {
@@ -80,6 +80,7 @@ export default function UserSettings() {
'SEARCH_WHOLE',
'SEARCH_REGEX',
'SEARCH_NOTES',
'SEARCH_RESULTS_PREVIEW_PANEL',
'SEARCH_PREVIEW_RESULTS',
'SEARCH_PREVIEW_SHOW_PARTS',
'SEARCH_HIDE_INACTIVE_PARTS',