diff --git a/dashboard/views.py b/dashboard/views.py index 36369c5..8d91732 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -70,10 +70,17 @@ class SearchView(InventaryMixin): return self.search_hids(query, offset, limit) devices = [] + dev_id = [] + for x in matches: - devices.append(self.get_annotations(x)) + # devices.append(self.get_annotations(x)) + dev = self.get_annotations(x) + if dev.id not in dev_id: + devices.append(dev) + dev_id.append(dev.id) count = matches.size() + # TODO fix of pagination, the count is not correct return devices, count def get_annotations(self, xp): diff --git a/device/models.py b/device/models.py index da53de8..a351a11 100644 --- a/device/models.py +++ b/device/models.py @@ -108,6 +108,22 @@ class Device: return annotation = annotations.first() self.last_evidence = Evidence(annotation.uuid) + + def is_eraseserver(self): + if not self.uuids: + self.get_uuids() + if not self.uuids: + return False + + annotation = Annotation.objects.filter( + uuid__in=self.uuids, + owner=self.owner, + type=Annotation.Type.ERASE_SERVER + ).first() + + if annotation: + return True + return False def last_uuid(self): return self.uuids[0] diff --git a/device/templates/details.html b/device/templates/details.html index 51e97f1..d0e9c02 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -12,22 +12,22 @@