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

Fixed improperly rendered panels in device, location, and tenant views #808

Merged
merged 2 commits into from
Sep 11, 2024
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
1 change: 1 addition & 0 deletions changes/743.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed improperly rendered panels in device and location views.
Original file line number Diff line number Diff line change
Expand Up @@ -6,119 +6,113 @@
<strong>Config Compliance Validation</strong>
</a>
</div>
<div class="panel panel-default">
<table class="table table-hover panel-body report">
<thead>
<tr class="table-headings">
<th>Feature</th>
<th>Compliance</th>
</tr>
</thead>
<tbody>
{% for item in compliance %}
<tr>
<td>{{ item.rule__feature__name }}</td>
<td>
{% if item.compliance == False %}
<span class="label label-danger">Non-Compliant</span>
{% elif item.compliance == True %}
<span class="label label-success">Compliant</span>
{% else %}
<span class="label label-info">N/A</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% elif template_type == 'location' %}
<div class="panel panel-default">
<table class="table table-hover panel-body report">
<thead>
<tr class="table-headings">
<th>Feature</th>
<th>Non-compliant</th>
<th>Compliant</th>
</tr>
</thead>
<tbody>
{% for item in compliance %}
<tr>
<td>{{ item.rule__feature__name }}</td>
<td><span class="label label-danger">{{ item.non_compliant }}</span></td>
<td><span class="label label-success">{{ item.compliant }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endif %}
{# The panel will not show up, since it is returned early in template_content.py based on an actual GoldenConfig object existing #}
{% if template_type == "device-configs" %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Configuration Types</strong>
</div>
<div class="panel panel-default">
<table class="table table-hover panel-body report">
<table class="table table-hover panel-body">
<thead>
<tr class="table-headings">
<th>Type</th>
<th>Config</th>
<th>Feature</th>
<th>Compliance</th>
</tr>
</thead>
<tbody>
{% if config_features.compliance and golden_config.compliance_config %}
<tr>
<td>Compliance</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_compliance' pk=device.pk %}">
<i class="mdi mdi-file-compare"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.intended and golden_config.intended_config %}
<tr>
<td>Intended</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_intended' pk=device.pk %}">
<i class="mdi mdi-text-box-check-outline"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.postprocessing and golden_config.intended_config %}
<tr>
<td>Configuration Postprocessing</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_postprocessing' pk=device.pk %}">
<i class="mdi mdi-text-box-check"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.backup and golden_config.backup_config %}
{% for item in compliance %}
<tr>
<td>Actual</td>
<td>{{ item.rule__feature__name }}</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_backup' pk=device.pk %}">
<i class="mdi mdi-file-document-outline"></i>
</a>
{% if item.compliance == False %}
<span class="label label-danger">Non-Compliant</span>
{% elif item.compliance == True %}
<span class="label label-success">Compliant</span>
{% else %}
<span class="label label-info">N/A</span>
{% endif %}
</td>
</tr>
{% endif %} {% if config_features.sotagg %}
{% endfor %}
</tbody>
</table>
{% elif template_type == 'location' %}
<table class="table table-hover panel-body">
<thead>
<tr class="table-headings">
<th>Feature</th>
<th>Non-compliant</th>
<th>Compliant</th>
</tr>
</thead>
<tbody>
{% for item in compliance %}
<tr>
<td>SoT Aggregation Data</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_sotagg' pk=device.pk %}">
<i class="mdi mdi-code-json"></i>
</a>
</td>
<td>{{ item.rule__feature__name }}</td>
<td><span class="label label-danger">{{ item.non_compliant }}</span></td>
<td><span class="label label-success">{{ item.compliant }}</span></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endif %}
{# The panel will not show up, since it is returned early in template_content.py based on an actual GoldenConfig object existing #}
{% if template_type == "device-configs" %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Configuration Types</strong>
</div>
<table class="table table-hover panel-body">
<thead>
<tr class="table-headings">
<th>Type</th>
<th>Config</th>
</tr>
</thead>
<tbody>
{% if config_features.compliance and golden_config.compliance_config %}
<tr>
<td>Compliance</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_compliance' pk=device.pk %}">
<i class="mdi mdi-file-compare"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.intended and golden_config.intended_config %}
<tr>
<td>Intended</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_intended' pk=device.pk %}">
<i class="mdi mdi-text-box-check-outline"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.postprocessing and golden_config.intended_config %}
<tr>
<td>Configuration Postprocessing</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_postprocessing' pk=device.pk %}">
<i class="mdi mdi-text-box-check"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.backup and golden_config.backup_config %}
<tr>
<td>Actual</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_backup' pk=device.pk %}">
<i class="mdi mdi-file-document-outline"></i>
</a>
</td>
</tr>
{% endif %} {% if config_features.sotagg %}
<tr>
<td>SoT Aggregation Data</td>
<td>
<a href="{% url 'plugins:nautobot_golden_config:goldenconfig_sotagg' pk=device.pk %}">
<i class="mdi mdi-code-json"></i>
</a>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{% endif %}
{% endif %}