mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 21:18:16 -06:00
14728 move plugins view from admin
This commit is contained in:
parent
f8199339f5
commit
ecd2504ce1
@ -20,6 +20,7 @@ __all__ = (
|
||||
'ImageAttachmentTable',
|
||||
'JournalEntryTable',
|
||||
'ObjectChangeTable',
|
||||
'PluginTable',
|
||||
'SavedFilterTable',
|
||||
'TaggedItemTable',
|
||||
'TagTable',
|
||||
@ -507,3 +508,17 @@ class JournalEntryTable(NetBoxTable):
|
||||
default_columns = (
|
||||
'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
|
||||
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.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
@ -1373,3 +1375,21 @@ class RenderMarkdownView(View):
|
||||
rendered = render_markdown(form.cleaned_data['text'])
|
||||
|
||||
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