add user setting

This commit is contained in:
Oliver Walters 2026-07-01 13:02:08 +00:00
parent 48f92e1a42
commit 5bcf8c2ef1
4 changed files with 16 additions and 0 deletions

View File

@ -25,6 +25,7 @@ The *Display Settings* screen shows general display configuration options:
{{ usersetting("BARCODE_IN_FORM_FIELDS") }}
{{ usersetting("DATE_DISPLAY_FORMAT") }}
{{ usersetting("FORMS_CLOSE_USING_ESCAPE") }}
{{ usersetting("ENABLE_PREVIEW_PANEL") }}
{{ usersetting("DISPLAY_STOCKTAKE_TAB") }}
{{ usersetting("SHOW_FULL_CATEGORY_IN_TABLES")}}
{{ usersetting("SHOW_BOM_SUBASSEMBLY_LEVELS")}}

View File

@ -223,6 +223,12 @@ USER_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
('MMM DD YYYY', 'Feb 22 2022'),
],
},
'ENABLE_PREVIEW_PANEL': {
'name': _('Enable Preview Panel'),
'description': _('Display a preview panel when selecting items in tables'),
'default': True,
'validator': bool,
},
'DISPLAY_STOCKTAKE_TAB': {
'name': _('Show Stock History'),
'description': _('Display stock history information in the part detail page'),

View File

@ -1,7 +1,11 @@
import { usePreviewDrawerState } from '../../states/PreviewDrawerState';
import { useUserSettingsState } from '../../states/SettingsStates';
import PreviewDrawer from './PreviewDrawer';
export default function GlobalPreviewDrawer() {
const enabled = useUserSettingsState((state) =>
state.isSet('ENABLE_PREVIEW_PANEL')
);
const isOpen = usePreviewDrawerState((state) => state.isOpen);
const modelType = usePreviewDrawerState((state) => state.modelType);
const id = usePreviewDrawerState((state) => state.id);
@ -9,6 +13,10 @@ export default function GlobalPreviewDrawer() {
const preview = usePreviewDrawerState((state) => state.preview);
const closePreview = usePreviewDrawerState((state) => state.closePreview);
if (!enabled) {
return null;
}
return (
<PreviewDrawer
modelType={modelType}

View File

@ -59,6 +59,7 @@ export default function UserSettings() {
'BARCODE_IN_FORM_FIELDS',
'DATE_DISPLAY_FORMAT',
'FORMS_CLOSE_USING_ESCAPE',
'ENABLE_PREVIEW_PANEL',
'DISPLAY_STOCKTAKE_TAB',
'ENABLE_LAST_BREADCRUMB',
'SHOW_EXTRA_MODEL_INFO',