Repository navigation
feat: add plugin support for custom page integration - #12900
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12900 +/- ##
==========================================
+ Coverage 87.24% 87.39% +0.14%
==========================================
Files 1507 1506 -1
Lines 103633 103309 -324
Branches 11690 11557 -133
==========================================
- Hits 90415 90287 -128
+ Misses 13152 12958 -194
+ Partials 66 64 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Co-authored-by: Matthias Mair <[email protected]>
|
@psxjt5 would you be able to dress the navigation highlighting detail? I think everything else looks good |
|
I would prefer if we could get this done here but only if this does not prolong this PR more than a week |
|
@SchrodingersGat is this changelog worthy? |
No problem. Thanks for all your help! |
|
@psxjt5 great implementation here, seems to work very well. Can you please add a |
@SchrodingersGat Changelog entry added here: fa8bf45 |
|
@psxjt5 looking into the frontend issues, seemingly not related |
|
@SchrodingersGat reads for merge |
|
@psxjt5 thanks for the contribution :) |





This PR adds functionality for plugins to add SPA routes, enabling plugins to define new frontend pages as required.
Code changes made:
routeUI feature type (backend) (mixins.py)get_ui_routesmethod to enable plugins to define custom routes (mixins.py)PluginUIFeatureType(frontend) (PluginUIFeature.tsx)RouteUIFeature(PluginUIFeatureTypes.ts)PluginRoutes.tsx)RemoteComponentmechanism (used with panels, dashboard widgets etc.) to load the source component specified by the plugin for the selected route.plugin/*route which directs /web/plugin/* requests to thePluginRouteshandler (router.tsx)user_interface_sample.pyandsample_route.js.ui/tests.pyrouteUI feature (ui.md)Defining a new page
New pages are therefore defined like this within a plugin:
Routes are exposed under the plugin-specific URL namespace. The resulting URL in this case is:
/web/plugin/my-plugin/page/<pk>.Utilised API Calls
The existing
usePluginUIFeatureendpoint has been extended to support theroutefeature type and is now called (withfeatureType: 'route') when someone navigates to a URL under theplugin/*prefix, so existing pages are unaffected.Component Rendering
Components are rendered using the existing
RemoteComponentmechanism.