feat: New / Refactor "Nav Mixin" (#9283)

* [FR/P-UI] New / Refactor "Nav Mixin"
Fixes #5269

* remove logging

* fix sample item that causes issues

* Add test coverage

* Update src/frontend/src/components/plugins/PluginUIFeatureTypes.ts

Co-authored-by: Lukas <76838159+wolflu05@users.noreply.github.com>

* [FR/P-UI] New / Refactor "Nav Mixin"
Fixes #5269

* fix style

* remove requirement for source

* fix import

* bump api version

---------

Co-authored-by: Lukas <76838159+wolflu05@users.noreply.github.com>
This commit is contained in:
Matthias Mair
2025-04-20 11:22:58 +10:00
committed by GitHub
co-authored by Lukas
parent 058aa190d9
commit 6b0a082b5a
9 changed files with 84 additions and 12 deletions
@@ -197,6 +197,17 @@ class SampleUserInterfacePlugin(SettingsMixin, UserInterfaceMixin, InvenTreePlug
}
]
def get_ui_navigation_items(self, request, context, **kwargs):
"""Return a list of custom navigation items."""
return [
{
'key': 'sample-nav-item',
'title': 'Sample Nav Item',
'icon': 'ti:menu',
'options': {'url': '/sample/page/'},
}
]
def get_admin_context(self) -> dict:
"""Return custom context data which can be rendered in the admin panel."""
return {'apple': 'banana', 'foo': 'bar', 'hello': 'world'}