2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-15 07:48:51 +00:00

[UI] Import context (#11685)

* Refactor ImporterDrawer

- Use a single, globally accessible object
- Provide global state management

* Expose global importer state to the plugin interface

* Improve registration of data import serializers

* Update frontend version / docs

* Bump API version
This commit is contained in:
Oliver
2026-04-08 06:01:00 +10:00
committed by GitHub
parent 448d775690
commit 437dddc75f
15 changed files with 178 additions and 117 deletions

View File

@@ -48,6 +48,13 @@ export type InvenTreeFormsContext = {
stockActions: StockAdjustmentFormsContext;
};
export type ImporterDrawerContext = {
open: (sessionId: number, options?: { onClose?: () => void }) => void;
close: () => void;
isOpen: () => boolean;
sessionId: () => number | null;
};
/**
* A set of properties which are passed to a plugin,
* for rendering an element in the user interface.
@@ -59,6 +66,8 @@ export type InvenTreeFormsContext = {
* @param globalSettings - The global settings (see ../states/SettingsState.tsx)
* @param navigate - The navigation function (see react-router-dom)
* @param theme - The current Mantine theme
* @param forms - A set of functions for opening various API forms (see ../components/Forms.tsx)
* @param importer - A set of functions for controlling the global importer drawer (see ../components/importer/GlobalImporterDrawer.tsx)
* @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')
* @param host - The current host URL
* @param i18n - The i18n instance for translations (from @lingui/core)
@@ -87,6 +96,7 @@ export type InvenTreePluginContext = {
navigate: NavigateFunction;
theme: MantineTheme;
forms: InvenTreeFormsContext;
importer: ImporterDrawerContext;
colorScheme: MantineColorScheme;
model?: ModelType | string;
id?: string | number | null;