mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 00:28:16 -06:00
Clean up tables & templates
This commit is contained in:
parent
a16ad7474b
commit
6144409058
@ -1032,7 +1032,7 @@ class RearPortTemplateForm(ModularComponentTemplateForm):
|
||||
]
|
||||
|
||||
|
||||
class ModuleBayTemplateForm(ComponentTemplateForm):
|
||||
class ModuleBayTemplateForm(ModularComponentTemplateForm):
|
||||
fieldsets = (
|
||||
FieldSet('device_type', 'module_type', 'name', 'label', 'position', 'description'),
|
||||
)
|
||||
@ -1452,7 +1452,7 @@ class RearPortForm(ModularDeviceComponentForm):
|
||||
]
|
||||
|
||||
|
||||
class ModuleBayForm(DeviceComponentForm):
|
||||
class ModuleBayForm(ModularDeviceComponentForm):
|
||||
fieldsets = (
|
||||
FieldSet('device', 'module', 'name', 'label', 'position', 'description', 'tags',),
|
||||
)
|
||||
|
@ -852,6 +852,11 @@ class ModuleBayTable(ModularDeviceComponentTable):
|
||||
'args': [Accessor('device_id')],
|
||||
}
|
||||
)
|
||||
parent_bay = tables.Column(
|
||||
accessor=tables.A('module__module_bay'),
|
||||
linkify=True,
|
||||
verbose_name=_('Parent Bay')
|
||||
)
|
||||
installed_module = tables.Column(
|
||||
linkify=True,
|
||||
verbose_name=_('Installed Module')
|
||||
@ -876,10 +881,18 @@ class ModuleBayTable(ModularDeviceComponentTable):
|
||||
class Meta(DeviceComponentTable.Meta):
|
||||
model = models.ModuleBay
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'module_status', 'module_serial',
|
||||
'module_asset_tag', 'description', 'tags',
|
||||
'pk', 'id', 'name', 'device', 'parent_bay', 'label', 'position', 'installed_module', 'module_status',
|
||||
'module_serial', 'module_asset_tag', 'description', 'tags',
|
||||
)
|
||||
default_columns = ('pk', 'name', 'device', 'label', 'installed_module', 'module_status', 'description')
|
||||
default_columns = (
|
||||
'pk', 'name', 'device', 'parent_bay', 'label', 'installed_module', 'module_status', 'description',
|
||||
)
|
||||
|
||||
def render_parent_bay(self, value):
|
||||
return value.name if value else ''
|
||||
|
||||
def render_installed_module(self, value):
|
||||
return value.module_type if value else ''
|
||||
|
||||
|
||||
class DeviceModuleBayTable(ModuleBayTable):
|
||||
@ -890,10 +903,10 @@ class DeviceModuleBayTable(ModuleBayTable):
|
||||
class Meta(DeviceComponentTable.Meta):
|
||||
model = models.ModuleBay
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'label', 'position', 'installed_module', 'module_status', 'module_serial', 'module_asset_tag',
|
||||
'description', 'tags', 'actions',
|
||||
'pk', 'id', 'parent_bay', 'name', 'label', 'position', 'installed_module', 'module_status', 'module_serial',
|
||||
'module_asset_tag', 'description', 'tags', 'actions',
|
||||
)
|
||||
default_columns = ('pk', 'name', 'label', 'installed_module', 'module_status', 'description')
|
||||
default_columns = ('pk', 'parent_bay', 'name', 'label', 'installed_module', 'module_status', 'description')
|
||||
|
||||
|
||||
class InventoryItemTable(DeviceComponentTable):
|
||||
|
@ -39,6 +39,9 @@
|
||||
{% if perms.dcim.add_rearport %}
|
||||
<li><a class="dropdown-item" href="{% url 'dcim:rearport_add' %}?device={{ object.device.pk }}&module={{ object.pk }}&return_url={% url 'dcim:device_rearports' pk=object.device.pk %}">{% trans "Rear Ports" %}</a></li>
|
||||
{% endif %}
|
||||
{% if perms.dcim.add_modulebay %}
|
||||
<li><a class="dropdown-item" href="{% url 'dcim:modulebay_add' %}?device={{ object.pk }}&module={{ object.pk }}&return_url={% url 'dcim:device_modulebays' pk=object.pk %}">{% trans "Module Bays" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -23,8 +23,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Module" %}</th>
|
||||
<td>{{ object.module|linkify|placeholder }}</td>
|
||||
<th scope="row">{% trans "Module" %}</th>
|
||||
<td>{{ object.module|linkify|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Name" %}</th>
|
||||
@ -35,8 +35,8 @@
|
||||
<td>{{ object.label|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Position" %}</th>
|
||||
<td>{{ object.position|placeholder }}</td>
|
||||
<th scope="row">{% trans "Position" %}</th>
|
||||
<td>{{ object.position|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Description" %}</th>
|
||||
|
@ -27,10 +27,8 @@
|
||||
<td>{{ object.description|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Airflow" %}</th>
|
||||
<td>
|
||||
{{ object.get_airflow_display|placeholder }}
|
||||
</td>
|
||||
<th scope="row">{% trans "Airflow" %}</th>
|
||||
<td>{{ object.get_airflow_display|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Weight" %}</th>
|
||||
|
@ -39,6 +39,9 @@
|
||||
{% if perms.dcim.add_rearporttemplate %}
|
||||
<li><a class="dropdown-item" href="{% url 'dcim:rearporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_rearports' pk=object.pk %}">{% trans "Rear Ports" %}</a></li>
|
||||
{% endif %}
|
||||
{% if perms.dcim.add_modulebaytemplate %}
|
||||
<li><a class="dropdown-item" href="{% url 'dcim:modulebaytemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_modulebays' pk=object.pk %}">{% trans "Module Bays" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user