Show cached counts in admin statistics.

This commit is contained in:
voussoir 2022-11-12 18:40:09 -08:00
parent e3a0b3898f
commit cc3cf58f46
2 changed files with 25 additions and 6 deletions

View file

@ -25,7 +25,14 @@ def get_admin():
'tags': common.P.get_tag_count(),
'users': common.P.get_user_count(),
})
return common.render_template(request, 'admin.html', counts=counts)
cached = dotdict.DotDict({
'albums': len(common.P.caches[etiquette.objects.Album]),
'bookmarks': len(common.P.caches[etiquette.objects.Bookmark]),
'photos': len(common.P.caches[etiquette.objects.Photo]),
'tags': len(common.P.caches[etiquette.objects.Tag]),
'users': len(common.P.caches[etiquette.objects.User]),
})
return common.render_template(request, 'admin.html', cached=cached, counts=counts)
@site.route('/admin/dbdownload')
def get_dbdump():

View file

@ -14,6 +14,15 @@
<script src="/static/js/http.js"></script>
<style>
table, th, td
{
border: 1px solid var(--color_text_placeholder);
border-collapse: collapse
}
th, td
{
padding: 4px;
}
</style>
</head>
@ -30,11 +39,14 @@
</div>
<div class="panel">
<h2>Statistics</h2>
<p>{{counts.albums}} albums</p>
<p>{{counts.bookmarks}} bookmarks</p>
<p>{{counts.photos}} photos</p>
<p>{{counts.tags}} tags</p>
<p>{{counts.users}} users</p>
<table>
<tr><th></th><th>Stored</th><th>Cached</th></tr>
<tr><td>Albums</td><td>{{counts.albums}}</td><td>{{cached.albums}}</td></tr>
<tr><td>Bookmarks</td><td>{{counts.bookmarks}}</td><td>{{cached.bookmarks}}</td></tr>
<tr><td>Photos</td><td>{{counts.photos}}</td><td>{{cached.photos}}</td></tr>
<tr><td>Tags</td><td>{{counts.tags}}</td><td>{{cached.tags}}</td></tr>
<tr><td>Users</td><td>{{counts.users}}</td><td>{{cached.users}}</td></tr>
</table>
</div>
</div>
</body>