diff --git a/netbox_floorplan/tables.py b/netbox_floorplan/tables.py
index 14790e4..a77448f 100644
--- a/netbox_floorplan/tables.py
+++ b/netbox_floorplan/tables.py
@@ -2,8 +2,9 @@
from netbox.tables import NetBoxTable
from .models import Floorplan, FloorplanImage
+from functools import cached_property
-from dcim.models import Rack
+from dcim.models import Rack, Device
class FloorplanImageTable(NetBoxTable):
@@ -32,14 +33,19 @@ class Meta(NetBoxTable.Meta):
class FloorplanRackTable(NetBoxTable):
-
name = tables.LinkColumn()
+ embedded = True
actions = tables.TemplateColumn(template_code="""
Add Rack
""")
+ @cached_property
+ def htmx_url(self):
+ # no need to check for embedded as this table is always embedded
+ return "/plugins/floorplan/floorplans/racks/"
+
class Meta(NetBoxTable.Meta):
model = Rack
fields = ('pk', 'name', 'u_height')
@@ -50,16 +56,21 @@ class Meta(NetBoxTable.Meta):
class FloorplanDeviceTable(NetBoxTable):
-
name = tables.LinkColumn()
+ embedded = True
actions = tables.TemplateColumn(template_code="""
Add Device
""")
+ @cached_property
+ def htmx_url(self):
+ # no need to check for embedded as this table is always embedded
+ return "/plugins/floorplan/floorplans/devices/"
+
class Meta(NetBoxTable.Meta):
- model = Rack
+ model = Device
fields = ('pk', 'name', 'device_type')
default_columns = ('pk', 'name', 'device_type')
row_attrs = {