Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PUI] Plugin settings UI #8228

Merged
merged 25 commits into from
Oct 7, 2024

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Oct 1, 2024

Adds functionality to render custom "configuration" UI elements for a plugin, in the new interface.

Expands existing functionality similar to how custom panels are implemented.

The plugin can dynamically render content to this window:

image

TODO

  • Playwright / UI tests

@SchrodingersGat SchrodingersGat added old user interface Issues with Old User interface Platform UI Related to the React based User Interface enhancement This is an suggested enhancement or new feature plugin Plugin ecosystem labels Oct 1, 2024
@SchrodingersGat SchrodingersGat added this to the 0.17.0 milestone Oct 1, 2024
Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 43fce97
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/6703bd460dbde40008c15967
😎 Deploy Preview https://deploy-preview-8228--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 92 (no change from production)
SEO: 70 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@SchrodingersGat
Copy link
Member Author

And another example, from the wireviz plugin:

image

Copy link
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, there seems to be features removed without a callout in the PR message.

Could we add frontend tests to ensure the integration actually works?

Copy link
Contributor

@wolflu05 wolflu05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that you have implemented this, this is a great way forward.

However I'm not sure if we really should build lots of similar functionality. Instead, I would prefer if we could build one generic method for integrating custom frontend portions into the ui, so that we don't have to build the same thing (an api endpoint, a plugin function to get the content, a method for rendering a template and providing context from the plugin to the js function, ...) over and over again with different plugin apis (that potentially also confused plugin devs and provides bad dx.

That's why I started to implement the custom ui features as a very generic and abstract interface with custom ts types that can handle various contexts provided by different sources. (With the inventree npm package, this gets even better from a dx perspective)

Maybe for this integration that's a bit overkill to use the custom ui features, but for other ui integrations I would really like to see the generic way improved rather than than implementing the same thing over and over again?

What do you think @matmair ?

@SchrodingersGat
Copy link
Member Author

@wolflu05 I'm all for refactoring / making this more generic. Maybe we can do that on next feature integration, or as a separate PR?

@SchrodingersGat
Copy link
Member Author

Q: Why is this removed?

@matmair I have slightly tweaked the mechanism for switching between "user settings" / "system settings" / "admin section" - the functionality is still there but visually cleaned up a bit

@SchrodingersGat
Copy link
Member Author

Playwright testing has now been added too

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 40.95238% with 62 lines in your changes missing coverage. Please review.

Project coverage is 84.22%. Comparing base (36e3159) to head (43fce97).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/backend/InvenTree/plugin/models.py 16.66% 20 Missing ⚠️
...end/src/components/plugins/PluginSettingsPanel.tsx 13.63% 19 Missing ⚠️
...c/frontend/src/components/plugins/PluginDrawer.tsx 25.00% 9 Missing ⚠️
src/frontend/src/tables/plugin/PluginListTable.tsx 22.22% 7 Missing ⚠️
src/backend/InvenTree/plugin/plugin.py 54.54% 5 Missing ⚠️
...lugin/samples/integration/user_interface_sample.py 75.00% 1 Missing ⚠️
...c/frontend/src/components/plugins/PluginSource.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8228      +/-   ##
==========================================
- Coverage   84.26%   84.22%   -0.05%     
==========================================
  Files        1160     1162       +2     
  Lines       52442    52513      +71     
  Branches     1897     1894       -3     
==========================================
+ Hits        44191    44227      +36     
- Misses       7790     7821      +31     
- Partials      461      465       +4     
Flag Coverage Δ
backend 85.98% <50.00%> (-0.04%) ⬇️
pui 65.93% <32.07%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SchrodingersGat SchrodingersGat merged commit 798e25a into inventree:master Oct 7, 2024
26 checks passed
@SchrodingersGat SchrodingersGat deleted the plugin-settings-ui branch October 7, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an suggested enhancement or new feature old user interface Issues with Old User interface Platform UI Related to the React based User Interface plugin Plugin ecosystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants