Merge pull request #6779 from netbox-community/jstretch-ui-work

Pending UI work for v3.0 beta
This commit is contained in:
Jeremy Stretch 2021-07-22 08:10:44 -04:00 committed by GitHub
commit 108305a3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 54 additions and 264 deletions

View File

@ -276,6 +276,21 @@ class ConfigContextView(generic.ObjectView):
queryset = ConfigContext.objects.all() queryset = ConfigContext.objects.all()
def get_extra_context(self, request, instance): def get_extra_context(self, request, instance):
# Gather assigned objects for parsing in the template
assigned_objects = (
('Regions', instance.regions.all),
('Site Groups', instance.site_groups.all),
('Sites', instance.sites.all),
('Device Types', instance.device_types.all),
('Roles', instance.roles.all),
('Platforms', instance.platforms.all),
('Cluster Groups', instance.cluster_groups.all),
('Clusters', instance.clusters.all),
('Tenant Groups', instance.tenant_groups.all),
('Tenants', instance.tenants.all),
('Tags', instance.tags.all),
)
# Determine user's preferred output format # Determine user's preferred output format
if request.GET.get('format') in ['json', 'yaml']: if request.GET.get('format') in ['json', 'yaml']:
format = request.GET.get('format') format = request.GET.get('format')
@ -287,6 +302,7 @@ class ConfigContextView(generic.ObjectView):
format = 'json' format = 'json'
return { return {
'assigned_objects': assigned_objects,
'format': format, 'format': format,
} }

View File

@ -66,18 +66,7 @@
</div> </div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:circuit_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:circuit_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-6"> <div class="col col-md-6">

View File

@ -52,18 +52,7 @@
<div class="col col-md-6"> <div class="col col-md-6">
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_right_page object %} {% plugin_right_page object %}
</div> </div>
<div class="col col-md-12"> <div class="col col-md-12">

View File

@ -37,20 +37,9 @@
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-6"> <div class="col col-md-6">
<div class="card">
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:providernetwork_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:providernetwork_list' %}
{% include 'inc/comments_panel.html' %}
{% plugin_right_page object %} {% plugin_right_page object %}
</div> </div>
</div> </div>

View File

@ -210,18 +210,7 @@
</div> </div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:device_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:device_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-6"> <div class="col col-md-6">

View File

@ -126,18 +126,7 @@
<div class="col col-md-6"> <div class="col col-md-6">
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:devicetype_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:devicetype_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_right_page object %} {% plugin_right_page object %}
</div> </div>
</div> </div>

View File

@ -182,18 +182,7 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_right_page object %} {% plugin_right_page object %}
</div> </div>
</div> </div>

View File

@ -168,18 +168,7 @@
</div> </div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rack_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rack_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% if power_feeds %} {% if power_feeds %}
<div class="card"> <div class="card">
<h5 class="card-header"> <h5 class="card-header">

View File

@ -167,18 +167,7 @@
</div> </div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:site_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:site_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-5"> <div class="col col-md-5">

View File

@ -50,132 +50,20 @@
</h5> </h5>
<div class="card-body"> <div class="card-body">
<table class="table table-hover attr-table"> <table class="table table-hover attr-table">
{% for title, objects in assigned_objects %}
<tr> <tr>
<th scope="row">Regions</th> <th scope="row">{{ title }}</th>
<td> <td>
{% if object.regions.all %} <ul class="list-unstyled mb-0">
<ul> {% for object in objects %}
{% for region in object.regions.all %} <li><a href="{{ object.get_absolute_url }}">{{ object }}</a></li>
<li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li> {% empty %}
{% endfor %} <li class="text-muted">None</li>
</ul> {% endfor %}
{% else %} </ul>
<span class="text-muted">None</span> </td>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Sites</th>
<td>
{% if object.sites.all %}
<ul>
{% for site in object.sites.all %}
<li><a href="{{ site.get_absolute_url }}">{{ site }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Roles</th>
<td>
{% if object.roles.all %}
<ul>
{% for role in object.roles.all %}
<li><a href="{% url 'dcim:device_list' %}?role={{ role.slug }}">{{ role }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Platforms</th>
<td>
{% if object.platforms.all %}
<ul>
{% for platform in object.platforms.all %}
<li><a href="{{ platform.get_absolute_url }}">{{ platform }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Cluster Groups</th>
<td>
{% if object.cluster_groups.all %}
<ul>
{% for cluster_group in object.cluster_groups.all %}
<li><a href="{{ cluster_group.get_absolute_url }}">{{ cluster_group }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Clusters</th>
<td>
{% if object.clusters.all %}
<ul>
{% for cluster in object.clusters.all %}
<li><a href="{{ cluster.get_absolute_url }}">{{ cluster }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Tenant Groups</th>
<td>
{% if object.tenant_groups.all %}
<ul>
{% for tenant_group in object.tenant_groups.all %}
<li><a href="{{ tenant_group.get_absolute_url }}">{{ tenant_group }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Tenants</th>
<td>
{% if object.tenants.all %}
<ul>
{% for tenant in object.tenants.all %}
<li><a href="{{ tenant.get_absolute_url }}">{{ tenant }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Tags</th>
<td>
{% if object.tags.all %}
<ul>
{% for tag in object.tags.all %}
<li><a href="{{ tag.get_absolute_url }}">{{ tag }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr> </tr>
{% endfor %}
</table> </table>
</div> </div>
</div> </div>

View File

@ -45,14 +45,7 @@
</div> </div>
</div> </div>
<div class="col col-md-8"> <div class="col col-md-8">
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body">
{{ object.comments|render_markdown }}
</div>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,14 @@
{% load helpers %}
<div class="card">
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>

View File

@ -37,18 +37,7 @@
</div> </div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='tenancy:tenant_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='tenancy:tenant_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-5"> <div class="col col-md-5">

View File

@ -56,18 +56,7 @@
</table> </table>
</div> </div>
</div> </div>
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-6"> <div class="col col-md-6">

View File

@ -91,18 +91,7 @@
</div> </div>
{% include 'inc/custom_fields_panel.html' %} {% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:virtualmachine_list' %} {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:virtualmachine_list' %}
<div class="card"> {% include 'inc/comments_panel.html' %}
<h5 class="card-header">
Comments
</h5>
<div class="card-body rendered-markdown">
{% if object.comments %}
{{ object.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
{% plugin_left_page object %} {% plugin_left_page object %}
</div> </div>
<div class="col col-md-6"> <div class="col col-md-6">