瀏覽代碼

Removed 'is_patch_panel' from DeviceType

Jeremy Stretch 7 年之前
父節點
當前提交
266429101b

+ 1 - 1
netbox/dcim/api/serializers.py

@@ -226,7 +226,7 @@ class DeviceTypeSerializer(TaggitSerializer, CustomFieldModelSerializer):
         model = DeviceType
         model = DeviceType
         fields = [
         fields = [
             'id', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'interface_ordering',
             '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',
             'custom_fields', 'created', 'last_updated', 'instance_count',
         ]
         ]
 
 

+ 1 - 7
netbox/dcim/forms.py

@@ -532,7 +532,7 @@ class DeviceTypeForm(BootstrapMixin, CustomFieldForm):
         model = DeviceType
         model = DeviceType
         fields = [
         fields = [
             'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'is_console_server', 'is_pdu',
             '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 = {
         labels = {
             'interface_ordering': 'Order interfaces by',
             'interface_ordering': 'Order interfaces by',
@@ -582,9 +582,6 @@ class DeviceTypeBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkE
     is_network_device = forms.NullBooleanField(
     is_network_device = forms.NullBooleanField(
         required=False, widget=BulkEditNullBooleanSelect, label='Is a network device'
         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:
     class Meta:
         nullable_fields = []
         nullable_fields = []
@@ -605,9 +602,6 @@ class DeviceTypeFilterForm(BootstrapMixin, CustomFieldFilterForm):
     is_network_device = forms.BooleanField(
     is_network_device = forms.BooleanField(
         required=False, label='Is a network device', widget=forms.CheckboxInput(attrs={'value': 'True'})
         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(
     subdevice_role = forms.NullBooleanField(
         required=False, label='Subdevice role', widget=forms.Select(choices=(
         required=False, label='Subdevice role', widget=forms.Select(choices=(
             ('', '---------'),
             ('', '---------'),

+ 0 - 5
netbox/dcim/migrations/0065_front_rear_ports.py

@@ -65,11 +65,6 @@ class Migration(migrations.Migration):
                 'ordering': ['device_type', 'name'],
                 'ordering': ['device_type', 'name'],
             },
             },
         ),
         ),
-        migrations.AddField(
-            model_name='devicetype',
-            name='is_patch_panel',
-            field=models.BooleanField(default=False),
-        ),
         migrations.AddField(
         migrations.AddField(
             model_name='rearporttemplate',
             model_name='rearporttemplate',
             name='device_type',
             name='device_type',

+ 2 - 16
netbox/dcim/models.py

@@ -770,11 +770,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
         verbose_name='Is a network device',
         verbose_name='Is a network device',
         help_text='This type of device has network interfaces'
         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(
     subdevice_role = models.NullBooleanField(
         default=None,
         default=None,
         verbose_name='Parent/child status',
         verbose_name='Parent/child status',
@@ -794,8 +789,8 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
     tags = TaggableManager()
     tags = TaggableManager()
 
 
     csv_headers = [
     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:
     class Meta:
@@ -828,7 +823,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
             self.is_console_server,
             self.is_console_server,
             self.is_pdu,
             self.is_pdu,
             self.is_network_device,
             self.is_network_device,
-            self.is_patch_panel,
             self.get_subdevice_role_display() if self.subdevice_role else None,
             self.get_subdevice_role_display() if self.subdevice_role else None,
             self.get_interface_ordering_display(),
             self.get_interface_ordering_display(),
             self.comments,
             self.comments,
@@ -868,14 +862,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
                                      "device before declassifying it as a network device."
                                      "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():
         if self.subdevice_role != SUBDEVICE_ROLE_PARENT and self.device_bay_templates.count():
             raise ValidationError({
             raise ValidationError({
                 'subdevice_role': "Must delete all device bay templates associated with this device before "
                 'subdevice_role': "Must delete all device bay templates associated with this device before "

+ 1 - 2
netbox/dcim/tables.py

@@ -348,7 +348,6 @@ class DeviceTypeTable(BaseTable):
     is_console_server = BooleanColumn(verbose_name='CS')
     is_console_server = BooleanColumn(verbose_name='CS')
     is_pdu = BooleanColumn(verbose_name='PDU')
     is_pdu = BooleanColumn(verbose_name='PDU')
     is_network_device = BooleanColumn(verbose_name='Net')
     is_network_device = BooleanColumn(verbose_name='Net')
-    is_patch_panel = BooleanColumn(verbose_name='PP')
     subdevice_role = tables.TemplateColumn(
     subdevice_role = tables.TemplateColumn(
         template_code=SUBDEVICE_ROLE_TEMPLATE,
         template_code=SUBDEVICE_ROLE_TEMPLATE,
         verbose_name='Subdevice Role'
         verbose_name='Subdevice Role'
@@ -362,7 +361,7 @@ class DeviceTypeTable(BaseTable):
         model = DeviceType
         model = DeviceType
         fields = (
         fields = (
             'pk', 'model', 'manufacturer', 'part_number', 'u_height', 'is_full_depth', 'is_console_server', 'is_pdu',
             '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',
         )
         )
 
 
 
 

+ 4 - 4
netbox/templates/dcim/device.html

@@ -689,12 +689,12 @@
                     </form>
                     </form>
                 {% endif %}
                 {% endif %}
             {% endif %}
             {% endif %}
-            {% if front_ports or device.device_type.is_patch_panel %}
+            {% if front_ports %}
                 <form method="post">
                 <form method="post">
                 {% csrf_token %}
                 {% csrf_token %}
                     <div class="panel panel-default">
                     <div class="panel panel-default">
                         <div class="panel-heading">
                         <div class="panel-heading">
-                            <strong>Front Panel Ports</strong>
+                            <strong>Front Ports</strong>
                         </div>
                         </div>
                         <table class="table table-hover table-headings panel-body component-list">
                         <table class="table table-hover table-headings panel-body component-list">
                             <thead>
                             <thead>
@@ -742,12 +742,12 @@
                     </div>
                     </div>
                 </form>
                 </form>
             {% endif %}
             {% endif %}
-            {% if rear_ports or device.device_type.is_patch_panel %}
+            {% if rear_ports %}
                 <form method="post">
                 <form method="post">
                 {% csrf_token %}
                 {% csrf_token %}
                     <div class="panel panel-default">
                     <div class="panel panel-default">
                         <div class="panel-heading">
                         <div class="panel-heading">
-                            <strong>Rear Panel Ports</strong>
+                            <strong>Rear Ports</strong>
                         </div>
                         </div>
                         <table class="table table-hover table-headings panel-body component-list">
                         <table class="table table-hover table-headings panel-body component-list">
                             <thead>
                             <thead>

+ 10 - 19
netbox/templates/dcim/devicetype.html

@@ -135,19 +135,6 @@
                         <small class="text-muted">This device {% if devicetype.is_network_device %}has{% else %}does not have{% endif %} network interfaces</small>
                         <small class="text-muted">This device {% if devicetype.is_network_device %}has{% else %}does not have{% endif %} network interfaces</small>
                     </td>
                     </td>
                 </tr>
                 </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>
                 <tr>
                     <td class="text-right">
                     <td class="text-right">
                         {% if devicetype.subdevice_role == True %}
                         {% if devicetype.subdevice_role == True %}
@@ -201,12 +188,16 @@
         {% if devicetype.is_pdu or poweroutlet_table.rows %}
         {% 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' %}
             {% 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 %}
         {% 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>
 </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 %}
 {% endblock %}

+ 0 - 1
netbox/templates/dcim/devicetype_edit.html

@@ -20,7 +20,6 @@
             {% render_field form.is_console_server %}
             {% render_field form.is_console_server %}
             {% render_field form.is_pdu %}
             {% render_field form.is_pdu %}
             {% render_field form.is_network_device %}
             {% render_field form.is_network_device %}
-            {% render_field form.is_patch_panel %}
             {% render_field form.subdevice_role %}
             {% render_field form.subdevice_role %}
         </div>
         </div>
     </div>
     </div>