{% extends "layout.html" %}
{% block headers %}
<script src="/static/js/jquery-3.6.0.min.js"></script>
<style>
#users-table .fa-user-secret { color: #000; }
#users-table .fa-user-secret:hover { color: #666; }
#users-table .fa-user-secret:active { color: #999; }
#users-table { display: none; }
#users-table_wrapper { margin-top: 1em; }
</style>
<script>
jQuery(document).ready(function () {
    jQuery(".hide-for-javascript").removeClass("hide-for-javascript");
    jQuery("#users-table").show();
    jQuery("#clear-cache").on("click", function (event) {
        event.preventDefault();
        event.stopPropagation();
        jQuery.ajax({
            url:         `/admin/maintenance/clear-cache`,
            type:        "GET",
        }).done(function () {
            jQuery("#message")
                .addClass("success")
                .append("<p>Cache has been cleared.</p>")
                .fadeIn(250);
            setTimeout(function() {
                jQuery("#message").fadeOut(500, function() {
                    jQuery("#message").removeClass("success").empty();
                });
            }, 5000);
        }).fail(function () {
            jQuery("#message")
                .addClass("failure")
                .append("<p>Could not clear the cache.</p>")
                .fadeIn(250);
            setTimeout(function() {
                jQuery("#message").fadeOut(500, function() {
                    jQuery("#message").removeClass("failure").empty();
                });
            }, 5000);
        });
    });
});
</script>
{% endblock %}
{% block submenu %}
<ul>
  <li><a href="/admin/dashboard">Dashboard</a>
  <li><a href="/admin/users">Users</a>
  <li class="active">Maintenance
  <li><a href="/admin/exploratory">Exploratory</a>
</ul>
{% endblock %}
{% block body %}
<noscript>
  <p class="no-script">Sorry, this page requires JavaScript to function properly.</p>
</noscript>
<div class="hide-for-javascript">
<h1>Maintenance</h1>
<div class="center">
  <a id="clear-cache" href="/admin/maintenance/clear-cache" class="button neutral-button">Clear cache</a>
  <a id="clear-sessions" href="/admin/maintenance/clear-sessions" class="button neutral-button">Clear all sessions</a>
</div>
</div>
{% endblock %}
