Closes #436 (and #122?): Add options to disable smooth cables and physics (#488)

* allow disabling smooth cables and render them as straight lines instead

* rename 'disable_smooth_cables' to 'straight_cables'

* missed one in renaming

* fix inverted logic

* add GET param and option to DeviceFilterForm

* fix syntax error

* rename var

* add missing query field

* netbox v4 support

---------

Co-authored-by: Daniel Bremer <daniel.bremer@mpsd.mpg.de>
Co-authored-by: mvanhaverbeke <mattijs.vanhaverbeke@ebo-enterprises.com>
This commit is contained in:
dremerb
2024-07-08 15:37:18 +02:00
committed by GitHub
co-authored by Daniel Bremer mvanhaverbeke
parent 142de460b9
commit aba0598947
7 changed files with 65 additions and 9 deletions
+18 -3
View File
@@ -36,7 +36,7 @@ class DeviceFilterForm(
FieldSet(
'group', 'save_coords', 'show_unconnected', 'show_cables', 'show_logical_connections',
'show_single_cable_logical_conns', 'show_neighbors', 'show_circuit', 'show_power', 'show_wireless',
'group_sites', 'group_locations', 'group_racks', name=_("Options")
'group_sites', 'group_locations', 'group_racks', 'straight_cables', name=_("Options")
),
FieldSet('id', name=_("Device")),
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_("Location")),
@@ -240,7 +240,7 @@ class DeviceFilterForm(
)
show_unconnected = forms.NullBooleanField(
label=_('Show Unconnected'),
required=False,
required=False,
initial=False,
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
@@ -310,6 +310,12 @@ class DeviceFilterForm(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
straight_cables = forms.BooleanField(
label=_('Straight Cables'), required=False, initial=False,
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
class CoordinateGroupsForm(NetBoxModelForm):
fieldsets = (
@@ -502,6 +508,7 @@ class IndividualOptionsForm(NetBoxModelForm):
'group_locations',
'group_racks',
'draw_default_layout',
'straight_cables',
),
)
@@ -629,6 +636,13 @@ class IndividualOptionsForm(NetBoxModelForm):
help_text=_('Enable this option if you want to draw the topology on '
'the initial load (when you go to the topology plugin page).')
)
straight_cables = forms.BooleanField(
label=('Use Straight Cables'),
required=False,
initial=False,
help_text=_('Enable this option if you want to draw cables as straight lines '
'instead of curves.')
)
class Meta:
model = IndividualOptions
@@ -636,5 +650,6 @@ class IndividualOptionsForm(NetBoxModelForm):
'user_id', 'ignore_cable_type', 'preselected_device_roles', 'preselected_tags',
'save_coords', 'show_unconnected', 'show_cables', 'show_logical_connections',
'show_single_cable_logical_conns', 'show_neighbors', 'show_circuit', 'show_power',
'show_wireless', 'group_sites', 'group_locations', 'group_racks', 'draw_default_layout'
'show_wireless', 'group_sites', 'group_locations', 'group_racks', 'draw_default_layout',
'straight_cables'
]