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": [ "$push" : {"$mergeObjects": [
"$token", "$token",
{"last_seen": "$last_seen"}, {"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}} {{orphaned_keyfobs | length}}
</div> </div>
</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 %} {% for c in orphaned_keyfobs %}
<li class="collection-item"> <tr>
{{c.comment or "unnamed"}} <td>{{c.comment or "unnamed"}}</td>
<div class="secondary-content"> <td><a href="/m/doorboy/{{ c._id }}/events">{{ c.uid_hash[-6:] }}</a></td>
<a href="/m/doorboy/{{ c._id }}/events">{{ c.uid_hash[-6:] }}</a> <td>
</div> {{c.old_display_name}}
</li> {% if c.old_foreign_id %}
({{c.old_foreign_id}})
{% endif %}
</td>
</tr>
{% endfor %} {% endfor %}
</ul> <tbody>
</table>
</div>
</li> </li>
</ul> </ul>