mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-20 20:19:44 +00:00
feat(frontend): add user setting to control navigation behaviour (#12669)
follow up to https://github.com/inventree/InvenTree/pull/12585
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -821,10 +821,11 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
||||
|
||||
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<T extends Record<string, any>>({
|
||||
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?.();
|
||||
|
||||
@@ -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'
|
||||
]}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user