mirror of
https://github.com/inventree/InvenTree.git
synced 2026-06-15 04:50:49 +00:00
Add some dummy data for the plugin panels
This commit is contained in:
@@ -424,8 +424,33 @@ class PluginPanelList(APIView):
|
||||
|
||||
# Extract all plugins from the registry which provide custom panels
|
||||
for _plugin in registry.with_mixin('panel', active=True):
|
||||
# TODO: Allow plugins to fill this data out
|
||||
...
|
||||
|
||||
panels = [
|
||||
{
|
||||
'plugin': 'myplugin',
|
||||
'name': 'test-plugin',
|
||||
'label': 'My Plugin',
|
||||
'icon': 'part',
|
||||
'content': '<div>hello world</div>',
|
||||
},
|
||||
{
|
||||
'plugin': 'myplugin',
|
||||
'name': 'test-plugin-2',
|
||||
'label': 'My Plugin 2',
|
||||
'icon': 'email',
|
||||
'content': '<div>hello world 2</div>',
|
||||
},
|
||||
{
|
||||
'plugin': 'myplugin',
|
||||
'name': 'test-plugin-3',
|
||||
'label': 'My Plugin 3',
|
||||
'icon': 'website',
|
||||
'content': '<div>hello world 3</div>',
|
||||
},
|
||||
]
|
||||
|
||||
return Response(PluginSerializers.PluginPanelSerializer(panels, many=True).data)
|
||||
|
||||
|
||||
@@ -437,7 +462,7 @@ plugin_api_urls = [
|
||||
'plugins/',
|
||||
include([
|
||||
path(
|
||||
'panel/',
|
||||
'panels/',
|
||||
include([
|
||||
path('', PluginPanelList.as_view(), name='api-plugin-panel-list')
|
||||
]),
|
||||
|
||||
@@ -311,9 +311,10 @@ class PluginPanelSerializer(serializers.Serializer):
|
||||
class Meta:
|
||||
"""Meta for serializer."""
|
||||
|
||||
fields = ['plugin', 'title', 'description', 'icon']
|
||||
fields = ['plugin', 'name', 'label', 'icon']
|
||||
|
||||
plugin = serializers.CharField(label=_('Plugin Key'))
|
||||
title = serializers.CharField(label=_('Panel Title'))
|
||||
description = serializers.CharField(label=_('Panel Description'))
|
||||
name = serializers.CharField(label=_('Panel Name'))
|
||||
label = serializers.CharField(label=_('Panel Label'))
|
||||
icon = serializers.CharField(label=_('Panel Icon'))
|
||||
content = serializers.CharField(label=_('Panel Content'))
|
||||
|
||||
Reference in New Issue
Block a user