From 20b3737a5000142d164b9047cd021cdb38173b27 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Mon, 6 May 2024 12:37:36 -0700 Subject: [PATCH] Updates for NetBox 4.0 (#14) --- CHANGELOG.md | 4 + README.md | 1 + netbox_healthcheck_plugin/__init__.py | 6 +- netbox_healthcheck_plugin/navigation.py | 3 +- .../healthcheck.html | 111 +++++++++++------- pyproject.toml | 7 +- 6 files changed, 82 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f2e954..7590e36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.2.0 (2024-05006) + +* Updates for NetBox v4.0 + ## 0.1.2 (2024-04-08) * Fix django-health-check dependency in pyproject.toml diff --git a/README.md b/README.md index 20701b1..54cdd98 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The features the plugin provides should be listed here. | 3.4 - 3.7 | 0.1.0 | | 3.4 - 3.7 | 0.1.2 | | 3.4 - 3.7 | 0.1.3 | +| 4.0. | 0.2.0 | ## Installing diff --git a/netbox_healthcheck_plugin/__init__.py b/netbox_healthcheck_plugin/__init__.py index 001a41c..2c1aff6 100644 --- a/netbox_healthcheck_plugin/__init__.py +++ b/netbox_healthcheck_plugin/__init__.py @@ -2,10 +2,10 @@ __author__ = """Arthur Hanson""" __email__ = 'ahanson@netboxlabs.com' -__version__ = '0.1.4' +__version__ = '0.2.0' -from extras.plugins import PluginConfig +from netbox.plugins import PluginConfig class HealthCheckConfig(PluginConfig): @@ -20,6 +20,6 @@ class HealthCheckConfig(PluginConfig): 'health_check.contrib.migrations', 'health_check.contrib.redis', ] - + min_version = "v4.0-beta1" config = HealthCheckConfig diff --git a/netbox_healthcheck_plugin/navigation.py b/netbox_healthcheck_plugin/navigation.py index 83db1d9..6979386 100644 --- a/netbox_healthcheck_plugin/navigation.py +++ b/netbox_healthcheck_plugin/navigation.py @@ -1,5 +1,4 @@ -from extras.plugins import PluginMenuButton, PluginMenuItem -from utilities.choices import ButtonColorChoices +from netbox.plugins import PluginMenuButton, PluginMenuItem menu_items = ( diff --git a/netbox_healthcheck_plugin/templates/netbox_healthcheck_plugin/healthcheck.html b/netbox_healthcheck_plugin/templates/netbox_healthcheck_plugin/healthcheck.html index 332f2b4..5497cfa 100644 --- a/netbox_healthcheck_plugin/templates/netbox_healthcheck_plugin/healthcheck.html +++ b/netbox_healthcheck_plugin/templates/netbox_healthcheck_plugin/healthcheck.html @@ -1,22 +1,53 @@ - {% extends 'base/layout.html' %} {% block head %} {% endblock head %} -{% block title %}Health Checks{% endblock %} +{% block header %} + +{% endblock header %} -{% block content-wrapper %} +{% block content %}
{# Object list #} @@ -27,38 +58,36 @@
NetBox HealthCheck Plugin
-
- - - - - - - - {% for plugin in plugins %} - - - - - - - {% endfor %} - -
ServiceStatusTime Taken
- - {{ plugin.identifier }}{{ plugin.pretty_status | linebreaks }}{{ plugin.time_taken|floatformat:4 }} seconds
-
+ + + + + + + + {% for plugin in plugins %} + + + + + + + {% endfor %} + +
ServiceStatusTime Taken
+ + {{ plugin.identifier }}{{ plugin.pretty_status | linebreaks }}{{ plugin.time_taken|floatformat:4 }} seconds
+
- {% include 'inc/panels/custom_fields.html' %} -{% endblock content-wrapper %} +{% endblock content %} diff --git a/pyproject.toml b/pyproject.toml index 36b8fcd..e3ca20d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "netbox-healthcheck-plugin" -version = "0.1.4" +version = "0.2.0" authors = [ {name = "Arthur Hanson", email = "ahanson@netboxlabs.com"}, ] @@ -19,13 +19,12 @@ classifiers=[ 'Intended Audience :: Developers', 'Natural Language :: English', "Programming Language :: Python :: 3 :: Only", - 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', ] -requires-python = ">=3.8.1" +requires-python = ">=3.10.0" dependencies = [ 'django-health-check >= 3,<4' @@ -48,7 +47,7 @@ Tracker = "https://github.com/netbox-community/netbox-healthcheck-plugin/issues" [tool.black] line-length = 120 -target_version = ['py39', 'py310', 'py311', 'py312'] +target_version = ['py310', 'py311', 'py312'] [tool.setuptools.package-data] netbox_healthcheck_plugin = ["templates/**"]