mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 12:05:53 +00:00
UI plugins custom features (#8137)
* initial implementation to let plugins provide custom ui features
* provide exportable types
* refactor ref into renderContext to make it more generic and support template preview area ui plugins
* rename 'renderContext' -> 'featureContext' as not all features may render something
* allow to specify the function name via the source file string divided by a colon
* Bump api version
* add tests
* add docs
* add docs
* debug: workflow
* debug: workflow
* fix tests
* fix tests hopefully
* apply suggestions from codereview
* trigger: ci
* Prove that coverage does not work
* Revert "Prove that coverage does not work"
This reverts commit 920c58ea6f
.
* potentially fix test???
This commit is contained in:
@ -20,7 +20,7 @@ When rendering certain content in the user interface, the rendering functions ar
|
||||
|
||||
Many of the pages in the InvenTree web interface are built using a series of "panels" which are displayed on the page. Custom panels can be added to these pages, by implementing the `get_ui_panels` method:
|
||||
|
||||
::: plugin.base.integration.UserInterfaceMixin.UserInterfaceMixin.get_ui_panels
|
||||
::: plugin.base.ui.mixins.UserInterfaceMixin.get_ui_panels
|
||||
options:
|
||||
show_bases: False
|
||||
show_root_heading: False
|
||||
@ -89,6 +89,46 @@ export function isPanelHidden(context) {
|
||||
}
|
||||
```
|
||||
|
||||
## Custom UI Functions
|
||||
|
||||
User interface plugins can also provide additional user interface functions. These functions can be provided via the `get_ui_features` method:
|
||||
|
||||
::: plugin.base.ui.mixins.UserInterfaceMixin.get_ui_features
|
||||
options:
|
||||
show_bases: False
|
||||
show_root_heading: False
|
||||
show_root_toc_entry: False
|
||||
show_sources: True
|
||||
summary: False
|
||||
members: []
|
||||
|
||||
::: plugin.samples.integration.user_interface_sample.SampleUserInterfacePlugin.get_ui_features
|
||||
options:
|
||||
show_bases: False
|
||||
show_root_heading: False
|
||||
show_root_toc_entry: False
|
||||
show_source: True
|
||||
members: []
|
||||
|
||||
|
||||
Currently the following functions can be extended:
|
||||
|
||||
### Template editors
|
||||
|
||||
The `template_editor` feature type can be used to provide custom template editors.
|
||||
|
||||
**Example:**
|
||||
|
||||
{{ includefile("src/backend/InvenTree/plugin/samples/static/plugin/sample_template.js", title="sample_template.js", fmt="javascript") }}
|
||||
|
||||
### Template previews
|
||||
|
||||
The `template_preview` feature type can be used to provide custom template previews. For an example see:
|
||||
|
||||
**Example:**
|
||||
|
||||
{{ includefile("src/backend/InvenTree/plugin/samples/static/plugin/sample_template.js", title="sample_template.js", fmt="javascript") }}
|
||||
|
||||
## Sample Plugin
|
||||
|
||||
A sample plugin which implements custom user interface functionality is provided in the InvenTree source code:
|
||||
|
Reference in New Issue
Block a user