Skip to content

Commit

Permalink
Fixed improperly rendered panels in device, location, and tenant views (
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnider2195 authored Sep 11, 2024
1 parent 00d018d commit 41f653c
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 101 deletions.
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 %}

0 comments on commit 41f653c

Please sign in to comment.