Clean up script & report lists

This commit is contained in:
jeremystretch 2021-11-12 14:44:14 -05:00
parent bb99c3e6f9
commit 1fed564c47
2 changed files with 149 additions and 171 deletions

View File

@ -3,22 +3,32 @@
{% block title %}Reports{% endblock %} {% block title %}Reports{% endblock %}
{% block content %} {% block tabs %}
<div class="row"> <ul class="nav nav-tabs px-3">
<div class="col col-md-9"> <li class="nav-item" role="presentation">
<a class="nav-link active" role="tab">Reports</a>
</li>
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
{% if reports %} {% if reports %}
{% for module, module_reports in reports %} {% for module, module_reports in reports %}
<div class="card"> <div class="card">
<h5 class="card-header"><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h5> <h5 class="card-header">
<a name="module.{{ module }}"></a>
<i class="mdi mdi-file-document-outline"></i> {{ module|bettertitle }}
</h5>
<div class="card-body"> <div class="card-body">
<table class="table table-hover table-headings reports"> <table class="table table-hover table-headings reports">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th width="250">Name</th>
<th>Status</th> <th width="110">Status</th>
<th>Description</th> <th>Description</th>
<th class="text-end">Last Run</th> <th width="150" class="text-end">Last Run</th>
<th></th> <th width="120"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -43,7 +53,7 @@
<div class="float-end noprint"> <div class="float-end noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post"> <form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %} {% csrf_token %}
<button type="submit" name="_run" class="btn btn-primary btn-sm"> <button type="submit" name="_run" class="btn btn-primary btn-sm" style="width: 110px">
{% if report.result %} {% if report.result %}
<i class="mdi mdi-replay"></i> Run Again <i class="mdi mdi-replay"></i> Run Again
{% else %} {% else %}
@ -58,7 +68,7 @@
{% for method, stats in report.result.data.items %} {% for method, stats in report.result.data.items %}
<tr> <tr>
<td colspan="4" class="method"> <td colspan="4" class="method">
{{ method }} <span class="ps-3">{{ method }}</span>
</td> </td>
<td class="text-end text-nowrap report-stats"> <td class="text-end text-nowrap report-stats">
<span class="badge bg-success">{{ stats.success }}</span> <span class="badge bg-success">{{ stats.success }}</span>
@ -83,28 +93,4 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="col col-md-3"> {% endblock content-wrapper %}
{% if reports %}
<div class="card">
<div class="card-body">
{% for module, module_reports in reports %}
<h5>{{ module|bettertitle }}</h5>
<div class="small mb-2">
<ul class="list-group list-group-flush">
{% for report in module_reports %}
<a href="#{{ report.module }}.{{ report.class_name }}" class="list-group-item">
<i class="mdi mdi-file-chart-outline"></i> {{ report.name }}
<div class="float-end">
{% include 'extras/inc/job_label.html' with result=report.result %}
</div>
</a>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -3,17 +3,29 @@
{% block title %}Scripts{% endblock %} {% block title %}Scripts{% endblock %}
{% block content %} {% block tabs %}
<div class="row"> <ul class="nav nav-tabs px-3">
<div class="col col-md-9"> <li class="nav-item" role="presentation">
<a class="nav-link active" role="tab">Scripts</a>
</li>
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
{% if scripts %} {% if scripts %}
{% for module, module_scripts in scripts.items %} {% for module, module_scripts in scripts.items %}
<h3><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h3> <div class="card">
<h5 class="card-header">
<a name="module.{{ module }}"></a>
<i class="mdi mdi-file-document-outline"></i> {{ module|bettertitle }}
</h5>
<div class="card-body">
<table class="table table-hover table-headings reports"> <table class="table table-hover table-headings reports">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th width="250">Name</th>
<th>Status</th> <th width="110">Status</th>
<th>Description</th> <th>Description</th>
<th class="text-end">Last Run</th> <th class="text-end">Last Run</th>
</tr> </tr>
@ -27,7 +39,9 @@
<td> <td>
{% include 'extras/inc/job_label.html' with result=script.result %} {% include 'extras/inc/job_label.html' with result=script.result %}
</td> </td>
<td>{{ script.Meta.description|render_markdown }}</td> <td>
{{ script.Meta.description|render_markdown|placeholder }}
</td>
{% if script.result %} {% if script.result %}
<td class="text-end"> <td class="text-end">
<a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created|annotated_date }}</a> <a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created|annotated_date }}</a>
@ -39,6 +53,8 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="alert alert-info"> <div class="alert alert-info">
@ -49,28 +65,4 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="col col-md-3"> {% endblock content-wrapper %}
{% if scripts %}
<div class="card">
<div class="card-body">
{% for module, module_scripts in scripts.items %}
<h5>{{ module|bettertitle }}</h5>
<div class="small mb-2">
<ul class="list-group list-group-flush">
{% for class_name, script in module_scripts.items %}
<a href="#script.{{ class_name }}" class="list-group-item">
<i class="mdi mdi-file-chart-outline"></i> {{ script.name }}
<div class="float-end">
{% include 'extras/inc/job_label.html' with result=script.result %}
</div>
</a>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}