Show old owner data for orphaned keyfobs
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-09-13 11:14:41 +03:00
parent 5b3e284f1b
commit a4b92f8008
2 changed files with 28 additions and 11 deletions

View File

@ -237,7 +237,9 @@ def view_doorboy_admin():
"$push" : {"$mergeObjects": [
"$token",
{"last_seen": "$last_seen"},
{"_id": "$_id"}
{"_id": "$_id"},
{"old_display_name": "$inventory.owner.display_name"},
{"old_foreign_id": "$inventory.owner.foreign_id"}
]}
}
}

View File

@ -45,16 +45,31 @@
{{orphaned_keyfobs | length}}
</div>
</div>
<ul class="collapsible-body collection collapsible-collection">
<div class="collapsible-body collapsible-collection">
<table>
<thead>
<tr>
<th>Comment</th>
<th>Hash tail</th>
<th>Old ownership info</th>
</tr>
</thead>
<tbody>
{% for c in orphaned_keyfobs %}
<li class="collection-item">
{{c.comment or "unnamed"}}
<div class="secondary-content">
<a href="/m/doorboy/{{ c._id }}/events">{{ c.uid_hash[-6:] }}</a>
</div>
</li>
<tr>
<td>{{c.comment or "unnamed"}}</td>
<td><a href="/m/doorboy/{{ c._id }}/events">{{ c.uid_hash[-6:] }}</a></td>
<td>
{{c.old_display_name}}
{% if c.old_foreign_id %}
({{c.old_foreign_id}})
{% endif %}
</td>
</tr>
{% endfor %}
</ul>
<tbody>
</table>
</div>
</li>
</ul>