mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Merge pull request #19333 from netbox-community/17405-plugin-icons
Fixes #17405: Added plugin icon to plugin list/detail
This commit is contained in:
commit
68e9da5cd9
@ -47,6 +47,7 @@ class Plugin:
|
|||||||
The representation of a NetBox plugin in the catalog API.
|
The representation of a NetBox plugin in the catalog API.
|
||||||
"""
|
"""
|
||||||
id: str = ''
|
id: str = ''
|
||||||
|
icon_url: str = ''
|
||||||
status: str = ''
|
status: str = ''
|
||||||
title_short: str = ''
|
title_short: str = ''
|
||||||
title_long: str = ''
|
title_long: str = ''
|
||||||
@ -193,6 +194,7 @@ def get_catalog_plugins():
|
|||||||
# Populate plugin data
|
# Populate plugin data
|
||||||
plugins[data['config_name']] = Plugin(
|
plugins[data['config_name']] = Plugin(
|
||||||
id=data['id'],
|
id=data['id'],
|
||||||
|
icon_url=data['icon'],
|
||||||
status=data['status'],
|
status=data['status'],
|
||||||
title_short=data['title_short'],
|
title_short=data['title_short'],
|
||||||
title_long=data['title_long'],
|
title_long=data['title_long'],
|
||||||
|
@ -9,6 +9,12 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
PLUGIN_NAME_TEMPLATE = """
|
||||||
|
<img class="plugin-icon" src="{{ record.icon_url }}">
|
||||||
|
<a href="{% url 'core:plugin' record.config_name %}">{{ record.title_long }}</a>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class PluginVersionTable(BaseTable):
|
class PluginVersionTable(BaseTable):
|
||||||
version = tables.Column(
|
version = tables.Column(
|
||||||
verbose_name=_('Version')
|
verbose_name=_('Version')
|
||||||
@ -39,8 +45,8 @@ class PluginVersionTable(BaseTable):
|
|||||||
|
|
||||||
|
|
||||||
class CatalogPluginTable(BaseTable):
|
class CatalogPluginTable(BaseTable):
|
||||||
title_long = tables.Column(
|
title_long = columns.TemplateColumn(
|
||||||
linkify=('core:plugin', [tables.A('config_name')]),
|
template_code=PLUGIN_NAME_TEMPLATE,
|
||||||
verbose_name=_('Name')
|
verbose_name=_('Name')
|
||||||
)
|
)
|
||||||
author = tables.Column(
|
author = tables.Column(
|
||||||
|
BIN
netbox/project-static/dist/netbox.css
vendored
BIN
netbox/project-static/dist/netbox.css
vendored
Binary file not shown.
@ -75,3 +75,15 @@ span.color-label {
|
|||||||
.btn-grey, .btn-gray {
|
.btn-grey, .btn-gray {
|
||||||
@extend .btn-secondary;
|
@extend .btn-secondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img.plugin-icon {
|
||||||
|
max-width: 1.4285em;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
body[data-bs-theme=dark] {
|
||||||
|
// Assuming icon is black/white line art, invert it and tone down brightness
|
||||||
|
img.plugin-icon {
|
||||||
|
filter: grayscale(100%) invert(100%) brightness(80%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
|
||||||
{% block title %}{{ plugin.title_long }}{% endblock %}
|
{% block title %}<img class="plugin-icon" src="{{ plugin.icon_url }}"> {{ plugin.title_long }}{% endblock %}
|
||||||
|
|
||||||
{% block object_identifier %}
|
{% block object_identifier %}
|
||||||
{% endblock object_identifier %}
|
{% endblock object_identifier %}
|
||||||
|
Loading…
Reference in New Issue
Block a user