From 36d21fe640a542627f852f9cd8a350e3f923b4a3 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Thu, 20 Aug 2026 03:23:12 +0200 Subject: [PATCH] feat(frontend): add user setting to control navigation behaviour (#12669) follow up to https://github.com/inventree/InvenTree/pull/12585 --- docs/docs/settings/user.md | 1 + src/backend/InvenTree/common/setting/user.py | 8 ++++++++ .../src/components/tables/InvenTreeTable.tsx | 16 +++++++++------- .../src/pages/Index/Settings/UserSettings.tsx | 3 ++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/docs/settings/user.md b/docs/docs/settings/user.md index 6bb8162269..bb590bb6a1 100644 --- a/docs/docs/settings/user.md +++ b/docs/docs/settings/user.md @@ -33,6 +33,7 @@ The *Display Settings* screen shows general display configuration options: {{ usersetting("SHOW_EXTRA_MODEL_INFO") }} {{ usersetting("SHOW_FULL_LOCATION_IN_TABLES") }} {{ usersetting("DISPLAY_ITEMS_FINAL_LEVEL") }} +{{ usersetting("USE_TABLE_NAVIGATION") }} ### Search Settings diff --git a/src/backend/InvenTree/common/setting/user.py b/src/backend/InvenTree/common/setting/user.py index 24d0fccd15..bbbebe30db 100644 --- a/src/backend/InvenTree/common/setting/user.py +++ b/src/backend/InvenTree/common/setting/user.py @@ -296,4 +296,12 @@ USER_SETTINGS: dict[str, InvenTreeSettingsKeyType] = { 'default': False, 'validator': bool, }, + 'USE_TABLE_NAVIGATION': { + 'name': _('Enable Filtered Detail Navigation'), + 'description': _( + 'Enable persisting of filtered detail navigation parameters to the view url' + ), + 'default': True, + 'validator': bool, + }, } diff --git a/src/frontend/src/components/tables/InvenTreeTable.tsx b/src/frontend/src/components/tables/InvenTreeTable.tsx index 48039899a4..40bd5d3e4c 100644 --- a/src/frontend/src/components/tables/InvenTreeTable.tsx +++ b/src/frontend/src/components/tables/InvenTreeTable.tsx @@ -821,10 +821,11 @@ export function InvenTreeTableInternal>({ if (pk) { cancelEvent(event); - // If a model type is provided, navigate to the detail view for that model - const detailUrl = - getDetailNavigationUrl(record, index) ?? - getDetailUrl(tableProps.modelType, pk); + // If a model type is provided and USE_TABLE_NAVIGATION is enabled, navigate to the detail view for that model + const detailUrl = userSettings.isSet('USE_TABLE_NAVIGATION') + ? (getDetailNavigationUrl(record, index) ?? + getDetailUrl(tableProps.modelType, pk)) + : getDetailUrl(tableProps.modelType, pk); if (!showPreviewPanel || eventModified(event as any)) { navigateToLink(detailUrl, navigate, event); @@ -888,9 +889,10 @@ export function InvenTreeTableInternal>({ const recordIndex = tableState.records.findIndex( (item) => String(resolveItem(item, accessor)) === String(pk) ); - const detailUrl = - getDetailNavigationUrl(record, recordIndex) ?? - getDetailUrl(props.modelType, pk); + const detailUrl = userSettings.isSet('USE_TABLE_NAVIGATION') + ? (getDetailNavigationUrl(record, recordIndex) ?? + getDetailUrl(props.modelType, pk)) + : getDetailUrl(props.modelType, pk); const model: string | undefined = ModelInformationDict[props.modelType]?.label?.(); diff --git a/src/frontend/src/pages/Index/Settings/UserSettings.tsx b/src/frontend/src/pages/Index/Settings/UserSettings.tsx index d60aa0dfbd..6c8be61dae 100644 --- a/src/frontend/src/pages/Index/Settings/UserSettings.tsx +++ b/src/frontend/src/pages/Index/Settings/UserSettings.tsx @@ -66,7 +66,8 @@ export default function UserSettings() { 'SHOW_FULL_LOCATION_IN_TABLES', 'SHOW_FULL_CATEGORY_IN_TABLES', 'SHOW_BOM_SUBASSEMBLY_LEVELS', - 'DISPLAY_ITEMS_FINAL_LEVEL' + 'DISPLAY_ITEMS_FINAL_LEVEL', + 'USE_TABLE_NAVIGATION' ]} /> )