mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 08:38:16 -06:00
14731 review changes
This commit is contained in:
parent
3faf6dfbac
commit
56fb5382a9
@ -63,6 +63,7 @@ class Plugin:
|
|||||||
release_recent_history: list[PluginVersion] = field(default_factory=list)
|
release_recent_history: list[PluginVersion] = field(default_factory=list)
|
||||||
is_local: bool = False # extra field for locally installed plugins
|
is_local: bool = False # extra field for locally installed plugins
|
||||||
is_installed: bool = False
|
is_installed: bool = False
|
||||||
|
installed_version: str = ''
|
||||||
|
|
||||||
|
|
||||||
def get_local_plugins():
|
def get_local_plugins():
|
||||||
@ -81,6 +82,7 @@ def get_local_plugins():
|
|||||||
description_short=plugin_config.description,
|
description_short=plugin_config.description,
|
||||||
is_local=True,
|
is_local=True,
|
||||||
is_installed=True,
|
is_installed=True,
|
||||||
|
installed_version=plugin_config.version,
|
||||||
)
|
)
|
||||||
|
|
||||||
return plugins
|
return plugins
|
||||||
|
@ -62,11 +62,15 @@ class CatalogPluginTable(BaseTable):
|
|||||||
updated_at = columns.DateTimeColumn(
|
updated_at = columns.DateTimeColumn(
|
||||||
verbose_name=_('Updated')
|
verbose_name=_('Updated')
|
||||||
)
|
)
|
||||||
|
installed_version = tables.Column(
|
||||||
|
verbose_name=_('Installed version')
|
||||||
|
)
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
empty_text = _('No plugin data found')
|
empty_text = _('No plugin data found')
|
||||||
fields = (
|
fields = (
|
||||||
'title_short', 'author', 'is_local', 'is_installed', 'is_certified', 'created_at', 'updated_at',
|
'title_short', 'author', 'is_local', 'is_installed', 'is_certified', 'created_at', 'updated_at',
|
||||||
|
'installed_version',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'title_short', 'author', 'is_local', 'is_installed', 'is_certified', 'created_at', 'updated_at',
|
'title_short', 'author', 'is_local', 'is_installed', 'is_certified', 'created_at', 'updated_at',
|
||||||
|
@ -654,7 +654,7 @@ class PluginListView(UserPassesTestMixin, View):
|
|||||||
|
|
||||||
plugins = get_plugins().values()
|
plugins = get_plugins().values()
|
||||||
if q:
|
if q:
|
||||||
plugins = [obj for obj in plugins if q.casefold() in obj.name.casefold()]
|
plugins = [obj for obj in plugins if q.casefold() in obj.title_short.casefold()]
|
||||||
|
|
||||||
table = CatalogPluginTable(plugins, user=request.user)
|
table = CatalogPluginTable(plugins, user=request.user)
|
||||||
table.configure(request)
|
table.configure(request)
|
||||||
@ -678,6 +678,8 @@ class PluginView(UserPassesTestMixin, View):
|
|||||||
def get(self, request, name):
|
def get(self, request, name):
|
||||||
|
|
||||||
plugins = get_plugins()
|
plugins = get_plugins()
|
||||||
|
if name not in plugins:
|
||||||
|
raise Http404(_("Plugin {name} not found").format(name=name))
|
||||||
plugin = plugins[name]
|
plugin = plugins[name]
|
||||||
|
|
||||||
table = PluginVersionTable(plugin.release_recent_history, user=request.user)
|
table = PluginVersionTable(plugin.release_recent_history, user=request.user)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
{% block subtitle %}
|
{% block subtitle %}
|
||||||
<div class="text-secondary fs-5">
|
<div class="text-secondary fs-5">
|
||||||
{{ plugin.tag_line }}
|
{{ plugin.tag_line }}
|
||||||
<a href="{{ plugin.homepage.url }}" target="_blank">Learn more <i class="mdi mdi-launch"></i></a>
|
<a href="{{ plugin.homepage_url }}" target="_blank">Learn more <i class="mdi mdi-launch"></i></a>
|
||||||
</div>
|
</div>
|
||||||
{% endblock subtitle %}
|
{% endblock subtitle %}
|
||||||
|
|
||||||
@ -53,12 +53,40 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
<h5 class="card-header">{% trans "Author" %}</h5>
|
||||||
<table class="table table-hover attr-table">
|
<table class="table table-hover attr-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Author" %}</th>
|
<th scope="row">{% trans "Author" %}</th>
|
||||||
<td>{{ plugin.author.name }}</td>
|
<td>{{ plugin.author.name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Org id" %}</th>
|
||||||
|
<td>{{ plugin.author.org_id|placeholder }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "URL" %}</th>
|
||||||
|
<td>{{ plugin.author.url|urlize|placeholder }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h5 class="card-header">{% trans "Plugin" %}</h5>
|
||||||
|
<table class="table table-hover attr-table">
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Name" %}</th>
|
||||||
|
<td>{{ plugin.title_short }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Tag line" %}</th>
|
||||||
|
<td>{{ plugin.tag_line|placeholder }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Status" %}</th>
|
||||||
|
<td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "License" %}</th>
|
<th scope="row">{% trans "License" %}</th>
|
||||||
<td>{{ plugin.license_type }}</td>
|
<td>{{ plugin.license_type }}</td>
|
||||||
@ -67,6 +95,22 @@
|
|||||||
<th scope="row">{% trans "Description" %}</th>
|
<th scope="row">{% trans "Description" %}</th>
|
||||||
<td>{{ plugin.description_short|markdown }}</td>
|
<td>{{ plugin.description_short|markdown }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "URL" %}</th>
|
||||||
|
<td>{{ plugin.homepage_url|urlize|placeholder }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Certified" %}</th>
|
||||||
|
<td>{% checkmark plugin.is_certified %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Local" %}</th>
|
||||||
|
<td>{% checkmark plugin.is_local %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Installed" %}</th>
|
||||||
|
<td>{% checkmark plugin.is_installed %}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,27 +17,3 @@
|
|||||||
</ul>
|
</ul>
|
||||||
{% endblock tabs %}
|
{% endblock tabs %}
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
|
|
||||||
<p>{% trans "NetBox plugins enable you to document and model new kinds of resources, connect automations, add workflows, and much more." %}</p>
|
|
||||||
|
|
||||||
<div class="row mb-3" id="results">
|
|
||||||
<div class="col-auto d-print-none">
|
|
||||||
<div class="input-group input-group-flat me-2 quicksearch" hx-disinherit="hx-select hx-swap">
|
|
||||||
<input type="search" results="5" name="q" id="quicksearch" class="form-control" placeholder="{% trans "Quick search" %}"
|
|
||||||
hx-get="{{ request.full_path }}" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search"/>
|
|
||||||
<span class="input-group-text py-1">
|
|
||||||
<a href="#" id="quicksearch_clear" class="invisible text-secondary"><i class="mdi mdi-close-circle"></i></a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="htmx-container table-responsive" id="object_list">
|
|
||||||
{% include 'htmx/table.html' %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user