Skip to content

Commit

Permalink
Updates for NetBox 4.0 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthanson authored May 6, 2024
1 parent 31ec393 commit 20b3737
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 50 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions netbox_healthcheck_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

__author__ = """Arthur Hanson"""
__email__ = '[email protected]'
__version__ = '0.1.4'
__version__ = '0.2.0'


from extras.plugins import PluginConfig
from netbox.plugins import PluginConfig


class HealthCheckConfig(PluginConfig):
Expand All @@ -20,6 +20,6 @@ class HealthCheckConfig(PluginConfig):
'health_check.contrib.migrations',
'health_check.contrib.redis',
]

min_version = "v4.0-beta1"

config = HealthCheckConfig
3 changes: 1 addition & 2 deletions netbox_healthcheck_plugin/navigation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from extras.plugins import PluginMenuButton, PluginMenuItem
from utilities.choices import ButtonColorChoices
from netbox.plugins import PluginMenuButton, PluginMenuItem


menu_items = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@

{% extends 'base/layout.html' %}

{% block head %}
{% endblock head %}

{% block title %}Health Checks{% endblock %}
{% block header %}
<div class="page-header m-0">
{{ block.super }}

{% block page-header %}
<div class="container-fluid mt-2 d-print-none">
<div class="d-flex justify-content-between">

{# Title #}
<div>

<h2 class="page-title my-1">Health Checks</h2>
{% block subtitle %}{% endblock %}
</div>

{# Controls #}
<div class="d-print-none">
{% block controls %}
<div class="btn-list">
{% block control-buttons %}{% endblock %}
</div>
{% endblock controls %}
</div>

</div>
</div>
{% endblock %}

{# Tabs #}
<div class="page-tabs mt-3">
<div class="container-fluid">
<ul class="nav nav-tabs px-3">
<li class="nav-item" role="presentation">
<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">
Results {% badge table.page.paginator.count %}
</button>
</li>
</ul>
</div>
</div>

{% block tabs %}
<ul class="nav nav-tabs px-3">
<li class="nav-item" role="presentation">
<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">
Results {% badge table.page.paginator.count %}
</button>
</li>
</ul>
{% endblock tabs %}
</div>
{% endblock header %}

{% block content-wrapper %}
{% block content %}
<div class="tab-content">

{# Object list #}
Expand All @@ -27,38 +58,36 @@

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

<div class="card-body">
<table class="table table-striped">
<thead>
<th colspan="2">Service</th>
<th>Status</th>
<th class="align-right">Time Taken</th>
</thead>
<tbody>
{% for plugin in plugins %}
<tr>
<td class="icons">
<span aria-hidden="true">
{% if plugin.status %}
&#9989;
{% else %}
&#10060;
{% endif %}
</span>
</td>
<td>{{ plugin.identifier }}</td>
<td>{{ plugin.pretty_status | linebreaks }}</td>
<td class="align-right">{{ plugin.time_taken|floatformat:4 }} seconds</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<table class="table table-striped">
<thead>
<th colspan="2">Service</th>
<th>Status</th>
<th class="align-right">Time Taken</th>
</thead>
<tbody>
{% for plugin in plugins %}
<tr>
<td class="icons">
<span aria-hidden="true">
{% if plugin.status %}
&#9989;
{% else %}
&#10060;
{% endif %}
</span>
</td>
<td>{{ plugin.identifier }}</td>
<td>{{ plugin.pretty_status | linebreaks }}</td>
<td class="align-right">{{ plugin.time_taken|floatformat:4 }} seconds</td>
</tr>
{% endfor %}
</tbody>
</table>

</div>
{% include 'inc/panels/custom_fields.html' %}
</div>

</div>
</div>

{% endblock content-wrapper %}
{% endblock content %}
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"},
]
Expand All @@ -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'
Expand All @@ -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/**"]

0 comments on commit 20b3737

Please sign in to comment.