view list for snapshot errors

This commit is contained in:
Cayo Puigdefabregas 2022-04-13 18:31:39 +02:00
parent 82bdfe3db5
commit a0a52d8248
2 changed files with 93 additions and 0 deletions

View File

@ -547,6 +547,25 @@ class ExportsView(View):
return flask.render_template('inventory/erasure.html', **params)
class SnapshotListView(GenericMixView):
decorators = [login_required]
template_name = 'inventory/snapshot_list.html'
def dispatch_request(self):
self.get_context()
return flask.render_template(self.template_name, **self.context)
def get_context(self):
lots = self.get_lots()
self.context = {
'lots': lots,
'version': __version__,
}
return self.context
devices.add_url_rule('/action/add/', view_func=NewActionView.as_view('action_add'))
devices.add_url_rule('/action/trade/add/', view_func=NewTradeView.as_view('trade_add'))
devices.add_url_rule(
@ -560,6 +579,7 @@ devices.add_url_rule(
view_func=NewTradeDocumentView.as_view('trade_document_add'),
)
devices.add_url_rule('/device/', view_func=DeviceListView.as_view('devicelist'))
devices.add_url_rule('/snapshot/', view_func=SnapshotListView.as_view('snapshotlist'))
devices.add_url_rule(
'/device/<string:id>/', view_func=DeviceDetailView.as_view('device_details')
)

View File

@ -0,0 +1,73 @@
{% extends "ereuse_devicehub/base_site.html" %}
{% block main %}
<div class="pagetitle">
<h1>Inventory</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ url_for('inventory.devicelist')}}">Inventory</a></li>
<li class="breadcrumb-item active">Snapshots</li>
</ol>
</nav>
</div><!-- End Page Title -->
<section class="section profile">
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body pt-3" style="min-height: 650px;">
<!-- Bordered Tabs -->
<div class="tab-content pt-5">
<div id="devices-list" class="tab-pane fade devices-list active show">
<div class="tab-content pt-2">
<table class="table">
<thead>
<tr>
<th scope="col">WBID</th>
<th scope="col">Snapshot id</th>
<th scope="col">Device</th>
<th scope="col">Errors</th>
<th scope="col" data-type="date" data-format="DD-MM-YYYY">Time</th>
</tr>
</thead>
<tbody>
{% for snap in snapshots_errors %}
<tr>
<td>
{{ snap.wbid }}
</td>
<td>
{{ snap.snapshot_uuid }}
</td>
<td>
</td>
<td>
{{ snap.description }}
</td>
<td>{{ dev.created.strftime('%H:%M %d-%m-%Y') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div><!-- End Bordered Tabs -->
</div>
</div>
</div>
<div id="NotificationsContainer" style="position: absolute; bottom: 0; right: 0; margin: 10px; margin-top: 70px; width: calc(100% - 310px);"></div>
</div>
</div>
</section>
<!-- Custom Code -->
<script>
const table = new simpleDatatables.DataTable("table")
</script>
{% endblock main %}