Fix plugin API signatures and dashboard JS for InvenTree compatibility
- Add context parameter to get_ui_panels and get_ui_dashboard_items - Fix renderDashboardItem signature to (target, data) per InvenTree API - Export plugin class from __init__.py for discovery
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
"""InvenTree 3D Print Demand Plugin."""
|
||||||
|
|
||||||
|
from .plugin import PrintDemandPlugin
|
||||||
|
|
||||||
|
__all__ = ["PrintDemandPlugin"]
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ class PrintDemandPlugin(SettingsMixin, UrlsMixin, UserInterfaceMixin, InvenTreeP
|
|||||||
re_path(r'^api/demand/', self.api_demand, name='api-demand'),
|
re_path(r'^api/demand/', self.api_demand, name='api-demand'),
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_ui_panels(self, request, **kwargs):
|
def get_ui_panels(self, request, context, **kwargs):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_ui_dashboard_items(self, request, **kwargs):
|
def get_ui_dashboard_items(self, request, context, **kwargs):
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'key': 'print-demand',
|
'key': 'print-demand',
|
||||||
|
|||||||
@@ -5,8 +5,11 @@
|
|||||||
* a colour-coded table showing stock vs demand for every 3D-printed part.
|
* a colour-coded table showing stock vs demand for every 3D-printed part.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function renderDashboardItem(context) {
|
export function renderDashboardItem(target, data) {
|
||||||
const target = context.target;
|
if (!target) {
|
||||||
|
console.error("No target provided to renderDashboardItem");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
target.innerHTML = '<em>Loading 3D print demand data...</em>';
|
target.innerHTML = '<em>Loading 3D print demand data...</em>';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user