basic list snapshots

This commit is contained in:
Cayo Puigdefabregas 2022-05-11 16:59:36 +02:00
parent cbf8d68461
commit 5e74255145
2 changed files with 76 additions and 0 deletions

View file

@ -505,6 +505,18 @@ class ExportsView(View):
return flask.render_template('inventory/erasure.html', **params)
class SnapshotListView(GenericMixView):
methods = ['GET']
decorators = [login_required]
template_name = 'inventory/snapshots_list.html'
def dispatch_request(self, id):
self.get_context()
self.context['page_title'] = "Snapshots"
self.context['snapshots'] = []
return flask.render_template(self.template_name, **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(
@ -551,3 +563,4 @@ devices.add_url_rule(
devices.add_url_rule(
'/export/<string:export_id>/', view_func=ExportsView.as_view('export')
)
devices.add_url_rule('/snapshots/', view_func=SnapshotListView.as_view('snapshotslist'))

View file

@ -0,0 +1,63 @@
{% extends "ereuse_devicehub/base_site.html" %}
{% block main %}
<div class="pagetitle">
<h1>Inventory</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item active">{{ page_title }}</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">
<!-- Bordered Tabs -->
<div class="tab-content pt-2">
<div class="tab-pane fade show active profile-overview" id="profile-overview">
<h5 class="card-title">Snapshot</h5>
<table class="table">
<thead>
<tr>
<th scope="col">Sid</th>
<th scope="col">Workbench Version</th>
<th scope="col">Errors</th>
<th scope="col">DHID</th>
<th scope="col">Uploaded</th>
</tr>
</thead>
<tbody>
{% for snap in snapshots %}
<tr>
<td>{{ snap.sid }}</td>
<td>{{ snap.version }}</td>
<td>{{ snap.status }}</td>
<td>{{ snap.device.devicehub_id }}</td>
<td>{{ snap.created }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div><!-- End Bordered Tabs -->
</div>
</div>
</div>
</div>
</section>
<!-- Custom Code -->
<script>
const table = new simpleDatatables.DataTable("table")
</script>
{% endblock main %}