Skip to content

Commit

Permalink
detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
arthanson committed Feb 16, 2023
1 parent 614b326 commit 56baa34
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion netbox_napalm_plugin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def __str__(self):
return f"{self.platform.name} -> {self.napalm_driver}"

def get_absolute_url(self):
return reverse("plugins:netbox_napalm_plugin:napalm", args=[self.pk])
return reverse("plugins:netbox_napalm_plugin:napalmplatform", args=[self.pk])
13 changes: 11 additions & 2 deletions netbox_napalm_plugin/tables.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import django_tables2 as tables
from django_tables2.utils import Accessor
from netbox.tables import ChoiceFieldColumn, NetBoxTable

from .models import NapalmPlatform


class NapalmPlatformTable(NetBoxTable):
name = tables.Column(
accessor=Accessor('platform__name'),
linkify={
'viewname': 'plugins:netbox_napalm_plugin:napalmplatform',
'args': [Accessor('pk')],
}
)

class Meta(NetBoxTable.Meta):
model = NapalmPlatform
fields = ("pk", "platform__name", "napalm_driver", "napalm_args", "actions")
default_columns = ("platform__name", "napalm_driver")
fields = ("pk", "name", "napalm_driver", "napalm_args", "actions")
default_columns = ("name", "napalm_driver")
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,29 @@ <h5 class="card-header">NetBox Napalm Plugin</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row">Name</th>
<td>{{ object.name }}</td>
<th scope="row">Platform</th>
<td>{{ object.platform|linkify|placeholder }}</td>
</tr>
<tr>
<th scope="row">NAPALM Driver</th>
<td>{{ object.napalm_driver|placeholder }}</td>
</tr>
</table>
</div>
</div>
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/custom_fields.html' %}
</div>

<div class="col col-md-6">
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/comments.html' %}
<div class="card">
<h5 class="card-header">
NAPALM Arguments
</h5>
<div class="card-body">
<pre>{{ object.napalm_args|json }}</pre>
</div>
</div>
</div>
</div>
{% endblock content %}
Expand Down

0 comments on commit 56baa34

Please sign in to comment.