mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-18 01:32:17 -06:00
Define UI layout for Platform view
This commit is contained in:
@@ -166,6 +166,11 @@ class ModuleTypePanel(panels.ObjectAttributesPanel):
|
|||||||
weight = attrs.NumericAttr('weight', unit_accessor='get_weight_unit_display')
|
weight = attrs.NumericAttr('weight', unit_accessor='get_weight_unit_display')
|
||||||
|
|
||||||
|
|
||||||
|
class PlatformPanel(panels.NestedGroupObjectPanel):
|
||||||
|
manufacturer = attrs.RelatedObjectAttr('manufacturer', linkify=True)
|
||||||
|
config_template = attrs.RelatedObjectAttr('config_template', linkify=True)
|
||||||
|
|
||||||
|
|
||||||
class VirtualChassisMembersPanel(panels.ObjectPanel):
|
class VirtualChassisMembersPanel(panels.ObjectPanel):
|
||||||
"""
|
"""
|
||||||
A panel which lists all members of a virtual chassis.
|
A panel which lists all members of a virtual chassis.
|
||||||
|
|||||||
@@ -2410,6 +2410,27 @@ class PlatformListView(generic.ObjectListView):
|
|||||||
@register_model_view(Platform)
|
@register_model_view(Platform)
|
||||||
class PlatformView(GetRelatedModelsMixin, generic.ObjectView):
|
class PlatformView(GetRelatedModelsMixin, generic.ObjectView):
|
||||||
queryset = Platform.objects.all()
|
queryset = Platform.objects.all()
|
||||||
|
layout = layout.SimpleLayout(
|
||||||
|
left_panels=[
|
||||||
|
panels.PlatformPanel(),
|
||||||
|
TagsPanel(),
|
||||||
|
],
|
||||||
|
right_panels=[
|
||||||
|
RelatedObjectsPanel(),
|
||||||
|
CustomFieldsPanel(),
|
||||||
|
CommentsPanel(),
|
||||||
|
],
|
||||||
|
bottom_panels=[
|
||||||
|
ObjectsTablePanel(
|
||||||
|
model='dcim.Platform',
|
||||||
|
title=_('Child Platforms'),
|
||||||
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
actions=[
|
||||||
|
actions.AddObject('dcim.Platform', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -18,61 +18,3 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock extra_controls %}
|
{% endblock extra_controls %}
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row mb-3">
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<h2 class="card-header">{% trans "Platform" %}</h2>
|
|
||||||
<table class="table table-hover attr-table">
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Name" %}</th>
|
|
||||||
<td>{{ object.name }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Description" %}</th>
|
|
||||||
<td>{{ object.description|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Parent" %}</th>
|
|
||||||
<td>{{ object.parent|linkify|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Manufacturer" %}</th>
|
|
||||||
<td>{{ object.manufacturer|linkify|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Config Template" %}</th>
|
|
||||||
<td>{{ object.config_template|linkify|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{% include 'inc/panels/tags.html' %}
|
|
||||||
{% plugin_left_page object %}
|
|
||||||
</div>
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
{% include 'inc/panels/related_objects.html' %}
|
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
|
||||||
{% include 'inc/panels/comments.html' %}
|
|
||||||
{% plugin_right_page object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-3">
|
|
||||||
<div class="col col-md-12">
|
|
||||||
<div class="card">
|
|
||||||
<h2 class="card-header">
|
|
||||||
{% trans "Child Platforms" %}
|
|
||||||
{% if perms.dcim.add_platform %}
|
|
||||||
<div class="card-actions">
|
|
||||||
<a href="{% url 'dcim:platform_add' %}?parent={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
|
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Platform" %}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</h2>
|
|
||||||
{% htmx_table 'dcim:platform_list' parent_id=object.pk %}
|
|
||||||
</div>
|
|
||||||
{% plugin_full_width_page object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user