Skip to content

Commit

Permalink
Merge pull request #39 from cruse1977/fixed-4.0
Browse files Browse the repository at this point in the history
4.0.x Fixes - Javascript + Templates
  • Loading branch information
cruse1977 authored May 24, 2024
2 parents f281aa8 + adfc89c commit 6c6cea8
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 17 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ The features the plugin provides should be listed here.
| 3.5 | 0.1.0 |
| 3.5.8 | 0.1.4 |
| 3.6.0 | 0.1.5 |
| 3.7.0 | 0.1.7 |
| < 3.7.6 | 0.1.7 |
| >= 4.0.2 | 0.2.1 |

## Installation

Expand Down
4 changes: 2 additions & 2 deletions netbox_napalm_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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


from netbox.plugins import PluginConfig
Expand All @@ -21,7 +21,7 @@ class NapalmPlatformConfig(PluginConfig):
'NAPALM_TIMEOUT': 30,
'NAPALM_ARGS': {},
}
min_version = '4.0-beta1'
min_version = '4.0.2'
max_version = '4.0.99'


Expand Down
3 changes: 2 additions & 1 deletion netbox_napalm_plugin/project-static/js/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ export function getNetboxData(key: string): string | null {
if (!key.startsWith('data-')) {
key = `data-${key}`;
}
for (const element of getElements('body > div#netbox-data > *')) {
var parent_div = document.getElementById("netbox-data");
for (const element of parent_div.children) {
const value = element.getAttribute(key);
if (isTruthy(value)) {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5270,7 +5270,8 @@
if (!key.startsWith("data-")) {
key = `data-${key}`;
}
for (const element of getElements("body > div#netbox-data > *")) {
var parent_div = document.getElementById("netbox-data");
for (const element of parent_div.children) {
const value = element.getAttribute(key);
if (isTruthy(value)) {
return value;
Expand Down
3 changes: 2 additions & 1 deletion netbox_napalm_plugin/static/netbox_napalm_plugin/js/lldp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5270,7 +5270,8 @@
if (!key.startsWith("data-")) {
key = `data-${key}`;
}
for (const element of getElements("body > div#netbox-data > *")) {
var parent_div = document.getElementById("netbox-data");
for (const element of parent_div.children) {
const value = element.getAttribute(key);
if (isTruthy(value)) {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5851,7 +5851,8 @@
if (!key.startsWith("data-")) {
key = `data-${key}`;
}
for (const element of getElements("body > div#netbox-data > *")) {
var parent_div = document.getElementById("netbox-data");
for (const element of parent_div.children) {
const value = element.getAttribute(key);
if (isTruthy(value)) {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ <h5 class="card-header">Device Configuration</h5>
</div>
</div>
</div>
{% endblock %}
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_config"></span>
</div>

{% block data %}
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_config"></span>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ <h5 class="d-inline">LLDP Neighbors</h5>
</tbody>
</table>
</div>
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_lldp_neighbors_detail"></span>
</div>
{% endblock %}

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

Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ <h5 class="card-header">Environment</h5>
</div>
</div>
</div>
{% endblock %}
<div id="netbox-data" style="display: none!important; visibility: hidden!important">
<span data-object-url="{% url 'plugins-api:netbox_napalm_plugin-api:napalmplatformconfig-napalm' pk=object.pk %}?method=get_facts&method=get_environment"></span>
</div>

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

2 changes: 1 addition & 1 deletion 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-napalm-plugin"
version = "0.2.0"
version = "0.2.1"
authors = [
{name = "Arthur Hanson", email = "[email protected]"},
]
Expand Down

0 comments on commit 6c6cea8

Please sign in to comment.