mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #2601: Added a description field to pass-through ports
This commit is contained in:
@ -58,6 +58,7 @@ NetBox now supports modeling physical cables for console, power, and interface c
|
|||||||
* [#2585](https://github.com/digitalocean/netbox/issues/2585) - Prevent cable connections that include a virtual interface
|
* [#2585](https://github.com/digitalocean/netbox/issues/2585) - Prevent cable connections that include a virtual interface
|
||||||
* [#2586](https://github.com/digitalocean/netbox/issues/2586) - Added tests for the Cable model's clean() method
|
* [#2586](https://github.com/digitalocean/netbox/issues/2586) - Added tests for the Cable model's clean() method
|
||||||
* [#2593](https://github.com/digitalocean/netbox/issues/2593) - Fix toggling of connected cable's status
|
* [#2593](https://github.com/digitalocean/netbox/issues/2593) - Fix toggling of connected cable's status
|
||||||
|
* [#2601](https://github.com/digitalocean/netbox/issues/2601) - Added a `description` field to pass-through ports
|
||||||
* [#2602](https://github.com/digitalocean/netbox/issues/2602) - Return HTTP 204 when no new IPs/prefixes are available for provisioning
|
* [#2602](https://github.com/digitalocean/netbox/issues/2602) - Return HTTP 204 when no new IPs/prefixes are available for provisioning
|
||||||
|
|
||||||
## API Changes
|
## API Changes
|
||||||
|
@ -416,7 +416,7 @@ class RearPortSerializer(ValidatedModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RearPort
|
model = RearPort
|
||||||
fields = ['id', 'device', 'name', 'type', 'positions', 'cable', 'tags']
|
fields = ['id', 'device', 'name', 'type', 'positions', 'description', 'cable', 'tags']
|
||||||
|
|
||||||
|
|
||||||
class FrontPortRearPortSerializer(WritableNestedSerializer):
|
class FrontPortRearPortSerializer(WritableNestedSerializer):
|
||||||
@ -439,7 +439,7 @@ class FrontPortSerializer(ValidatedModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = FrontPort
|
model = FrontPort
|
||||||
fields = ['id', 'device', 'name', 'type', 'rear_port', 'rear_port_position', 'cable', 'tags']
|
fields = ['id', 'device', 'name', 'type', 'rear_port', 'rear_port_position', 'description', 'cable', 'tags']
|
||||||
|
|
||||||
|
|
||||||
class DeviceBaySerializer(TaggitSerializer, ValidatedModelSerializer):
|
class DeviceBaySerializer(TaggitSerializer, ValidatedModelSerializer):
|
||||||
|
@ -1685,13 +1685,13 @@ class FrontPortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = FrontPort
|
model = FrontPort
|
||||||
fields = ['device', 'name', 'type', 'rear_port', 'rear_port_position', 'tags']
|
fields = ['device', 'name', 'type', 'rear_port', 'rear_port_position', 'description', 'tags']
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# TODO: Merge with FrontPortTemplateCreateForm to remove duplicate logic
|
# TODO: Merge with FrontPortTemplateCreateForm to remove duplicate logic
|
||||||
class FrontPortCreateForm(ComponentForm):
|
class FrontPortCreateForm(ComponentForm):
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -1704,6 +1704,9 @@ class FrontPortCreateForm(ComponentForm):
|
|||||||
label='Rear ports',
|
label='Rear ports',
|
||||||
help_text='Select one rear port assignment for each front port being created.'
|
help_text='Select one rear port assignment for each front port being created.'
|
||||||
)
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
@ -1771,7 +1774,7 @@ class RearPortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RearPort
|
model = RearPort
|
||||||
fields = ['device', 'name', 'type', 'positions', 'tags']
|
fields = ['device', 'name', 'type', 'positions', 'description', 'tags']
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
}
|
}
|
||||||
@ -1790,6 +1793,9 @@ class RearPortCreateForm(ComponentForm):
|
|||||||
initial=1,
|
initial=1,
|
||||||
help_text='The number of front ports which may be mapped to each rear port'
|
help_text='The number of front ports which may be mapped to each rear port'
|
||||||
)
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RearPortBulkRenameForm(BulkRenameForm):
|
class RearPortBulkRenameForm(BulkRenameForm):
|
||||||
|
@ -19,6 +19,7 @@ class Migration(migrations.Migration):
|
|||||||
('name', models.CharField(max_length=64)),
|
('name', models.CharField(max_length=64)),
|
||||||
('type', models.PositiveSmallIntegerField()),
|
('type', models.PositiveSmallIntegerField()),
|
||||||
('rear_port_position', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(64)])),
|
('rear_port_position', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(64)])),
|
||||||
|
('description', models.CharField(blank=True, max_length=100)),
|
||||||
('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='frontports', to='dcim.Device')),
|
('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='frontports', to='dcim.Device')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
@ -44,6 +45,7 @@ class Migration(migrations.Migration):
|
|||||||
('name', models.CharField(max_length=64)),
|
('name', models.CharField(max_length=64)),
|
||||||
('type', models.PositiveSmallIntegerField()),
|
('type', models.PositiveSmallIntegerField()),
|
||||||
('positions', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(64)])),
|
('positions', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(64)])),
|
||||||
|
('description', models.CharField(blank=True, max_length=100)),
|
||||||
('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rearports', to='dcim.Device')),
|
('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rearports', to='dcim.Device')),
|
||||||
('tags', taggit.managers.TaggableManager(through='taggit.TaggedItem', to='taggit.Tag')),
|
('tags', taggit.managers.TaggableManager(through='taggit.TaggedItem', to='taggit.Tag')),
|
||||||
],
|
],
|
||||||
|
@ -2158,11 +2158,15 @@ class FrontPort(CableTermination, ComponentModel):
|
|||||||
default=1,
|
default=1,
|
||||||
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
||||||
)
|
)
|
||||||
|
description = models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
blank=True
|
||||||
|
)
|
||||||
|
|
||||||
objects = DeviceComponentManager()
|
objects = DeviceComponentManager()
|
||||||
tags = TaggableManager()
|
tags = TaggableManager()
|
||||||
|
|
||||||
csv_headers = ['device', 'name', 'type', 'rear_port', 'rear_port_position']
|
csv_headers = ['device', 'name', 'type', 'rear_port', 'rear_port_position', 'description']
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['device', 'name']
|
ordering = ['device', 'name']
|
||||||
@ -2181,6 +2185,7 @@ class FrontPort(CableTermination, ComponentModel):
|
|||||||
self.get_type_display(),
|
self.get_type_display(),
|
||||||
self.rear_port.name,
|
self.rear_port.name,
|
||||||
self.rear_port_position,
|
self.rear_port_position,
|
||||||
|
self.description,
|
||||||
)
|
)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
@ -2219,11 +2224,15 @@ class RearPort(CableTermination, ComponentModel):
|
|||||||
default=1,
|
default=1,
|
||||||
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
||||||
)
|
)
|
||||||
|
description = models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
blank=True
|
||||||
|
)
|
||||||
|
|
||||||
objects = DeviceComponentManager()
|
objects = DeviceComponentManager()
|
||||||
tags = TaggableManager()
|
tags = TaggableManager()
|
||||||
|
|
||||||
csv_headers = ['device', 'name', 'type', 'positions']
|
csv_headers = ['device', 'name', 'type', 'positions', 'description']
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['device', 'name']
|
ordering = ['device', 'name']
|
||||||
@ -2238,6 +2247,7 @@ class RearPort(CableTermination, ComponentModel):
|
|||||||
self.name,
|
self.name,
|
||||||
self.get_type_display(),
|
self.get_type_display(),
|
||||||
self.positions,
|
self.positions,
|
||||||
|
self.description,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ class FrontPortTable(BaseTable):
|
|||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
model = FrontPort
|
model = FrontPort
|
||||||
fields = ('name', 'type', 'rear_port', 'rear_port_position')
|
fields = ('name', 'type', 'rear_port', 'rear_port_position', 'description')
|
||||||
empty_text = "None"
|
empty_text = "None"
|
||||||
|
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ class RearPortTable(BaseTable):
|
|||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
model = RearPort
|
model = RearPort
|
||||||
fields = ('name', 'type', 'positions')
|
fields = ('name', 'type', 'positions', 'description')
|
||||||
empty_text = "None"
|
empty_text = "None"
|
||||||
|
|
||||||
|
|
||||||
|
@ -681,6 +681,7 @@
|
|||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Rear Port</th>
|
<th>Rear Port</th>
|
||||||
<th>Position</th>
|
<th>Position</th>
|
||||||
|
<th>Description</th>
|
||||||
<th>Connected Cable</th>
|
<th>Connected Cable</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -733,6 +734,7 @@
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Positions</th>
|
<th>Positions</th>
|
||||||
|
<th>Description</th>
|
||||||
<th>Connected Cable</th>
|
<th>Connected Cable</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% load helpers %}
|
||||||
<tr class="frontport{% if frontport.cable.status %} success{% elif frontport.cable %} info{% endif %}">
|
<tr class="frontport{% if frontport.cable.status %} success{% elif frontport.cable %} info{% endif %}">
|
||||||
|
|
||||||
{# Checkbox #}
|
{# Checkbox #}
|
||||||
@ -19,6 +20,9 @@
|
|||||||
<td>{{ frontport.rear_port }}</td>
|
<td>{{ frontport.rear_port }}</td>
|
||||||
<td>{{ frontport.rear_port_position }}</td>
|
<td>{{ frontport.rear_port_position }}</td>
|
||||||
|
|
||||||
|
{# Description #}
|
||||||
|
<td>{{ frontport.description|placeholder }}</td>
|
||||||
|
|
||||||
{# Cable #}
|
{# Cable #}
|
||||||
<td>
|
<td>
|
||||||
{% if frontport.cable %}
|
{% if frontport.cable %}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% load helpers %}
|
||||||
<tr class="rearport{% if rearport.cable.status %} success{% elif rearport.cable %} info{% endif %}">
|
<tr class="rearport{% if rearport.cable.status %} success{% elif rearport.cable %} info{% endif %}">
|
||||||
|
|
||||||
{# Checkbox #}
|
{# Checkbox #}
|
||||||
@ -18,6 +19,9 @@
|
|||||||
{# Positions #}
|
{# Positions #}
|
||||||
<td>{{ rearport.positions }}</td>
|
<td>{{ rearport.positions }}</td>
|
||||||
|
|
||||||
|
{# Description #}
|
||||||
|
<td>{{ rearport.description|placeholder }}</td>
|
||||||
|
|
||||||
{# Cable #}
|
{# Cable #}
|
||||||
<td>
|
<td>
|
||||||
{% if rearport.cable %}
|
{% if rearport.cable %}
|
||||||
|
Reference in New Issue
Block a user