od-database/templates/dashboard.html

122 lines
4.5 KiB
HTML

{% extends "layout.html" %}
{% set title = "Dashboard - OD-Database" %}
{% block body %}
<div class="container">
<div class="card">
<div class="card-header">Dashboard</div>
<div class="card-body">
<a href="/logs">Logs</a>
<br>
<hr>
<h3>API Keys</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Token</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for token in api_tokens %}
<tr>
<td>{{ token.name }}</td>
<td><code>{{ token.token }}</code></td>
<td>
<form action="/del_token" method="post">
<input type="hidden" value="{{ token.token }}" name="token">
<input type="submit" class="btn btn-danger" value="Delete">
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<form action="/generate_token" method="post">
<div class="form-row">
<div class="col col-md-10">
<input class="form-control" name="description" placeholder="Description">
</div>
<div class="col col-md-2">
<input type="submit" class="form-control btn btn-primary" value="Generate API token">
</div>
</div>
</form>
<br>
<hr>
<h3>Blacklist</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Netloc</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for item in blacklist %}
<tr>
<td>{{ item.netloc }}</td>
<td><a class="btn btn-danger" href="/blacklist/{{ item.id }}/delete">Delete</a></td>
</tr>
{% endfor %}
</tbody>
</table>
<form class="form" action="/blacklist/add" method="POST">
<div class="form-row">
<div class="col col-md-10">
<input class="form-control" name="url" placeholder="Url">
</div>
<div class="col col-md-2">
<input type="submit" class="form-control btn btn-primary" value="Add">
</div>
</div>
</form>
<br>
<hr>
<h3>Misc actions</h3>
<a class="btn btn-danger" href="/website/delete_empty">Delete websites with no associated files that are
not queued</a>
<a class="btn btn-danger" href="/website/redispatch_queued">Re-dispatch queued tasks</a>
<a class="btn btn-danger" href="/website/queue_empty">Re-queue websites with no associated files</a>
<hr>
<a class="btn btn-info" href="/logout">Logout</a>
</div>
</div>
</div>
<script>
function changeSlots(id) {
let slotsElem = document.getElementById("slots-" + id);
let parent = slotsElem.parentNode;
let td = document.createElement("td");
let form = document.createElement("form");
form.setAttribute("action", "/crawl_server/" + id + "/update");
form.setAttribute("method", "post");
let slotsInput = document.createElement("input");
slotsInput.setAttribute("class", "form-control");
slotsInput.setAttribute("name", "slots");
form.appendChild(slotsInput);
td.appendChild(form);
parent.insertBefore(td, slotsElem);
slotsElem.remove();
slotsInput.focus();
slotsInput.addEventListener("focusout", function () {
form.submit();
});
}
</script>
{% endblock body %}