From d6f20f37fd1c92f06eccc7b6ce194f9106a19ee4 Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Mon, 10 Feb 2025 17:38:22 -0300 Subject: [PATCH] current state and last date of ev on devices list --- dashboard/templates/unassigned_devices.html | 33 ++++++++++++++------- device/models.py | 6 +++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/dashboard/templates/unassigned_devices.html b/dashboard/templates/unassigned_devices.html index 6a22bb8..5477693 100644 --- a/dashboard/templates/unassigned_devices.html +++ b/dashboard/templates/unassigned_devices.html @@ -46,6 +46,12 @@ {% trans "Model" %} + + {% trans "Current State" %} + + + {% trans "Evidence last updated" %} + @@ -64,16 +70,23 @@ {{ dev.manufacturer }} - - - {% if dev.version %} - {{dev.version}} {{ dev.model }} - {% else %} - {{ dev.model }} - {% endif %} - - - + + + {% if dev.version %} + {{dev.version}} {{ dev.model }} + {% else %} + {{ dev.model }} + {% endif %} + + + {{ dev.get_current_state.state|default:"N/A" }} + + + {{ log.date|date:"M j, Y, H:i" }} + {{ dev.get_last_evidence.created }} + + + {% endfor %}
diff --git a/device/models.py b/device/models.py index a385895..8ae521a 100644 --- a/device/models.py +++ b/device/models.py @@ -125,10 +125,14 @@ class Device: def last_uuid(self): if self.uuid: return self.uuid + + if not self.uuids: + self.get_uuids() + return self.uuids[0] def get_current_state(self): - uuid = self.last_uuid + uuid = self.last_uuid() return State.objects.filter(snapshot_uuid=uuid).order_by('-date').first()