diff --git a/netbox_napalm_plugin/models.py b/netbox_napalm_plugin/models.py index 1d93f1e..e80784b 100644 --- a/netbox_napalm_plugin/models.py +++ b/netbox_napalm_plugin/models.py @@ -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]) diff --git a/netbox_napalm_plugin/tables.py b/netbox_napalm_plugin/tables.py index e79687e..a58dd21 100644 --- a/netbox_napalm_plugin/tables.py +++ b/netbox_napalm_plugin/tables.py @@ -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") diff --git a/netbox_napalm_plugin/templates/netbox_napalm_plugin/napalm.html b/netbox_napalm_plugin/templates/netbox_napalm_plugin/napalmplatform.html similarity index 55% rename from netbox_napalm_plugin/templates/netbox_napalm_plugin/napalm.html rename to netbox_napalm_plugin/templates/netbox_napalm_plugin/napalmplatform.html index eb61606..c0c257c 100644 --- a/netbox_napalm_plugin/templates/netbox_napalm_plugin/napalm.html +++ b/netbox_napalm_plugin/templates/netbox_napalm_plugin/napalmplatform.html @@ -12,17 +12,29 @@
Name | -{{ object.name }} | +Platform | +{{ object.platform|linkify|placeholder }} | +
---|---|---|---|
NAPALM Driver | +{{ object.napalm_driver|placeholder }} |
{{ object.napalm_args|json }}+