diff --git a/netbox/dcim/ui/panels.py b/netbox/dcim/ui/panels.py
index a06a4b6b5..217a6b68f 100644
--- a/netbox/dcim/ui/panels.py
+++ b/netbox/dcim/ui/panels.py
@@ -267,6 +267,15 @@ class ModuleBayPanel(panels.ObjectAttributesPanel):
description = attrs.TextAttr('description')
+class InstalledModulePanel(panels.ObjectAttributesPanel):
+ title = _('Installed Module')
+ module = attrs.RelatedObjectAttr('installed_module', linkify=True)
+ manufacturer = attrs.RelatedObjectAttr('installed_module.module_type.manufacturer', linkify=True)
+ module_type = attrs.RelatedObjectAttr('installed_module.module_type', linkify=True)
+ serial = attrs.TextAttr('installed_module.serial', label=_('Serial number'), style='font-monospace')
+ asset_tag = attrs.TextAttr('installed_module.asset_tag', style='font-monospace')
+
+
class DeviceBayPanel(panels.ObjectAttributesPanel):
device = attrs.RelatedObjectAttr('device', linkify=True)
name = attrs.TextAttr('name')
@@ -274,6 +283,12 @@ class DeviceBayPanel(panels.ObjectAttributesPanel):
description = attrs.TextAttr('description')
+class InstalledDevicePanel(panels.ObjectAttributesPanel):
+ title = _('Installed Device')
+ device = attrs.RelatedObjectAttr('installed_device', linkify=True)
+ device_type = attrs.RelatedObjectAttr('installed_device.device_type')
+
+
class InventoryItemPanel(panels.ObjectAttributesPanel):
device = attrs.RelatedObjectAttr('device', linkify=True)
parent = attrs.RelatedObjectAttr('parent', linkify=True, label=_('Parent item'))
diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py
index 90ca44a3d..f2a511ef3 100644
--- a/netbox/dcim/views.py
+++ b/netbox/dcim/views.py
@@ -3739,10 +3739,7 @@ class ModuleBayView(generic.ObjectView):
],
right_panels=[
CustomFieldsPanel(),
- TemplatePanel(
- title=_('Installed Module'),
- template_name='dcim/panels/installed_module.html',
- ),
+ panels.InstalledModulePanel(),
],
)
@@ -3814,10 +3811,7 @@ class DeviceBayView(generic.ObjectView):
TagsPanel(),
],
right_panels=[
- TemplatePanel(
- title=_('Installed Device'),
- template_name='dcim/panels/installed_device.html',
- ),
+ panels.InstalledDevicePanel(),
],
)
diff --git a/netbox/templates/dcim/panels/installed_device.html b/netbox/templates/dcim/panels/installed_device.html
deleted file mode 100644
index c95bf7f5d..000000000
--- a/netbox/templates/dcim/panels/installed_device.html
+++ /dev/null
@@ -1,21 +0,0 @@
-{% extends "ui/panels/_base.html" %}
-{% load helpers i18n %}
-
-{% block panel_content %}
- {% if object.installed_device %}
- {% with device=object.installed_device %}
-
-
- | {% trans "Device" %} |
- {{ device|linkify }} |
-
-
- | {% trans "Device type" %} |
- {{ device.device_type }} |
-
-
- {% endwith %}
- {% else %}
- {% trans "None" %}
- {% endif %}
-{% endblock panel_content %}
diff --git a/netbox/templates/dcim/panels/installed_module.html b/netbox/templates/dcim/panels/installed_module.html
deleted file mode 100644
index 8125d2a63..000000000
--- a/netbox/templates/dcim/panels/installed_module.html
+++ /dev/null
@@ -1,33 +0,0 @@
-{% extends "ui/panels/_base.html" %}
-{% load helpers i18n %}
-
-{% block panel_content %}
- {% if object.installed_module %}
- {% with module=object.installed_module %}
-
-
- | {% trans "Module" %} |
- {{ module|linkify }} |
-
-
- | {% trans "Manufacturer" %} |
- {{ module.module_type.manufacturer|linkify }} |
-
-
- | {% trans "Module type" %} |
- {{ module.module_type|linkify }} |
-
-
- | {% trans "Serial number" %} |
- {{ module.serial|placeholder }} |
-
-
- | {% trans "Asset tag" %} |
- {{ module.asset_tag|placeholder }} |
-
-
- {% endwith %}
- {% else %}
- {% trans "None" %}
- {% endif %}
-{% endblock panel_content %}
diff --git a/netbox/templates/vpn/panels/ipsecprofile_ike_policy.html b/netbox/templates/vpn/panels/ipsecprofile_ike_policy.html
deleted file mode 100644
index 8b3065cfd..000000000
--- a/netbox/templates/vpn/panels/ipsecprofile_ike_policy.html
+++ /dev/null
@@ -1,34 +0,0 @@
-{% load helpers %}
-{% load i18n %}
-
-
-
-
-
- | {% trans "Name" %} |
- {{ object.ike_policy|linkify }} |
-
-
- | {% trans "Description" %} |
- {{ object.ike_policy.description|placeholder }} |
-
-
- | {% trans "Version" %} |
- {{ object.ike_policy.get_version_display }} |
-
-
- | {% trans "Mode" %} |
- {{ object.ike_policy.get_mode_display }} |
-
-
- | {% trans "Proposals" %} |
-
-
- {% for proposal in object.ike_policy.proposals.all %}
- - {{ proposal }}
- {% endfor %}
-
- |
-
-
-
diff --git a/netbox/templates/vpn/panels/ipsecprofile_ipsec_policy.html b/netbox/templates/vpn/panels/ipsecprofile_ipsec_policy.html
deleted file mode 100644
index cb28c1620..000000000
--- a/netbox/templates/vpn/panels/ipsecprofile_ipsec_policy.html
+++ /dev/null
@@ -1,30 +0,0 @@
-{% load helpers %}
-{% load i18n %}
-
-
-
-
-
- | {% trans "Name" %} |
- {{ object.ipsec_policy|linkify }} |
-
-
- | {% trans "Description" %} |
- {{ object.ipsec_policy.description|placeholder }} |
-
-
- | {% trans "Proposals" %} |
-
-
- {% for proposal in object.ipsec_policy.proposals.all %}
- - {{ proposal }}
- {% endfor %}
-
- |
-
-
- | {% trans "PFS Group" %} |
- {{ object.ipsec_policy.get_pfs_group_display }} |
-
-
-
diff --git a/netbox/vpn/ui/panels.py b/netbox/vpn/ui/panels.py
index 41afec132..20b3f5be9 100644
--- a/netbox/vpn/ui/panels.py
+++ b/netbox/vpn/ui/panels.py
@@ -71,6 +71,23 @@ class IPSecProfilePanel(panels.ObjectAttributesPanel):
mode = attrs.ChoiceAttr('mode')
+class IPSecProfileIKEPolicyPanel(panels.ObjectAttributesPanel):
+ title = _('IKE Policy')
+ name = attrs.RelatedObjectAttr('ike_policy', linkify=True)
+ description = attrs.TextAttr('ike_policy.description')
+ version = attrs.ChoiceAttr('ike_policy.version', label=_('IKE version'))
+ mode = attrs.ChoiceAttr('ike_policy.mode')
+ proposals = attrs.RelatedObjectListAttr('ike_policy.proposals', linkify=True)
+
+
+class IPSecProfileIPSecPolicyPanel(panels.ObjectAttributesPanel):
+ title = _('IPSec Policy')
+ name = attrs.RelatedObjectAttr('ipsec_policy', linkify=True)
+ description = attrs.TextAttr('ipsec_policy.description')
+ proposals = attrs.RelatedObjectListAttr('ipsec_policy.proposals', linkify=True)
+ pfs_group = attrs.ChoiceAttr('ipsec_policy.pfs_group', label=_('PFS group'))
+
+
class L2VPNPanel(panels.ObjectAttributesPanel):
name = attrs.TextAttr('name')
identifier = attrs.TextAttr('identifier')
diff --git a/netbox/vpn/views.py b/netbox/vpn/views.py
index 7da05e007..b6e2fc908 100644
--- a/netbox/vpn/views.py
+++ b/netbox/vpn/views.py
@@ -10,7 +10,6 @@ from netbox.ui.panels import (
ObjectsTablePanel,
PluginContentPanel,
RelatedObjectsPanel,
- TemplatePanel,
)
from netbox.views import generic
from utilities.query import count_related
@@ -589,8 +588,8 @@ class IPSecProfileView(generic.ObjectView):
CommentsPanel(),
],
right_panels=[
- TemplatePanel('vpn/panels/ipsecprofile_ike_policy.html'),
- TemplatePanel('vpn/panels/ipsecprofile_ipsec_policy.html'),
+ panels.IPSecProfileIKEPolicyPanel(),
+ panels.IPSecProfileIPSecPolicyPanel(),
],
)