mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Removed 'is_patch_panel' from DeviceType
This commit is contained in:
parent
b19e2037af
commit
266429101b
@ -226,7 +226,7 @@ class DeviceTypeSerializer(TaggitSerializer, CustomFieldModelSerializer):
|
||||
model = DeviceType
|
||||
fields = [
|
||||
'id', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'interface_ordering',
|
||||
'is_console_server', 'is_pdu', 'is_network_device', 'is_patch_panel', 'subdevice_role', 'comments', 'tags',
|
||||
'is_console_server', 'is_pdu', 'is_network_device', 'subdevice_role', 'comments', 'tags',
|
||||
'custom_fields', 'created', 'last_updated', 'instance_count',
|
||||
]
|
||||
|
||||
|
@ -532,7 +532,7 @@ class DeviceTypeForm(BootstrapMixin, CustomFieldForm):
|
||||
model = DeviceType
|
||||
fields = [
|
||||
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'is_console_server', 'is_pdu',
|
||||
'is_network_device', 'is_patch_panel', 'subdevice_role', 'interface_ordering', 'comments', 'tags',
|
||||
'is_network_device', 'subdevice_role', 'interface_ordering', 'comments', 'tags',
|
||||
]
|
||||
labels = {
|
||||
'interface_ordering': 'Order interfaces by',
|
||||
@ -582,9 +582,6 @@ class DeviceTypeBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkE
|
||||
is_network_device = forms.NullBooleanField(
|
||||
required=False, widget=BulkEditNullBooleanSelect, label='Is a network device'
|
||||
)
|
||||
is_patch_panel = forms.NullBooleanField(
|
||||
required=False, widget=BulkEditNullBooleanSelect, label='Is a patch panel'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = []
|
||||
@ -605,9 +602,6 @@ class DeviceTypeFilterForm(BootstrapMixin, CustomFieldFilterForm):
|
||||
is_network_device = forms.BooleanField(
|
||||
required=False, label='Is a network device', widget=forms.CheckboxInput(attrs={'value': 'True'})
|
||||
)
|
||||
is_patch_panel = forms.BooleanField(
|
||||
required=False, label='Is a patch panel', widget=forms.CheckboxInput(attrs={'value': 'True'})
|
||||
)
|
||||
subdevice_role = forms.NullBooleanField(
|
||||
required=False, label='Subdevice role', widget=forms.Select(choices=(
|
||||
('', '---------'),
|
||||
|
@ -65,11 +65,6 @@ class Migration(migrations.Migration):
|
||||
'ordering': ['device_type', 'name'],
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='devicetype',
|
||||
name='is_patch_panel',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='rearporttemplate',
|
||||
name='device_type',
|
||||
|
@ -770,11 +770,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
|
||||
verbose_name='Is a network device',
|
||||
help_text='This type of device has network interfaces'
|
||||
)
|
||||
is_patch_panel = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name='Is a patch panel',
|
||||
help_text='This type of device has patch panel ports'
|
||||
)
|
||||
subdevice_role = models.NullBooleanField(
|
||||
default=None,
|
||||
verbose_name='Parent/child status',
|
||||
@ -794,8 +789,8 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
|
||||
tags = TaggableManager()
|
||||
|
||||
csv_headers = [
|
||||
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'is_console_server',
|
||||
'is_pdu', 'is_network_device', 'is_patch_panel', 'subdevice_role', 'interface_ordering', 'comments',
|
||||
'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'is_console_server', 'is_pdu',
|
||||
'is_network_device', 'subdevice_role', 'interface_ordering', 'comments',
|
||||
]
|
||||
|
||||
class Meta:
|
||||
@ -828,7 +823,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
|
||||
self.is_console_server,
|
||||
self.is_pdu,
|
||||
self.is_network_device,
|
||||
self.is_patch_panel,
|
||||
self.get_subdevice_role_display() if self.subdevice_role else None,
|
||||
self.get_interface_ordering_display(),
|
||||
self.comments,
|
||||
@ -868,14 +862,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
|
||||
"device before declassifying it as a network device."
|
||||
})
|
||||
|
||||
if not self.is_patch_panel and (
|
||||
self.front_port_templates.exists() or self.rear_port_templates.exists()
|
||||
):
|
||||
raise ValidationError({
|
||||
'is_patch_panel': "Must delete all patch panel port templates associated with this device before "
|
||||
"declassifying it as a network device."
|
||||
})
|
||||
|
||||
if self.subdevice_role != SUBDEVICE_ROLE_PARENT and self.device_bay_templates.count():
|
||||
raise ValidationError({
|
||||
'subdevice_role': "Must delete all device bay templates associated with this device before "
|
||||
|
@ -348,7 +348,6 @@ class DeviceTypeTable(BaseTable):
|
||||
is_console_server = BooleanColumn(verbose_name='CS')
|
||||
is_pdu = BooleanColumn(verbose_name='PDU')
|
||||
is_network_device = BooleanColumn(verbose_name='Net')
|
||||
is_patch_panel = BooleanColumn(verbose_name='PP')
|
||||
subdevice_role = tables.TemplateColumn(
|
||||
template_code=SUBDEVICE_ROLE_TEMPLATE,
|
||||
verbose_name='Subdevice Role'
|
||||
@ -362,7 +361,7 @@ class DeviceTypeTable(BaseTable):
|
||||
model = DeviceType
|
||||
fields = (
|
||||
'pk', 'model', 'manufacturer', 'part_number', 'u_height', 'is_full_depth', 'is_console_server', 'is_pdu',
|
||||
'is_network_device', 'is_patch_panel', 'subdevice_role', 'instance_count',
|
||||
'is_network_device', 'subdevice_role', 'instance_count',
|
||||
)
|
||||
|
||||
|
||||
|
@ -689,12 +689,12 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if front_ports or device.device_type.is_patch_panel %}
|
||||
{% if front_ports %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Front Panel Ports</strong>
|
||||
<strong>Front Ports</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-headings panel-body component-list">
|
||||
<thead>
|
||||
@ -742,12 +742,12 @@
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if rear_ports or device.device_type.is_patch_panel %}
|
||||
{% if rear_ports %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Rear Panel Ports</strong>
|
||||
<strong>Rear Ports</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-headings panel-body component-list">
|
||||
<thead>
|
||||
|
@ -135,19 +135,6 @@
|
||||
<small class="text-muted">This device {% if devicetype.is_network_device %}has{% else %}does not have{% endif %} network interfaces</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right">
|
||||
{% if devicetype.is_patch_panel %}
|
||||
<i class="glyphicon glyphicon-ok text-success" title="Yes"></i>
|
||||
{% else %}
|
||||
<i class="glyphicon glyphicon-remove text-danger" title="No"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<strong>Patch Panel</strong><br />
|
||||
<small class="text-muted">This device {% if devicetype.is_patch_panel %}has{% else %}does not have{% endif %} patch panel ports</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right">
|
||||
{% if devicetype.subdevice_role == True %}
|
||||
@ -201,12 +188,16 @@
|
||||
{% if devicetype.is_pdu or poweroutlet_table.rows %}
|
||||
{% include 'dcim/inc/devicetype_component_table.html' with table=poweroutlet_table title='Power Outlets' add_url='dcim:devicetype_add_poweroutlet' delete_url='dcim:devicetype_delete_poweroutlet' %}
|
||||
{% endif %}
|
||||
{% if devicetype.is_patch_panel or front_port_table.rows %}
|
||||
{% include 'dcim/inc/devicetype_component_table.html' with table=front_port_table title='Front Panel Ports' add_url='dcim:devicetype_add_frontport' delete_url='dcim:devicetype_delete_frontport' %}
|
||||
{% endif %}
|
||||
{% if devicetype.is_patch_panel or rear_port_table.rows %}
|
||||
{% include 'dcim/inc/devicetype_component_table.html' with table=rear_port_table title='Rear Panel Ports' add_url='dcim:devicetype_add_rearport' delete_url='dcim:devicetype_delete_rearport' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if devicetype.front_port_templates.exists or devicetype.rear_port_templates.exists %}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{% include 'dcim/inc/devicetype_component_table.html' with table=front_port_table title='Front Ports' add_url='dcim:devicetype_add_frontport' delete_url='dcim:devicetype_delete_frontport' %}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{% include 'dcim/inc/devicetype_component_table.html' with table=rear_port_table title='Rear Ports' add_url='dcim:devicetype_add_rearport' delete_url='dcim:devicetype_delete_rearport' %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -20,7 +20,6 @@
|
||||
{% render_field form.is_console_server %}
|
||||
{% render_field form.is_pdu %}
|
||||
{% render_field form.is_network_device %}
|
||||
{% render_field form.is_patch_panel %}
|
||||
{% render_field form.subdevice_role %}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user