|
3 | 3 |
|
4 | 4 | {% block title %}Reports{% endblock %} |
5 | 5 |
|
6 | | -{% block content %} |
7 | | - <div class="row"> |
8 | | - <div class="col col-md-9"> |
9 | | - {% if reports %} |
10 | | - {% for module, module_reports in reports %} |
11 | | - <div class="card"> |
12 | | - <h5 class="card-header"><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h5> |
13 | | - <div class="card-body"> |
14 | | - <table class="table table-hover table-headings reports"> |
15 | | - <thead> |
16 | | - <tr> |
17 | | - <th>Name</th> |
18 | | - <th>Status</th> |
19 | | - <th>Description</th> |
20 | | - <th class="text-end">Last Run</th> |
21 | | - <th></th> |
22 | | - </tr> |
23 | | - </thead> |
24 | | - <tbody> |
25 | | - {% for report in module_reports %} |
26 | | - <tr> |
27 | | - <td> |
28 | | - <a href="{% url 'extras:report' module=report.module name=report.class_name %}" id="{{ report.module }}.{{ report.class_name }}">{{ report.name }}</a> |
29 | | - </td> |
30 | | - <td> |
31 | | - {% include 'extras/inc/job_label.html' with result=report.result %} |
32 | | - </td> |
33 | | - <td>{{ report.description|render_markdown|placeholder }}</td> |
34 | | - <td class="text-end"> |
35 | | - {% if report.result %} |
36 | | - <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">{{ report.result.created|annotated_date }}</a> |
37 | | - {% else %} |
38 | | - <span class="text-muted">Never</span> |
39 | | - {% endif %} |
40 | | - </td> |
41 | | - <td> |
42 | | - {% if perms.extras.run_report %} |
43 | | - <div class="float-end noprint"> |
44 | | - <form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post"> |
45 | | - {% csrf_token %} |
46 | | - <button type="submit" name="_run" class="btn btn-primary btn-sm"> |
47 | | - {% if report.result %} |
48 | | - <i class="mdi mdi-replay"></i> Run Again |
49 | | - {% else %} |
50 | | - <i class="mdi mdi-play"></i> Run Report |
51 | | - {% endif %} |
52 | | - </button> |
53 | | - </form> |
54 | | - </div> |
55 | | - {% endif %} |
56 | | - </td> |
57 | | - </tr> |
58 | | - {% for method, stats in report.result.data.items %} |
59 | | - <tr> |
60 | | - <td colspan="4" class="method"> |
61 | | - {{ method }} |
62 | | - </td> |
63 | | - <td class="text-end text-nowrap report-stats"> |
64 | | - <span class="badge bg-success">{{ stats.success }}</span> |
65 | | - <span class="badge bg-info">{{ stats.info }}</span> |
66 | | - <span class="badge bg-warning">{{ stats.warning }}</span> |
67 | | - <span class="badge bg-danger">{{ stats.failure }}</span> |
68 | | - </td> |
69 | | - </tr> |
70 | | - {% endfor %} |
71 | | - {% endfor %} |
72 | | - </tbody> |
73 | | - </table> |
| 6 | +{% block tabs %} |
| 7 | + <ul class="nav nav-tabs px-3"> |
| 8 | + <li class="nav-item" role="presentation"> |
| 9 | + <a class="nav-link active" role="tab">Reports</a> |
| 10 | + </li> |
| 11 | + </ul> |
| 12 | +{% endblock tabs %} |
| 13 | + |
| 14 | +{% block content-wrapper %} |
| 15 | + <div class="tab-content"> |
| 16 | + {% if reports %} |
| 17 | + {% for module, module_reports in reports %} |
| 18 | + <div class="card"> |
| 19 | + <h5 class="card-header"> |
| 20 | + <a name="module.{{ module }}"></a> |
| 21 | + <i class="mdi mdi-file-document-outline"></i> {{ module|bettertitle }} |
| 22 | + </h5> |
| 23 | + <div class="card-body"> |
| 24 | + <table class="table table-hover table-headings reports"> |
| 25 | + <thead> |
| 26 | + <tr> |
| 27 | + <th width="250">Name</th> |
| 28 | + <th width="110">Status</th> |
| 29 | + <th>Description</th> |
| 30 | + <th width="150" class="text-end">Last Run</th> |
| 31 | + <th width="120"></th> |
| 32 | + </tr> |
| 33 | + </thead> |
| 34 | + <tbody> |
| 35 | + {% for report in module_reports %} |
| 36 | + <tr> |
| 37 | + <td> |
| 38 | + <a href="{% url 'extras:report' module=report.module name=report.class_name %}" id="{{ report.module }}.{{ report.class_name }}">{{ report.name }}</a> |
| 39 | + </td> |
| 40 | + <td> |
| 41 | + {% include 'extras/inc/job_label.html' with result=report.result %} |
| 42 | + </td> |
| 43 | + <td>{{ report.description|render_markdown|placeholder }}</td> |
| 44 | + <td class="text-end"> |
| 45 | + {% if report.result %} |
| 46 | + <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">{{ report.result.created|annotated_date }}</a> |
| 47 | + {% else %} |
| 48 | + <span class="text-muted">Never</span> |
| 49 | + {% endif %} |
| 50 | + </td> |
| 51 | + <td> |
| 52 | + {% if perms.extras.run_report %} |
| 53 | + <div class="float-end noprint"> |
| 54 | + <form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post"> |
| 55 | + {% csrf_token %} |
| 56 | + <button type="submit" name="_run" class="btn btn-primary btn-sm" style="width: 110px"> |
| 57 | + {% if report.result %} |
| 58 | + <i class="mdi mdi-replay"></i> Run Again |
| 59 | + {% else %} |
| 60 | + <i class="mdi mdi-play"></i> Run Report |
| 61 | + {% endif %} |
| 62 | + </button> |
| 63 | + </form> |
74 | 64 | </div> |
75 | | - </div> |
| 65 | + {% endif %} |
| 66 | + </td> |
| 67 | + </tr> |
| 68 | + {% for method, stats in report.result.data.items %} |
| 69 | + <tr> |
| 70 | + <td colspan="4" class="method"> |
| 71 | + <span class="ps-3">{{ method }}</span> |
| 72 | + </td> |
| 73 | + <td class="text-end text-nowrap report-stats"> |
| 74 | + <span class="badge bg-success">{{ stats.success }}</span> |
| 75 | + <span class="badge bg-info">{{ stats.info }}</span> |
| 76 | + <span class="badge bg-warning">{{ stats.warning }}</span> |
| 77 | + <span class="badge bg-danger">{{ stats.failure }}</span> |
| 78 | + </td> |
| 79 | + </tr> |
| 80 | + {% endfor %} |
76 | 81 | {% endfor %} |
77 | | - {% else %} |
78 | | - <div class="alert alert-info" role="alert"> |
79 | | - <h4 class="alert-heading">No Reports Found</h4> |
80 | | - Reports should be saved to <code>{{ settings.REPORTS_ROOT }}</code>. |
81 | | - <hr/> |
82 | | - <small>This path can be changed by setting <code>REPORTS_ROOT</code> in NetBox's configuration.</small> |
83 | | - </div> |
84 | | - {% endif %} |
85 | | - </div> |
86 | | - <div class="col col-md-3"> |
87 | | - {% if reports %} |
88 | | - <div class="card"> |
89 | | - <div class="card-body"> |
90 | | - {% for module, module_reports in reports %} |
91 | | - <h5>{{ module|bettertitle }}</h5> |
92 | | - <div class="small mb-2"> |
93 | | - <ul class="list-group list-group-flush"> |
94 | | - {% for report in module_reports %} |
95 | | - <a href="#{{ report.module }}.{{ report.class_name }}" class="list-group-item"> |
96 | | - <i class="mdi mdi-file-chart-outline"></i> {{ report.name }} |
97 | | - <div class="float-end"> |
98 | | - {% include 'extras/inc/job_label.html' with result=report.result %} |
99 | | - </div> |
100 | | - </a> |
101 | | - {% endfor %} |
102 | | - </ul> |
103 | | - </div> |
104 | | - {% endfor %} |
105 | | - </div> |
106 | | - </div> |
107 | | - {% endif %} |
| 82 | + </tbody> |
| 83 | + </table> |
| 84 | + </div> |
108 | 85 | </div> |
109 | | - </div> |
110 | | -{% endblock %} |
| 86 | + {% endfor %} |
| 87 | + {% else %} |
| 88 | + <div class="alert alert-info" role="alert"> |
| 89 | + <h4 class="alert-heading">No Reports Found</h4> |
| 90 | + Reports should be saved to <code>{{ settings.REPORTS_ROOT }}</code>. |
| 91 | + <hr/> |
| 92 | + <small>This path can be changed by setting <code>REPORTS_ROOT</code> in NetBox's configuration.</small> |
| 93 | + </div> |
| 94 | + {% endif %} |
| 95 | + </div> |
| 96 | +{% endblock content-wrapper %} |
0 commit comments