#2006: Clean up report views

This commit is contained in:
Jeremy Stretch
2020-08-10 15:56:55 -04:00
parent 365b6f5e17
commit 93da6b6edf
5 changed files with 66 additions and 76 deletions

View File

@@ -3,7 +3,7 @@
{% block title %}{{ report.name }}{% endblock %}
{% block content %}
{% block header %}
<div class="row noprint">
<div class="col-md-12">
<ol class="breadcrumb">
@@ -17,21 +17,29 @@
<div class="pull-right noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %}
{{ run_form }}
<button type="submit" name="_run" class="btn btn-primary"><i class="fa fa-play"></i> Run Report</button>
<button type="submit" name="_run" class="btn btn-primary">
{% if report.result %}
<i class="fa fa-refresh"></i> Run Again
{% else %}
<i class="fa fa-play"></i> Run Report
{% endif %}
</button>
</form>
</div>
{% endif %}
<h1>{{ report.name }}</h1>
{% if report.description %}
<p class="lead">{{ report.description }}</p>
{% endif %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
{% if report.description %}
<p class="lead">{{ report.description }}</p>
{% endif %}
{% if report.result %}
<p>Last run: <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">
Last run: <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">
<strong>{{ report.result.created }}</strong>
</a></p>
</a>
{% endif %}
</div>
</div>

View File

@@ -15,6 +15,7 @@
<th>Status</th>
<th>Description</th>
<th class="text-right">Last Run</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -36,10 +37,26 @@
<span class="text-muted">Never</span>
{% endif %}
</td>
<td>
{% if perms.extras.run_report %}
<div class="pull-right noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %}
<button type="submit" name="_run" class="btn btn-primary btn-xs">
{% if report.result %}
<i class="fa fa-refresh"></i> Run Again
{% else %}
<i class="fa fa-play"></i> Run Report
{% endif %}
</button>
</form>
</div>
{% endif %}
</td>
</tr>
{% for method, stats in report.result.data.items %}
<tr>
<td colspan="3" class="method">
<td colspan="4" class="method">
{{ method }}
</td>
<td class="text-right text-nowrap report-stats">

View File

@@ -1,34 +1,12 @@
{% extends 'base.html' %}
{% extends 'extras/report.html' %}
{% load helpers %}
{% load static %}
{% block title %}{{ report.name }}{% endblock %}
{% block title %}{{ report.name }} - {{ result.get_status_display }}{% endblock %}
{% block content %}
<div class="row noprint">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="{% url 'extras:report_list' %}">Reports</a></li>
<li><a href="{% url 'extras:report_list' %}#module.{{ report.module }}">{{ report.module|bettertitle }}</a></li>
<li>{{ report.name }}</li>
</ol>
</div>
</div>
{% if perms.extras.run_report %}
<div class="pull-right noprint">
<form action="{% url 'extras:report' module=report.module name=report.name %}" method="post">
{% csrf_token %}
{{ run_form }}
<button type="submit" name="_run" class="btn btn-primary"><i class="fa fa-play"></i> Run Report</button>
</form>
</div>
{% endif %}
<h1>{{ report.name }}</h1>
<div class="row">
<div class="col-md-12">
{% if report.description %}
<p class="lead">{{ report.description }}</p>
{% endif %}
<p>
Run: <strong>{{ result.created }}</strong>
{% if result.completed %}