Localization and several UI changes #51

Open
rskthomas wants to merge 55 commits from ux-changes_rebase into main
2 changed files with 28 additions and 11 deletions
Showing only changes of commit d6f20f37fd - Show all commits

View file

@ -46,6 +46,12 @@
<th scope="col" class="text-center"> <th scope="col" class="text-center">
{% trans "Model" %} {% trans "Model" %}
</th> </th>
<th scope="col" class="text-center">
{% trans "Current State" %}
</th>
<th scope="col" data-type="date" class="text-center" data-format="YYYY-MM-DD HH:mm">
{% trans "Evidence last updated" %}
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -64,16 +70,23 @@
</td> </td>
<td class="text-center"> <td class="text-center">
{{ dev.manufacturer }} {{ dev.manufacturer }}
</td> </td>
<td> <td class="text-center">
{% if dev.version %} {% if dev.version %}
{{dev.version}} {{ dev.model }} {{dev.version}} {{ dev.model }}
{% else %} {% else %}
{{ dev.model }} {{ dev.model }}
{% endif %} {% endif %}
</td> </td>
</tr> <td class="text-center">
</tbody> {{ dev.get_current_state.state|default:"N/A" }}
</td>
<td class="text-center">
<td width="13%">{{ log.date|date:"M j, Y, H:i" }}</td>
{{ dev.get_last_evidence.created }}
</td>
</tr>
</tbody>
{% endfor %} {% endfor %}
</table> </table>
<div class="d-flex justify-content-start mt-5"> <div class="d-flex justify-content-start mt-5">

View file

@ -125,10 +125,14 @@ class Device:
def last_uuid(self): def last_uuid(self):
if self.uuid: if self.uuid:
return self.uuid return self.uuid
if not self.uuids:
self.get_uuids()
return self.uuids[0] return self.uuids[0]
def get_current_state(self): def get_current_state(self):
uuid = self.last_uuid uuid = self.last_uuid()
return State.objects.filter(snapshot_uuid=uuid).order_by('-date').first() return State.objects.filter(snapshot_uuid=uuid).order_by('-date').first()