From 7c1e0c1804b4a13acd927defdcd83a365c7f134a Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Thu, 12 Dec 2024 16:46:39 -0300 Subject: [PATCH] Device-details html modularized into several files --- device/templates/details.html | 354 +-------------------- device/templates/tabs/components.html | 27 ++ device/templates/tabs/documents.html | 49 +++ device/templates/tabs/evidences.html | 19 ++ device/templates/tabs/general_details.html | 128 ++++++++ device/templates/tabs/log.html | 61 ++++ device/templates/tabs/lots.html | 19 ++ device/templates/tabs/user_properties.html | 132 ++++++++ 8 files changed, 441 insertions(+), 348 deletions(-) create mode 100644 device/templates/tabs/components.html create mode 100644 device/templates/tabs/documents.html create mode 100644 device/templates/tabs/evidences.html create mode 100644 device/templates/tabs/general_details.html create mode 100644 device/templates/tabs/log.html create mode 100644 device/templates/tabs/lots.html create mode 100644 device/templates/tabs/user_properties.html diff --git a/device/templates/details.html b/device/templates/details.html index 8ee3ec4..6d994fd 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -62,361 +62,19 @@
- -
-
-
-
{% trans 'Details' %}
-
-
-
{% trans 'Phid' %}
-
{{ object.id }}
-
- - {% if object.is_eraseserver %} -
-
{% trans 'Is an erase server' %}
-
{% trans 'Yes' %}
-
- {% endif %} - -
-
{% trans 'Type' %}
-
{{ object.type }}
-
- - {% if object.is_websnapshot and object.last_user_evidence %} - {% for k, v in object.last_user_evidence.items %} -
-
{{ k }}
-
{{ v|default:'' }}
-
- {% endfor %} - {% else %} -
-
{% trans 'Manufacturer' %}
-
{{ object.manufacturer|default:'' }}
-
- -
-
{% trans 'Model' %}
-
{{ object.model|default:'' }}
-
- -
-
{% trans 'Serial Number' %}
-
{{ object.serial_number|default:'' }}
-
- {% endif %} - -
-
{% trans 'Identifiers' %}
-
- {% for chid in object.hids %} -
{{ chid|default:'' }}
- {% endfor %} -
-
-
- - - -
-
{% trans 'Current State' %}
-
-
- - - - - - - - - - {% if device_states %} - - - - - - {% else %} - - - - {% endif %} - -
{% trans 'State' %}{% trans 'User' %}{% trans 'Date' %}
{{ device_states.0.state }}{{ device_states.0.user.responsable_person|default:device_states.0.user.username }}{{ device_states.0.date|date:"SHORT_DATETIME_FORMAT" }}
{% trans 'No state recorded.' %}
-
+ {% include 'tabs/general_details.html' %} - - {% if last_note %} -
-
{% trans 'Note' %}
-
{{ object.last_state.note }}
-
- {% endif %} -
-
-
- - - + {% include 'tabs/log.html' %} -
-
{% trans 'Log' %}
-
- - - - - - - - - - - {% for state_change in device_states %} - - - - - - - {% empty %} - - - - {% endfor %} - -
{% trans 'Date' %}{% trans 'User' %}{% trans 'State' %}{% trans 'Actions' %}
{{ state_change.date|date:"SHORT_DATETIME_FORMAT" }}{{ state_change.user.responsable_person|default:state_change.user.username }}{{ state_change.state }} - {% if state_change.date|timesince < '1 hour' %} - - - - - - - {% endif %} -
{% trans 'No state changes recorded.' %}
-
-
+ {% include 'tabs/user_properties.html' %} -
- + {% include 'tabs/documents.html' %} -
{% trans 'User properties' %}
- - - - - - - - - - - {% for a in object.get_user_properties %} - - - - - - - {% endfor %} - -
- {% trans 'Key' %} - - {% trans 'Value' %} - - {% trans 'Created on' %} -
{{ a.key }}{{ a.value }}{{ a.created }} -
- - -
-
-
+ {% include 'tabs/lots.html' %} - -{% for a in object.get_user_properties %} - -{% endfor %} + {% include 'tabs/evidences.html' %} - -{% for a in object.get_user_properties %} - -{% endfor %} - -
- - -
{% trans 'Documents' %}
- - - - - - - - - - - - {% for a in object.get_user_documents %} - - - - - - - - {% endfor %} - -
- {% trans 'Key' %} - - {% trans 'Value' %} - - {% trans 'Created on' %} -
{{ a.key }}{{ a.value }}{{ a.created }}
-
- -
- {% for tag in lot_tags %} -
{{ tag }}
- {% for lot in object.lots %} - {% if lot.type == tag %} -
- -
- {% endif %} - {% endfor %} - {% endfor %} -
- -
-
{% trans 'Components last evidence' %}
-
- {% for c in object.components %} -
-
-
{{ c.type }}
- {{ evidence.created }} -
-

- {% for k, v in c.items %} - {% if k not in 'actions,type' %} - {{ k }}: {{ v }}
- {% endif %} - {% endfor %} -

-
- {% endfor %} -
-
- -
-
{% trans 'List of evidences' %}
-
- {% for snap in object.evidences %} -
-
- {{ snap.created }} -
-

- {{ snap.uuid }} -

-
- {% endfor %} -
-
-
{% if state_definitions %} diff --git a/device/templates/tabs/components.html b/device/templates/tabs/components.html new file mode 100644 index 0000000..db95f43 --- /dev/null +++ b/device/templates/tabs/components.html @@ -0,0 +1,27 @@ + +{% load i18n %} + +
+
{% trans 'Components last evidence' %} +
+
+ {% for c in object.components %} +
+
+
{{ c.type }} +
+ {{ evidence.created }} + +
+

+ {% for k, v in c.items %} + {% if k not in 'actions,type' %} + {{ k }}: {{ v }} +
+ {% endif %} + {% endfor %} +

+
+ {% endfor %} +
+
diff --git a/device/templates/tabs/documents.html b/device/templates/tabs/documents.html new file mode 100644 index 0000000..1679b62 --- /dev/null +++ b/device/templates/tabs/documents.html @@ -0,0 +1,49 @@ + +{% load i18n %} +
+ + +
{% trans 'Documents' %} +
+ + + + + + + + + + + + {% for a in object.get_user_documents %} + + + + + + + + {% endfor %} + +
+ {% trans 'Key' %} + + {% trans 'Value' %} + + {% trans 'Created on' %} + + +
{{ a.key }} + {{ a.value }} + {{ a.created }} + + +
+
diff --git a/device/templates/tabs/evidences.html b/device/templates/tabs/evidences.html new file mode 100644 index 0000000..7737658 --- /dev/null +++ b/device/templates/tabs/evidences.html @@ -0,0 +1,19 @@ + +{% load i18n %} + +
+
{% trans 'List of evidences' %}
+
+ {% for snap in object.evidences %} +
+
+ {{ snap.created }} +
+

+ {{ snap.uuid }} +

+
+ {% endfor %} +
+
+ diff --git a/device/templates/tabs/general_details.html b/device/templates/tabs/general_details.html new file mode 100644 index 0000000..63f9129 --- /dev/null +++ b/device/templates/tabs/general_details.html @@ -0,0 +1,128 @@ + +{% load i18n %} + + +
+
+ +
+
{% trans 'Details' %} +
+
+
+
{% trans 'Phid' %} +
+
{{ object.id }} +
+
+ + {% if object.is_eraseserver %} +
+
{% trans 'Is an erase server' %} +
+
{% trans 'Yes' %} +
+
+ {% endif %} + +
+
{% trans 'Type' %} +
+
{{ object.type }} +
+
+ + {% if object.is_websnapshot and object.last_user_evidence %} + {% for k, v in object.last_user_evidence.items %} +
+
{{ k }} +
+
{{ v|default:'' }} +
+
+ {% endfor %} + {% else %} +
+
{% trans 'Manufacturer' %} +
+
{{ object.manufacturer|default:'' }} +
+
+ +
+
{% trans 'Model' %} +
+
{{ object.model|default:'' }} +
+
+ +
+
{% trans 'Serial Number' %} +
+
{{ object.serial_number|default:'' }} +
+
+ {% endif %} + +
+
{% trans 'Identifiers' %} +
+
+ {% for chid in object.hids %} +
{{ chid|default:'' }} +
+ {% endfor %} +
+
+
+ + + +
+
{% trans 'Current State' %} +
+
+
+ + + + + + + + + + {% if device_states %} + + + + + + {% else %} + + + + {% endif %} + +
{% trans 'State' %} + {% trans 'User' %} + {% trans 'Date' %} +
{{ device_states.0.state }} + {{ device_states.0.user.responsable_person|default:device_states.0.user.username }} + {{ device_states.0.date|date:"SHORT_DATETIME_FORMAT" }} +
{% trans 'No state recorded.' %} +
+
+ + + {% if last_note %} +
+
{% trans 'Note' %} +
+
{{ object.last_state.note }} +
+
+ {% endif %} +
+
+
diff --git a/device/templates/tabs/log.html b/device/templates/tabs/log.html new file mode 100644 index 0000000..3c25e20 --- /dev/null +++ b/device/templates/tabs/log.html @@ -0,0 +1,61 @@ +{% load i18n %} + + +
+
{% trans 'Log' %}
+
+ + + + + + + + + + + {% for state_change in device_states %} + + + + + + + {% empty %} + + + + {% endfor %} + +
{% trans 'Date' %}{% trans 'User' %}{% trans 'State' %}{% trans 'Actions' %}
{{ state_change.date|date:"SHORT_DATETIME_FORMAT" }}{{ state_change.user.responsable_person|default:state_change.user.username }}{{ state_change.state }} + {% if state_change.date|timesince < '1 hour' %} + + + + + + + {% endif %} +
{% trans 'No state changes recorded.' %}
+
+
diff --git a/device/templates/tabs/lots.html b/device/templates/tabs/lots.html new file mode 100644 index 0000000..59c44ac --- /dev/null +++ b/device/templates/tabs/lots.html @@ -0,0 +1,19 @@ + +{% load i18n %} + +
+ {% for tag in lot_tags %} +
{{ tag }} +
+ {% for lot in object.lots %} + {% if lot.type == tag %} + + {% endif %} + {% endfor %} + {% endfor %} +
diff --git a/device/templates/tabs/user_properties.html b/device/templates/tabs/user_properties.html new file mode 100644 index 0000000..7058d67 --- /dev/null +++ b/device/templates/tabs/user_properties.html @@ -0,0 +1,132 @@ + +{% load i18n %} + +
+ + +
{% trans 'User properties' %} +
+ + + + + + + + + + + {% for a in object.get_user_properties %} + + + + + + + {% endfor %} + +
+ {% trans 'Key' %} + + {% trans 'Value' %} + + {% trans 'Created on' %} + +
{{ a.key }} + {{ a.value }} + {{ a.created }} + +
+ + +
+
+
+ + +{% for a in object.get_user_properties %} + +{% endfor %} + + +{% for a in object.get_user_properties %} + +{% endfor %}