|
@@ -2185,6 +2185,9 @@ class InterfaceForm(InterfaceCommonForm, BootstrapMixin, forms.ModelForm):
|
|
|
widget=APISelect(
|
|
widget=APISelect(
|
|
|
api_url="/api/ipam/vlans/",
|
|
api_url="/api/ipam/vlans/",
|
|
|
display_field='display_name',
|
|
display_field='display_name',
|
|
|
|
|
+ additional_query_params={
|
|
|
|
|
+ 'site_id': 'null'
|
|
|
|
|
+ },
|
|
|
full=True
|
|
full=True
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -2194,6 +2197,9 @@ class InterfaceForm(InterfaceCommonForm, BootstrapMixin, forms.ModelForm):
|
|
|
widget=APISelectMultiple(
|
|
widget=APISelectMultiple(
|
|
|
api_url="/api/ipam/vlans/",
|
|
api_url="/api/ipam/vlans/",
|
|
|
display_field='display_name',
|
|
display_field='display_name',
|
|
|
|
|
+ additional_query_params={
|
|
|
|
|
+ 'site_id': 'null'
|
|
|
|
|
+ },
|
|
|
full=True
|
|
full=True
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -2236,6 +2242,10 @@ class InterfaceForm(InterfaceCommonForm, BootstrapMixin, forms.ModelForm):
|
|
|
device__in=[self.instance.device, self.instance.device.get_vc_master()], type=IFACE_TYPE_LAG
|
|
device__in=[self.instance.device, self.instance.device.get_vc_master()], type=IFACE_TYPE_LAG
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ # Add the current site to the list of filtered VLANs
|
|
|
|
|
+ self.fields['untagged_vlan'].widget.attrs['1-data-additional-query-param-site_id'] = self.instance.device.site.pk
|
|
|
|
|
+ self.fields['tagged_vlans'].widget.attrs['1-data-additional-query-param-site_id'] = self.instance.device.site.pk
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
|
class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
|
|
name_pattern = ExpandableNameField(
|
|
name_pattern = ExpandableNameField(
|
|
@@ -2287,6 +2297,9 @@ class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
|
|
widget=APISelect(
|
|
widget=APISelect(
|
|
|
api_url="/api/ipam/vlans/",
|
|
api_url="/api/ipam/vlans/",
|
|
|
display_field='display_name',
|
|
display_field='display_name',
|
|
|
|
|
+ additional_query_params={
|
|
|
|
|
+ 'site_id': 'null'
|
|
|
|
|
+ },
|
|
|
full=True
|
|
full=True
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -2296,6 +2309,9 @@ class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
|
|
widget=APISelectMultiple(
|
|
widget=APISelectMultiple(
|
|
|
api_url="/api/ipam/vlans/",
|
|
api_url="/api/ipam/vlans/",
|
|
|
display_field='display_name',
|
|
display_field='display_name',
|
|
|
|
|
+ additional_query_params={
|
|
|
|
|
+ 'site_id': 'null'
|
|
|
|
|
+ },
|
|
|
full=True
|
|
full=True
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -2316,6 +2332,10 @@ class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
|
|
else:
|
|
else:
|
|
|
self.fields['lag'].queryset = Interface.objects.none()
|
|
self.fields['lag'].queryset = Interface.objects.none()
|
|
|
|
|
|
|
|
|
|
+ # Add the current site to the list of filtered VLANs
|
|
|
|
|
+ self.fields['untagged_vlan'].widget.attrs['1-data-additional-query-param-site_id'] = self.parent.site.pk
|
|
|
|
|
+ self.fields['tagged_vlans'].widget.attrs['1-data-additional-query-param-site_id'] = self.parent.site.pk
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class InterfaceBulkEditForm(InterfaceCommonForm, BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
|
|
class InterfaceBulkEditForm(InterfaceCommonForm, BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
|
|
|
pk = forms.ModelMultipleChoiceField(
|
|
pk = forms.ModelMultipleChoiceField(
|
|
@@ -2367,6 +2387,9 @@ class InterfaceBulkEditForm(InterfaceCommonForm, BootstrapMixin, AddRemoveTagsFo
|
|
|
widget=APISelect(
|
|
widget=APISelect(
|
|
|
api_url="/api/ipam/vlans/",
|
|
api_url="/api/ipam/vlans/",
|
|
|
display_field='display_name',
|
|
display_field='display_name',
|
|
|
|
|
+ additional_query_params={
|
|
|
|
|
+ 'site_id': 'null'
|
|
|
|
|
+ },
|
|
|
full=True
|
|
full=True
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -2376,6 +2399,9 @@ class InterfaceBulkEditForm(InterfaceCommonForm, BootstrapMixin, AddRemoveTagsFo
|
|
|
widget=APISelectMultiple(
|
|
widget=APISelectMultiple(
|
|
|
api_url="/api/ipam/vlans/",
|
|
api_url="/api/ipam/vlans/",
|
|
|
display_field='display_name',
|
|
display_field='display_name',
|
|
|
|
|
+ additional_query_params={
|
|
|
|
|
+ 'site_id': 'null'
|
|
|
|
|
+ },
|
|
|
full=True
|
|
full=True
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -2398,6 +2424,10 @@ class InterfaceBulkEditForm(InterfaceCommonForm, BootstrapMixin, AddRemoveTagsFo
|
|
|
else:
|
|
else:
|
|
|
self.fields['lag'].choices = []
|
|
self.fields['lag'].choices = []
|
|
|
|
|
|
|
|
|
|
+ # Add the current site to the list of filtered VLANs
|
|
|
|
|
+ self.fields['untagged_vlan'].widget.attrs['1-data-additional-query-param-site_id'] = self.parent_obj.site.pk
|
|
|
|
|
+ self.fields['tagged_vlans'].widget.attrs['1-data-additional-query-param-site_id'] = self.parent_obj.site.pk
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class InterfaceBulkRenameForm(BulkRenameForm):
|
|
class InterfaceBulkRenameForm(BulkRenameForm):
|
|
|
pk = forms.ModelMultipleChoiceField(
|
|
pk = forms.ModelMultipleChoiceField(
|