forked from forks/microblog.pub
Show poussetaches tasks in the admin
This commit is contained in:
parent
8327f8390e
commit
51bc885a81
2 changed files with 102 additions and 1 deletions
14
app.py
14
app.py
|
@ -89,7 +89,7 @@ from utils.media import Kind
|
|||
from poussetaches import PousseTaches
|
||||
|
||||
phost = "http://" + os.getenv("COMPOSE_PROJECT_NAME", "")
|
||||
p = PousseTaches(f"{phost}_poussetaches_1:7991", f"{phost}_web_1:5005")
|
||||
p = PousseTaches("http://localhost:7991", "") # f"{phost}_poussetaches_1:7991", f"{phost}_web_1:5005")
|
||||
|
||||
|
||||
back = activitypub.MicroblogPubBackend()
|
||||
|
@ -1399,6 +1399,18 @@ def admin():
|
|||
)
|
||||
|
||||
|
||||
@app.route("/admin/tasks", methods=["GET"])
|
||||
@login_required
|
||||
def admin_tasks():
|
||||
|
||||
return render_template(
|
||||
"admin_tasks.html",
|
||||
success=p.get_success(),
|
||||
dead=p.get_dead(),
|
||||
waiting=p.get_waiting(),
|
||||
)
|
||||
|
||||
|
||||
@app.route("/admin/lookup", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def admin_lookup():
|
||||
|
|
89
templates/admin_tasks.html
Normal file
89
templates/admin_tasks.html
Normal file
|
@ -0,0 +1,89 @@
|
|||
{% extends "layout.html" %}
|
||||
{% import 'utils.html' as utils %}
|
||||
{% block title %}Tasks - {{ config.NAME }}{% endblock %}
|
||||
{% block content %}
|
||||
<div>
|
||||
{% include "header.html" %}
|
||||
<div style="margin-top:50px;">
|
||||
|
||||
<h3>Dead</h3>
|
||||
<table class="pure-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>URL</th>
|
||||
<th>Payload</th>
|
||||
<th>Next run</th>
|
||||
<th>Response</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for task in dead %}
|
||||
<tr>
|
||||
<td>{{ task.task_id }}</td>
|
||||
<td>{{ task.url }} ({{ task.expected }}</td>
|
||||
<td>{{ task.payload }}</td>
|
||||
<td>{{ task.next_run }}</td>
|
||||
<td>Tries #{{ task.tries }}: {{ task.last_error_body }} ({{ task.last_error_status_code }})</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h3>Waiting</h3>
|
||||
<table class="pure-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>URL</th>
|
||||
<th>Payload</th>
|
||||
<th>Next run</th>
|
||||
<th>Response</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for task in waiting %}
|
||||
<tr>
|
||||
<td>{{ task.task_id }}</td>
|
||||
<td>{{ task.url }} ({{ task.expected }}</td>
|
||||
<td>{{ task.payload }}</td>
|
||||
<td>{{ task.next_run }}</td>
|
||||
<td>Tries #{{ task.tries }}: {{ task.last_error_body }} ({{ task.last_error_status_code }})</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h3>Success</h3>
|
||||
<table class="pure-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>URL</th>
|
||||
<th>Payload</th>
|
||||
<th>Next run</th>
|
||||
<th>Response</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for task in success %}
|
||||
<tr>
|
||||
<td>{{ task.task_id }}</td>
|
||||
<td>{{ task.url }} ({{ task.expected }}</td>
|
||||
<td>{{ task.payload }}</td>
|
||||
<td>{{ task.next_run }}</td>
|
||||
<td>Tries #{{ task.tries }}: {{ task.last_error_body }} ({{ task.last_error_status_code }})</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue