feat(frontend): expose api interactions to plugins#11858
feat(frontend): expose api interactions to plugins#11858matmair wants to merge 9 commits intoinventree:masterfrom
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This is WIP; still need to untangle a few things |
move directly coupled functions and components
|
@matmair are you aware that plugins can already launch forms, using the hooks as listed above? These are passed through dynamically via the InvenTreePluginContext - allowing the plugin to simply call a function which launches a form (much like a DLL). All the plugin knows about is the call type and return type for these functions. |
|
i have tried working with that, but I am running into a bunch of state management issues and reimplementing a bunch of stuff like useInstance. Writing 4k lines of code for getting ui for 3 simple models with tables is unacceptable imo |
Check out this more recent plugin I have written: The frontend code is mostly just re-using existing components (including the entire table framework). If you can get it working this way, that's great! I had huge issues with the following: Multiple React VersionsIf you expose the components to TranslationTrying to get any translated components working within the plugin context was a nightmare. So, the build process dynamically hooks lingui to point to the one running in the browser If you manage to get it working this way it's probably going to be cleaner, I'll be interested to see what you come up with! |

Moves some fundamental API functions to the lib space:
This helps plugin devs that work close to the default API pattern by reducing manual coding effort massively.