Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pending UI work for v3.0 beta #6779

Merged
merged 2 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions netbox/extras/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ class ConfigContextView(generic.ObjectView):
queryset = ConfigContext.objects.all()

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
if request.GET.get('format') in ['json', 'yaml']:
format = request.GET.get('format')
Expand All @@ -287,6 +302,7 @@ def get_extra_context(self, request, instance):
format = 'json'

return {
'assigned_objects': assigned_objects,
'format': format,
}

Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/circuits/circuit.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,7 @@ <h5 class="card-header">
</div>
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:circuit_list' %}
<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/comments_panel.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-6">
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/circuits/provider.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,7 @@ <h5 class="card-header">
<div class="col col-md-6">
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %}
<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/comments_panel.html' %}
{% plugin_right_page object %}
</div>
<div class="col col-md-12">
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/circuits/providernetwork.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,9 @@ <h5 class="card-header">
{% plugin_left_page object %}
</div>
<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 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:providernetwork_list' %}
{% include 'inc/comments_panel.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/dcim/device.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,7 @@ <h5 class="card-header">
</div>
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:device_list' %}
<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/comments_panel.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-6">
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/dcim/devicetype.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,7 @@ <h5 class="card-header">
<div class="col col-md-6">
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:devicetype_list' %}
<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/comments_panel.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/dcim/powerfeed.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,7 @@ <h5 class="card-header">
</div>
{% endif %}
</div>
<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/comments_panel.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/dcim/rack.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,7 @@ <h5 class="card-header">
</div>
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:rack_list' %}
<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/comments_panel.html' %}
{% if power_feeds %}
<div class="card">
<h5 class="card-header">
Expand Down
13 changes: 1 addition & 12 deletions netbox/templates/dcim/site.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,7 @@ <h5 class="card-header">
</div>
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:site_list' %}
<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/comments_panel.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-5">
Expand Down
136 changes: 12 additions & 124 deletions netbox/templates/extras/configcontext.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,132 +50,20 @@ <h5 class="card-header">
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
{% for title, objects in assigned_objects %}
<tr>
<th scope="row">Regions</th>
<td>
{% if object.regions.all %}
<ul>
{% for region in object.regions.all %}
<li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% 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>
<th scope="row">{{ title }}</th>
<td>
<ul class="list-unstyled mb-0">
{% for object in objects %}
<li><a href="{{ object.get_absolute_url }}">{{ object }}</a></li>
{% empty %}
<li class="text-muted">None</li>
{% endfor %}
</ul>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
Expand Down
9 changes: 1 addition & 8 deletions netbox/templates/extras/journalentry.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ <h5 class="card-header">
</div>
</div>
<div class="col col-md-8">
<div class="card">
<h5 class="card-header">
Comments
</h5>
<div class="card-body">
{{ object.comments|render_markdown }}
</div>
</div>
{% include 'inc/comments_panel.html' %}
</div>
</div>
{% endblock %}
14 changes: 14 additions & 0 deletions netbox/templates/inc/comments_panel.html
Original file line number Diff line number Diff line change
@@ -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>
13 changes: 1 addition & 12 deletions netbox/templates/tenancy/tenant.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,7 @@ <h5 class="card-header">
</div>
{% include 'inc/custom_fields_panel.html' %}
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='tenancy:tenant_list' %}
<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/comments_panel.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-5">
Expand Down
Loading