From 3e33b2c26a4fb7327a50cd3235e49175b78c8c4a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 25 Jul 2024 13:47:31 -0400 Subject: [PATCH] Clean up templates --- .../core/inc/plugin_installation.html | 29 ++++ netbox/templates/core/plugin.html | 164 ++++++++---------- netbox/templates/core/plugin_list.html | 3 - 3 files changed, 102 insertions(+), 94 deletions(-) create mode 100644 netbox/templates/core/inc/plugin_installation.html diff --git a/netbox/templates/core/inc/plugin_installation.html b/netbox/templates/core/inc/plugin_installation.html new file mode 100644 index 000000000..f1878fb97 --- /dev/null +++ b/netbox/templates/core/inc/plugin_installation.html @@ -0,0 +1,29 @@ +

You can install this plugin from the command line with PyPI.

+

The following commands may be helpful; always refer to the plugin's own documentation and the Installing a Plugin unit of the NetBox documentation.

+

1. Enter the NetBox virtual environment and install the plugin package:

+ +
+source /opt/netbox/venv/bin/activate
+pip install {{ plugin.slug }}
+
+ +

2. In /opt/netbox/netbox/netbox/configuration.py, add the plugin to the PLUGINS list:

+ +
+PLUGINS=[
+"{{ plugin.config_name }}",
+]
+
+ +

3. Still from the NetBox virtual environment, run database migrations and collect static files:

+ +
+python3 /opt/netbox/netbox/netbox/manage.py migrate
+python3 /opt/netbox/netbox/netbox/manage.py collectstatic
+
+ +

4. Restart the NetBox services to complete the plugin installation:

+ +
+sudo systemctl restart netbox netbox-rq
+
diff --git a/netbox/templates/core/plugin.html b/netbox/templates/core/plugin.html index 476f0cb1c..94307dc14 100644 --- a/netbox/templates/core/plugin.html +++ b/netbox/templates/core/plugin.html @@ -13,15 +13,18 @@ {% endblock breadcrumbs %} {% block subtitle %} -
- {{ plugin.tag_line }} - Learn more -
-{% endblock subtitle %} - -{% block controls %} + + {% checkmark plugin.is_installed %} + {% if plugin.is_installed %} + v{{ plugin.installed_version }} {% trans "installed" %} + {% else %} + {% trans "Not installed" %} + {% endif %} + {% endblock %} +{% block controls %}{% endblock %} + {% block tabs %} - {% endblock tabs %} {% block content %} -
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% trans "Author" %}{{ plugin.author.name }}
{% trans "Name" %}{{ plugin.title_short }}
{% trans "License" %}{{ plugin.license_type }}
{% trans "Description" %}{{ plugin.description_short|markdown }}
{% trans "Certified" %}{% checkmark plugin.is_certified %}
{% trans "Local" %}{% checkmark plugin.is_local %}
{% trans "Installed" %}{% checkmark plugin.is_installed %}
+
+
+
+
{% trans "Plugin Details" %}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans "Name" %}{{ plugin.title_short }}
{% trans "Summary" %}{{ plugin.tag_line|placeholder }}
{% trans "Author" %}{{ plugin.author.name|placeholder }}
{% trans "URL" %} + {% if plugin.homepage_url %} + {{ plugin.homepage_url }} + {% else %} + {{ ''|placeholder }} + {% endif %} +
{% trans "License" %}{{ plugin.license_type|placeholder }}
{% trans "Description" %}{{ plugin.description_short|markdown }}
{% trans "Certified" %}{% checkmark plugin.is_certified %}
{% trans "Local" %}{% checkmark plugin.is_local %}
+
-
-
- - -
- {% if not plugin.is_local %} -
-
- -
- {% include 'htmx/table.html' %} +
+
+
{% trans "Version History" %}
+
+ {% include 'htmx/table.html' %} +
- {% if 'commercial' not in settings.RELEASE.features %} -
-

You can install this plugin from the command line with PyPi.

-

The following commands may be helpful; always refer to the plugin's own documentation and the Installing a Plugin unit of the NetBox documentation.

-

1. Enter the NetBox virtual environment and install the plugin package:

- -

-source /opt/netbox/venv/bin/activate
-pip install {{ plugin.slug }}
-    
-

2. In /opt/netbox/netbox/netbox/configuration.py, add the plugin to the PLUGINS list:

-

-PLUGINS=[
-    "{{ plugin.config_name }}",
-]
-        
-

3. Still from the NetBox virtual environment, run database migrations and collect static files:

-

-    python3 /opt/netbox/netbox/netbox/manage.py migrate
-    python3 /opt/netbox/netbox/netbox/manage.py collectstatic
-        
-

4. Restart the NetBox services to complete the plugin installation:

-

-    sudo systemctl restart netbox netbox-rq
-        
+
+ {% if True or not plugin.is_local and 'commercial' not in settings.RELEASE.features %} +
+
+
{% trans "Local Installation Instructions" %}
+
+ {% include 'core/inc/plugin_installation.html' %} +
- {% endif %} +
{% endif %} {% endblock content %} diff --git a/netbox/templates/core/plugin_list.html b/netbox/templates/core/plugin_list.html index aa9f90dd7..47a6c3686 100644 --- a/netbox/templates/core/plugin_list.html +++ b/netbox/templates/core/plugin_list.html @@ -6,9 +6,6 @@ {% block title %}{% trans "Plugins" %}{% endblock %} -{% block controls %} -{% endblock controls %} - {% block tabs %}