From 51bc885a8183b35ff9586099d78fc940f0f400ad Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 7 Apr 2019 12:27:48 +0200 Subject: [PATCH] Show poussetaches tasks in the admin --- app.py | 14 +++++- templates/admin_tasks.html | 89 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 templates/admin_tasks.html diff --git a/app.py b/app.py index 836387c..ce7a160 100644 --- a/app.py +++ b/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(): diff --git a/templates/admin_tasks.html b/templates/admin_tasks.html new file mode 100644 index 0000000..53b3526 --- /dev/null +++ b/templates/admin_tasks.html @@ -0,0 +1,89 @@ +{% extends "layout.html" %} +{% import 'utils.html' as utils %} +{% block title %}Tasks - {{ config.NAME }}{% endblock %} +{% block content %} +
+{% include "header.html" %} +
+ +

Dead

+ + + + + + + + + + + + + {% for task in dead %} + + + + + + + + {% endfor %} + +
#URLPayloadNext runResponse
{{ task.task_id }}{{ task.url }} ({{ task.expected }}{{ task.payload }}{{ task.next_run }}Tries #{{ task.tries }}: {{ task.last_error_body }} ({{ task.last_error_status_code }})
+ + +

Waiting

+ + + + + + + + + + + + + {% for task in waiting %} + + + + + + + + {% endfor %} + +
#URLPayloadNext runResponse
{{ task.task_id }}{{ task.url }} ({{ task.expected }}{{ task.payload }}{{ task.next_run }}Tries #{{ task.tries }}: {{ task.last_error_body }} ({{ task.last_error_status_code }})
+ + +

Success

+ + + + + + + + + + + + + {% for task in success %} + + + + + + + + {% endfor %} + +
#URLPayloadNext runResponse
{{ task.task_id }}{{ task.url }} ({{ task.expected }}{{ task.payload }}{{ task.next_run }}Tries #{{ task.tries }}: {{ task.last_error_body }} ({{ task.last_error_status_code }})
+ + +
+
+{% endblock %}