Merge pull request #391 from eReuse/feature/3959-dhid-in-erasure

add dhid as column in erasure section
This commit is contained in:
cayop 2022-10-26 12:08:07 +02:00 committed by GitHub
commit eb1649f506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View file

@ -939,6 +939,7 @@ class ExportsView(View):
cw.writerow( cw.writerow(
[ [
'Data Storage Serial', 'Data Storage Serial',
'DHID',
'Snapshot ID', 'Snapshot ID',
'Type of Erasure', 'Type of Erasure',
'PHID Erasure Host', 'PHID Erasure Host',
@ -958,6 +959,7 @@ class ExportsView(View):
for ac in query: for ac in query:
row = [ row = [
ac.device.serial_number.upper(), ac.device.serial_number.upper(),
ac.device.dhid,
ac.snapshot.uuid, ac.snapshot.uuid,
ac.type, ac.type,
ac.get_phid(), ac.get_phid(),

View file

@ -16,7 +16,7 @@ from ereuse_devicehub.db import db
from ereuse_devicehub.inventory.models import Transfer from ereuse_devicehub.inventory.models import Transfer
from ereuse_devicehub.query import things_response from ereuse_devicehub.query import things_response
from ereuse_devicehub.resources.action.models import Confirm, Revoke, Trade from ereuse_devicehub.resources.action.models import Confirm, Revoke, Trade
from ereuse_devicehub.resources.device.models import Computer, Device from ereuse_devicehub.resources.device.models import Computer, DataStorage, Device
from ereuse_devicehub.resources.lot.models import Lot, Path from ereuse_devicehub.resources.lot.models import Lot, Path
@ -302,6 +302,13 @@ class LotDeviceView(LotBaseChildrenView):
devices = set( devices = set(
Device.query.filter(Device.id.in_(ids)).filter(Device.owner == g.user) Device.query.filter(Device.id.in_(ids)).filter(Device.owner == g.user)
) )
devices = set()
dev_qry = Device.query.filter(Device.id.in_(ids)).filter(Device.owner == g.user)
for dev in dev_qry:
if isinstance(dev, DataStorage) and dev.parent:
continue
devices.add(dev)
lot.devices.update(devices) lot.devices.update(devices)

View file

@ -49,6 +49,7 @@
<tr> <tr>
<th scope="col">Select</th> <th scope="col">Select</th>
<th scope="col">Data Storage Serial</th> <th scope="col">Data Storage Serial</th>
<th scope="col">DHID</th>
<th scope="col">Snapshot ID</th> <th scope="col">Snapshot ID</th>
<th scope="col">Type of Erasure</th> <th scope="col">Type of Erasure</th>
<th scope="col">PHID Erasure Host</th> <th scope="col">PHID Erasure Host</th>
@ -78,6 +79,15 @@
{% else %} {% else %}
{{ ac.device.serial_number.upper() }} {{ ac.device.serial_number.upper() }}
{% endif %} {% endif %}
</td>
<td>
{% if ac.device.phid() %}
<a href="{{ url_for('inventory.device_details', id=ac.device.dhid)}}">
{{ ac.device.dhid }}
</a>
{% else %}
{{ ac.device.dhid }}
{% endif %}
</td> </td>
<td> <td>
<a href="{{ url_for('inventory.export', export_id='snapshot') }}?id={{ ac.snapshot.uuid }}"> <a href="{{ url_for('inventory.export', export_id='snapshot') }}?id={{ ac.snapshot.uuid }}">