etiquette/frontends/etiquette_flask/templates/admin.html

101 lines
3.1 KiB
HTML
Raw Normal View History

2021-10-01 21:14:10 +00:00
<!DOCTYPE html>
<html class="theme_{{theme}}">
2021-10-01 21:14:10 +00:00
<head>
{% import "header.html" as header %}
<title>Admin control</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon" href="/favicon.png" type="image/png"/>
2021-10-01 21:14:10 +00:00
<link rel="stylesheet" href="/static/css/common.css">
<link rel="stylesheet" href="/static/css/etiquette.css">
<script src="/static/js/common.js"></script>
<script src="/static/js/api.js"></script>
<script src="/static/js/http.js"></script>
2021-10-01 21:14:10 +00:00
<style>
table, th, td
{
border: 1px solid var(--color_text_placeholder);
border-collapse: collapse
}
th, td
{
padding: 4px;
}
2021-10-01 21:14:10 +00:00
</style>
</head>
<body>
{{header.make_header(session=request.session)}}
2021-10-01 21:14:10 +00:00
<div id="content_body">
<div class="panel">
2022-07-16 06:35:35 +00:00
<h1>Admin tools</h1>
<p><button id="reload_config_button" class="green_button" onclick="return reload_config_form();">Reload config file</button></p>
2022-07-23 02:23:36 +00:00
<p><button id="uncache_button" class="green_button" onclick="return uncache_form();">Uncache objects</button></p>
<p><button id="clear_sessions_button" class="green_button" onclick="return clear_sessions_form();">Clear login sessions</button></p>
2022-07-16 06:35:35 +00:00
<p><a href="/admin/dbdownload">Download database file</a></p>
2021-10-01 21:14:10 +00:00
</div>
<div class="panel">
<h2>Statistics</h2>
<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>
2021-10-01 21:14:10 +00:00
</div>
</body>
<script type="text/javascript">
function clear_sessions_form()
{
const reload_config_button = document.getElementById("clear_sessions_button");
clear_sessions_button.disabled = true;
function callback(response)
{
clear_sessions_button.disabled = false;
if (response.meta.status !== 200)
{
alert(JSON.stringify(response));
}
}
return api.admin.clear_sessions(callback);
}
2021-10-01 21:14:10 +00:00
function reload_config_form()
{
const reload_config_button = document.getElementById("reload_config_button");
reload_config_button.disabled = true;
function callback(response)
{
reload_config_button.disabled = false;
if (response.meta.status !== 200)
{
alert(JSON.stringify(response));
}
}
return api.admin.reload_config(callback);
}
2022-07-23 02:23:36 +00:00
function uncache_form()
{
const uncache_button = document.getElementById("uncache_button");
uncache_button.disabled = true;
function callback(response)
{
uncache_button.disabled = false;
if (response.meta.status !== 200)
{
alert(JSON.stringify(response));
}
}
return api.admin.uncache(callback);
}
2021-10-01 21:14:10 +00:00
</script>
</html>