add user setting
This commit is contained in:
parent
48f92e1a42
commit
5bcf8c2ef1
|
|
@ -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")}}
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in New Issue