Skip to content

Commit 6c6cea8

Browse files
authored
Merge pull request #39 from cruse1977/fixed-4.0
4.0.x Fixes - Javascript + Templates
2 parents f281aa8 + adfc89c commit 6c6cea8

File tree

10 files changed

+24
-17
lines changed

10 files changed

+24
-17
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ The features the plugin provides should be listed here.
1818
| 3.5 | 0.1.0 |
1919
| 3.5.8 | 0.1.4 |
2020
| 3.6.0 | 0.1.5 |
21-
| 3.7.0 | 0.1.7 |
21+
| < 3.7.6 | 0.1.7 |
22+
| >= 4.0.2 | 0.2.1 |
2223

2324
## Installation
2425

netbox_napalm_plugin/__init__.py

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

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

77

88
from netbox.plugins import PluginConfig
@@ -21,7 +21,7 @@ class NapalmPlatformConfig(PluginConfig):
2121
'NAPALM_TIMEOUT': 30,
2222
'NAPALM_ARGS': {},
2323
}
24-
min_version = '4.0-beta1'
24+
min_version = '4.0.2'
2525
max_version = '4.0.99'
2626

2727

netbox_napalm_plugin/project-static/js/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ export function getNetboxData(key: string): string | null {
258258
if (!key.startsWith('data-')) {
259259
key = `data-${key}`;
260260
}
261-
for (const element of getElements('body > div#netbox-data > *')) {
261+
var parent_div = document.getElementById("netbox-data");
262+
for (const element of parent_div.children) {
262263
const value = element.getAttribute(key);
263264
if (isTruthy(value)) {
264265
return value;

netbox_napalm_plugin/static/netbox_napalm_plugin/js/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5270,7 +5270,8 @@
52705270
if (!key.startsWith("data-")) {
52715271
key = `data-${key}`;
52725272
}
5273-
for (const element of getElements("body > div#netbox-data > *")) {
5273+
var parent_div = document.getElementById("netbox-data");
5274+
for (const element of parent_div.children) {
52745275
const value = element.getAttribute(key);
52755276
if (isTruthy(value)) {
52765277
return value;

netbox_napalm_plugin/static/netbox_napalm_plugin/js/lldp.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5270,7 +5270,8 @@
52705270
if (!key.startsWith("data-")) {
52715271
key = `data-${key}`;
52725272
}
5273-
for (const element of getElements("body > div#netbox-data > *")) {
5273+
var parent_div = document.getElementById("netbox-data");
5274+
for (const element of parent_div.children) {
52745275
const value = element.getAttribute(key);
52755276
if (isTruthy(value)) {
52765277
return value;

netbox_napalm_plugin/static/netbox_napalm_plugin/js/status.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5851,7 +5851,8 @@
58515851
if (!key.startsWith("data-")) {
58525852
key = `data-${key}`;
58535853
}
5854-
for (const element of getElements("body > div#netbox-data > *")) {
5854+
var parent_div = document.getElementById("netbox-data");
5855+
for (const element of parent_div.children) {
58555856
const value = element.getAttribute(key);
58565857
if (isTruthy(value)) {
58575858
return value;

netbox_napalm_plugin/templates/netbox_napalm_plugin/config.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ <h5 class="card-header">Device Configuration</h5>
3838
</div>
3939
</div>
4040
</div>
41-
{% endblock %}
41+
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
42+
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_config"></span>
43+
</div>
4244

43-
{% block data %}
44-
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_config"></span>
4545
{% endblock %}

netbox_napalm_plugin/templates/netbox_napalm_plugin/lldp_neighbors.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ <h5 class="d-inline">LLDP Neighbors</h5>
5757
</tbody>
5858
</table>
5959
</div>
60+
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
61+
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_lldp_neighbors_detail"></span>
62+
</div>
6063
{% endblock %}
6164

62-
{% block data %}
63-
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_lldp_neighbors_detail"></span>
64-
{% endblock %}
65+

netbox_napalm_plugin/templates/netbox_napalm_plugin/status.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ <h5 class="card-header">Environment</h5>
8282
</div>
8383
</div>
8484
</div>
85-
{% endblock %}
85+
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
86+
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_facts&method=get_environment"></span>
87+
</div>
8688

87-
{% block data %}
88-
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_facts&method=get_environment"></span>
8989
{% endblock %}
90+

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "netbox-napalm-plugin"
10-
version = "0.2.0"
10+
version = "0.2.1"
1111
authors = [
1212
{name = "Arthur Hanson", email = "[email protected]"},
1313
]

0 commit comments

Comments
 (0)