fix link to device and show correctly date
This commit is contained in:
commit
0f512d4bb3
|
@ -25,7 +25,7 @@ from ereuse_devicehub.inventory.forms import (
|
||||||
)
|
)
|
||||||
from ereuse_devicehub.labels.forms import PrintLabelsForm
|
from ereuse_devicehub.labels.forms import PrintLabelsForm
|
||||||
from ereuse_devicehub.parser.models import SnapshotErrors
|
from ereuse_devicehub.parser.models import SnapshotErrors
|
||||||
from ereuse_devicehub.resources.action.models import Trade
|
from ereuse_devicehub.resources.action.models import Snapshot, Trade
|
||||||
from ereuse_devicehub.resources.device.models import Computer, DataStorage, Device
|
from ereuse_devicehub.resources.device.models import Computer, DataStorage, Device
|
||||||
from ereuse_devicehub.resources.documents.device_row import ActionRow, DeviceRow
|
from ereuse_devicehub.resources.documents.device_row import ActionRow, DeviceRow
|
||||||
from ereuse_devicehub.resources.hash_reports import insert_hash
|
from ereuse_devicehub.resources.hash_reports import insert_hash
|
||||||
|
@ -507,27 +507,34 @@ class ExportsView(View):
|
||||||
return flask.render_template('inventory/erasure.html', **params)
|
return flask.render_template('inventory/erasure.html', **params)
|
||||||
|
|
||||||
|
|
||||||
class SnapshotListView(GenericMixView):
|
class SnapshotErrorsListView(GenericMixView):
|
||||||
|
methods = ['GET']
|
||||||
decorators = [login_required]
|
decorators = [login_required]
|
||||||
template_name = 'inventory/snapshot_list.html'
|
template_name = 'inventory/snapshot_errors_list.html'
|
||||||
|
|
||||||
def dispatch_request(self):
|
def dispatch_request(self):
|
||||||
self.get_context()
|
self.get_context()
|
||||||
return flask.render_template(self.template_name, **self.context)
|
self.context['page_title'] = "Snapshot Errors"
|
||||||
|
|
||||||
def get_context(self):
|
|
||||||
lots = self.get_lots()
|
|
||||||
snapshot_errors = SnapshotErrors.query.filter(
|
snapshot_errors = SnapshotErrors.query.filter(
|
||||||
SnapshotErrors.owner == current_user
|
SnapshotErrors.owner == current_user
|
||||||
).order_by(SnapshotErrors.created.desc())
|
).order_by(SnapshotErrors.created.desc())
|
||||||
|
self.context['snapshot_errors'] = snapshot_errors
|
||||||
|
|
||||||
self.context = {
|
return flask.render_template(self.template_name, **self.context)
|
||||||
'snapshot_errors': snapshot_errors,
|
|
||||||
'lots': lots,
|
|
||||||
'version': __version__,
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.context
|
|
||||||
|
class SnapshotListView(GenericMixView):
|
||||||
|
decorators = [login_required]
|
||||||
|
template_name = 'inventory/snapshots_list.html'
|
||||||
|
|
||||||
|
def dispatch_request(self):
|
||||||
|
self.get_context()
|
||||||
|
snapshots = Snapshot.query.filter(Snapshot.author == current_user).order_by(
|
||||||
|
Snapshot.created.desc()
|
||||||
|
)
|
||||||
|
self.context['page_title'] = "Snapshots"
|
||||||
|
self.context['snapshots'] = 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/add/', view_func=NewActionView.as_view('action_add'))
|
||||||
|
@ -544,7 +551,8 @@ devices.add_url_rule(
|
||||||
)
|
)
|
||||||
devices.add_url_rule('/device/', view_func=DeviceListView.as_view('devicelist'))
|
devices.add_url_rule('/device/', view_func=DeviceListView.as_view('devicelist'))
|
||||||
devices.add_url_rule(
|
devices.add_url_rule(
|
||||||
'/snapshot/errors/', view_func=SnapshotListView.as_view('snapshot_errors_list')
|
'/snapshot/errors/',
|
||||||
|
view_func=SnapshotErrorsListView.as_view('snapshot_errors_list'),
|
||||||
)
|
)
|
||||||
devices.add_url_rule(
|
devices.add_url_rule(
|
||||||
'/device/<string:id>/', view_func=DeviceDetailView.as_view('device_details')
|
'/device/<string:id>/', view_func=DeviceDetailView.as_view('device_details')
|
||||||
|
@ -579,3 +587,4 @@ devices.add_url_rule(
|
||||||
devices.add_url_rule(
|
devices.add_url_rule(
|
||||||
'/export/<string:export_id>/', view_func=ExportsView.as_view('export')
|
'/export/<string:export_id>/', view_func=ExportsView.as_view('export')
|
||||||
)
|
)
|
||||||
|
devices.add_url_rule('/snapshots/', view_func=SnapshotListView.as_view('snapshotslist'))
|
||||||
|
|
|
@ -101,6 +101,13 @@
|
||||||
</a>
|
</a>
|
||||||
</li><!-- End Dashboard Nav -->
|
</li><!-- End Dashboard Nav -->
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link collapsed" href="{{ url_for('inventory.snapshotslist') }}">
|
||||||
|
<i class="bi-menu-button-wide"></i>
|
||||||
|
<span>Uploaded Snapshots</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link collapsed" href="{{ url_for('inventory.devicelist') }}">
|
<a class="nav-link collapsed" href="{{ url_for('inventory.devicelist') }}">
|
||||||
<i class="bi-menu-button-wide"></i>
|
<i class="bi-menu-button-wide"></i>
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
{% 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 or ''}}</td>
|
||||||
|
<td>{{ snap.version }}</td>
|
||||||
|
<td>{{ snap.status }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url_for('inventory.device_details', id=snap.device.devicehub_id)}}">
|
||||||
|
{{ snap.device.devicehub_id }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{ snap.created.strftime('%H:%M %d-%m-%Y') }}</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 %}
|
Reference in New Issue