Skip to content

Commit 20b3737

Browse files
authored
Updates for NetBox 4.0 (#14)
1 parent 31ec393 commit 20b3737

File tree

6 files changed

+82
-50
lines changed

6 files changed

+82
-50
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.2.0 (2024-05006)
4+
5+
* Updates for NetBox v4.0
6+
37
## 0.1.2 (2024-04-08)
48

59
* Fix django-health-check dependency in pyproject.toml

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The features the plugin provides should be listed here.
2121
| 3.4 - 3.7 | 0.1.0 |
2222
| 3.4 - 3.7 | 0.1.2 |
2323
| 3.4 - 3.7 | 0.1.3 |
24+
| 4.0. | 0.2.0 |
2425

2526
## Installing
2627

netbox_healthcheck_plugin/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
__author__ = """Arthur Hanson"""
44
__email__ = '[email protected]'
5-
__version__ = '0.1.4'
5+
__version__ = '0.2.0'
66

77

8-
from extras.plugins import PluginConfig
8+
from netbox.plugins import PluginConfig
99

1010

1111
class HealthCheckConfig(PluginConfig):
@@ -20,6 +20,6 @@ class HealthCheckConfig(PluginConfig):
2020
'health_check.contrib.migrations',
2121
'health_check.contrib.redis',
2222
]
23-
23+
min_version = "v4.0-beta1"
2424

2525
config = HealthCheckConfig

netbox_healthcheck_plugin/navigation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from extras.plugins import PluginMenuButton, PluginMenuItem
2-
from utilities.choices import ButtonColorChoices
1+
from netbox.plugins import PluginMenuButton, PluginMenuItem
32

43

54
menu_items = (
Lines changed: 70 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,53 @@
1-
21
{% extends 'base/layout.html' %}
32

43
{% block head %}
54
{% endblock head %}
65

7-
{% block title %}Health Checks{% endblock %}
6+
{% block header %}
7+
<div class="page-header m-0">
8+
{{ block.super }}
9+
10+
{% block page-header %}
11+
<div class="container-fluid mt-2 d-print-none">
12+
<div class="d-flex justify-content-between">
13+
14+
{# Title #}
15+
<div>
16+
17+
<h2 class="page-title my-1">Health Checks</h2>
18+
{% block subtitle %}{% endblock %}
19+
</div>
20+
21+
{# Controls #}
22+
<div class="d-print-none">
23+
{% block controls %}
24+
<div class="btn-list">
25+
{% block control-buttons %}{% endblock %}
26+
</div>
27+
{% endblock controls %}
28+
</div>
29+
30+
</div>
31+
</div>
32+
{% endblock %}
33+
34+
{# Tabs #}
35+
<div class="page-tabs mt-3">
36+
<div class="container-fluid">
37+
<ul class="nav nav-tabs px-3">
38+
<li class="nav-item" role="presentation">
39+
<button class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
40+
Results {% badge table.page.paginator.count %}
41+
</button>
42+
</li>
43+
</ul>
44+
</div>
45+
</div>
846

9-
{% block tabs %}
10-
<ul class="nav nav-tabs px-3">
11-
<li class="nav-item" role="presentation">
12-
<button class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
13-
Results {% badge table.page.paginator.count %}
14-
</button>
15-
</li>
16-
</ul>
17-
{% endblock tabs %}
47+
</div>
48+
{% endblock header %}
1849

19-
{% block content-wrapper %}
50+
{% block content %}
2051
<div class="tab-content">
2152

2253
{# Object list #}
@@ -27,38 +58,36 @@
2758

2859
<h5 class="card-header">NetBox HealthCheck Plugin</h5>
2960

30-
<div class="card-body">
31-
<table class="table table-striped">
32-
<thead>
33-
<th colspan="2">Service</th>
34-
<th>Status</th>
35-
<th class="align-right">Time Taken</th>
36-
</thead>
37-
<tbody>
38-
{% for plugin in plugins %}
39-
<tr>
40-
<td class="icons">
41-
<span aria-hidden="true">
42-
{% if plugin.status %}
43-
&#9989;
44-
{% else %}
45-
&#10060;
46-
{% endif %}
47-
</span>
48-
</td>
49-
<td>{{ plugin.identifier }}</td>
50-
<td>{{ plugin.pretty_status | linebreaks }}</td>
51-
<td class="align-right">{{ plugin.time_taken|floatformat:4 }} seconds</td>
52-
</tr>
53-
{% endfor %}
54-
</tbody>
55-
</table>
56-
</div>
61+
<table class="table table-striped">
62+
<thead>
63+
<th colspan="2">Service</th>
64+
<th>Status</th>
65+
<th class="align-right">Time Taken</th>
66+
</thead>
67+
<tbody>
68+
{% for plugin in plugins %}
69+
<tr>
70+
<td class="icons">
71+
<span aria-hidden="true">
72+
{% if plugin.status %}
73+
&#9989;
74+
{% else %}
75+
&#10060;
76+
{% endif %}
77+
</span>
78+
</td>
79+
<td>{{ plugin.identifier }}</td>
80+
<td>{{ plugin.pretty_status | linebreaks }}</td>
81+
<td class="align-right">{{ plugin.time_taken|floatformat:4 }} seconds</td>
82+
</tr>
83+
{% endfor %}
84+
</tbody>
85+
</table>
86+
5787
</div>
58-
{% include 'inc/panels/custom_fields.html' %}
5988
</div>
6089

6190
</div>
6291
</div>
6392

64-
{% endblock content-wrapper %}
93+
{% endblock content %}

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "netbox-healthcheck-plugin"
10-
version = "0.1.4"
10+
version = "0.2.0"
1111
authors = [
1212
{name = "Arthur Hanson", email = "[email protected]"},
1313
]
@@ -19,13 +19,12 @@ classifiers=[
1919
'Intended Audience :: Developers',
2020
'Natural Language :: English',
2121
"Programming Language :: Python :: 3 :: Only",
22-
'Programming Language :: Python :: 3.9',
2322
'Programming Language :: Python :: 3.10',
2423
'Programming Language :: Python :: 3.11',
2524
'Programming Language :: Python :: 3.12',
2625
]
2726

28-
requires-python = ">=3.8.1"
27+
requires-python = ">=3.10.0"
2928

3029
dependencies = [
3130
'django-health-check >= 3,<4'
@@ -48,7 +47,7 @@ Tracker = "https://github.com/netbox-community/netbox-healthcheck-plugin/issues"
4847

4948
[tool.black]
5049
line-length = 120
51-
target_version = ['py39', 'py310', 'py311', 'py312']
50+
target_version = ['py310', 'py311', 'py312']
5251

5352
[tool.setuptools.package-data]
5453
netbox_healthcheck_plugin = ["templates/**"]

0 commit comments

Comments
 (0)