mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
14728 move plugins view from admin
This commit is contained in:
parent
f8199339f5
commit
ecd2504ce1
@ -20,6 +20,7 @@ __all__ = (
|
|||||||
'ImageAttachmentTable',
|
'ImageAttachmentTable',
|
||||||
'JournalEntryTable',
|
'JournalEntryTable',
|
||||||
'ObjectChangeTable',
|
'ObjectChangeTable',
|
||||||
|
'PluginTable',
|
||||||
'SavedFilterTable',
|
'SavedFilterTable',
|
||||||
'TaggedItemTable',
|
'TaggedItemTable',
|
||||||
'TagTable',
|
'TagTable',
|
||||||
@ -507,3 +508,17 @@ class JournalEntryTable(NetBoxTable):
|
|||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments'
|
'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class PluginTable(tables.Table):
|
||||||
|
verbose_name = tables.Column()
|
||||||
|
name = tables.Column()
|
||||||
|
author = tables.Column()
|
||||||
|
author_email = tables.Column()
|
||||||
|
description = tables.Column()
|
||||||
|
version = tables.Column()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
attrs = {
|
||||||
|
'class': 'table table-hover object-list',
|
||||||
|
}
|
||||||
|
@ -136,4 +136,8 @@ urlpatterns = [
|
|||||||
|
|
||||||
# Markdown
|
# Markdown
|
||||||
path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"),
|
path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"),
|
||||||
|
|
||||||
|
# Plugins
|
||||||
|
path('plugins/', views.PluginListView.as_view(), name='plugin_list'),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from django.apps import apps
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
@ -1373,3 +1375,21 @@ class RenderMarkdownView(View):
|
|||||||
rendered = render_markdown(form.cleaned_data['text'])
|
rendered = render_markdown(form.cleaned_data['text'])
|
||||||
|
|
||||||
return HttpResponse(rendered)
|
return HttpResponse(rendered)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Plugins
|
||||||
|
#
|
||||||
|
|
||||||
|
class PluginListView(LoginRequiredMixin, View):
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
plugins = [apps.get_app_config(plugin) for plugin in settings.PLUGINS]
|
||||||
|
table = tables.PluginTable(plugins)
|
||||||
|
# table.configure(request)
|
||||||
|
|
||||||
|
return render(request, 'extras/plugin_list.html', {
|
||||||
|
'plugins': plugins,
|
||||||
|
'active_tab': 'api-tokens',
|
||||||
|
'table': table,
|
||||||
|
})
|
||||||
|
@ -454,6 +454,17 @@ ADMIN_MENU = Menu(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
MenuGroup(
|
||||||
|
label=_('Plugins'),
|
||||||
|
items=(
|
||||||
|
MenuItem(
|
||||||
|
link='extras:plugin_list',
|
||||||
|
link_text=_('Plugins'),
|
||||||
|
permissions=['core.view_configrevision'],
|
||||||
|
staff_only=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user