From 085c5151bc688f774139b9c9d42a7b9f56ba4921 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 30 May 2023 09:45:19 +0200 Subject: [PATCH 1/3] fix --- ereuse_devicehub/templates/inventory/erasure.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ereuse_devicehub/templates/inventory/erasure.html b/ereuse_devicehub/templates/inventory/erasure.html index 854d9a19..eca60f4a 100644 --- a/ereuse_devicehub/templates/inventory/erasure.html +++ b/ereuse_devicehub/templates/inventory/erasure.html @@ -348,7 +348,7 @@
{% if loop.index == 1 %}
-

Tenchnical Details

+

Technical Details

{% endif %}

{{ (erasure.device.serial_number or '').upper() }}

From a95d643755b66d41af0b5532b1cbfb0ad42c1646 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 30 May 2023 11:49:42 +0200 Subject: [PATCH 2/3] fix eraseDataWipe in csv --- ereuse_devicehub/resources/documents/device_row.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/documents/device_row.py b/ereuse_devicehub/resources/documents/device_row.py index ba165e0b..aac1f56a 100644 --- a/ereuse_devicehub/resources/documents/device_row.py +++ b/ereuse_devicehub/resources/documents/device_row.py @@ -429,11 +429,14 @@ class DeviceRow(BaseDeviceRow): self['{} {} Size (MB)'.format(ctype, i)] = none2str(component.size) - component_actions = sorted(component.actions, key=lambda x: x.created) + component_actions = [ac for ac in component.actions] + if component.binding: + component_actions.extend(component.binding.device.actions) + component_actions = sorted(component_actions, key=lambda x: x.created) erasures = [ a for a in component_actions - if a.type in ['EraseBasic', 'EraseSectors', 'DataWipe'] + if a.type in ['EraseBasic', 'EraseSectors', 'DataWipe', 'EraseDataWipe'] ] erasure = erasures[-1] if erasures else None if not erasure: @@ -441,7 +444,7 @@ class DeviceRow(BaseDeviceRow): serial_number = none2str(component.serial_number) self['Erasure {} {} Serial Number'.format(ctype, i)] = serial_number self['Erasure {} {} Size (MB)'.format(ctype, i)] = none2str(component.size) - elif hasattr(erasure, 'type') and erasure.type == 'DataWipe': + elif hasattr(erasure, 'type') and erasure.type in ['DataWipe', 'EraseDataWipe']: self['Erasure {} {}'.format(ctype, i)] = none2str(component.chid) serial_number = none2str(component.serial_number) self['Erasure {} {} Serial Number'.format(ctype, i)] = serial_number From 35ffb8239f90d2cb6510a77f33bf0edd6be6697b Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 30 May 2023 12:49:37 +0200 Subject: [PATCH 3/3] fix pdf --- ereuse_devicehub/resources/action/models.py | 21 +++++++++++++++++++ .../templates/inventory/erasure.html | 5 ----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 20128497..30be54c8 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -563,6 +563,27 @@ class EraseDataWipe(EraseBasic): def get_public_name(self): return "EraseDataWipe" + def __format__(self, format_spec: str) -> str: + v = '' + if 't' in format_spec: + v += '{} {}.'.format(self.type, self.severity) + if 's' in format_spec: + if not self.document: + v += 'On {}'.format(self.date_str) + return v + software = self.document.software or '' + url = self.document.url or '' + v += 'Software: {}, {}. '.format(software, url) + v += 'On {}'.format(self.date_str) + return v + + @property + def date_str(self): + day = self.created + if self.document: + day = self.document.date or self.end_time or self.created + return '{:%c}'.format(day) + class Step(db.Model): erasure_id = Column( diff --git a/ereuse_devicehub/templates/inventory/erasure.html b/ereuse_devicehub/templates/inventory/erasure.html index eca60f4a..5674ae9c 100644 --- a/ereuse_devicehub/templates/inventory/erasure.html +++ b/ereuse_devicehub/templates/inventory/erasure.html @@ -378,11 +378,6 @@ {% endif %} - {% if erasure.type == 'EraseDataWipe' %} -
-
Software:
-
{{ erasure.document and erasure.document.software or ''}}
- {% endif %} {% if erasure.device.proofs %}
DLT Proofs: