roundabout,
created on Tuesday, 4 June 2024, 17:19:00 (1717521540),
received on Wednesday, 31 July 2024, 06:54:49 (1722408889)
Author identity: vlad <vlad.muntoiu@gmail.com>
4d14d9840ef7e2800cdb8d4845829c21058560f0
app.py
@@ -1544,9 +1544,10 @@ def task_monitor(task_id):
if flask.request.args.get("partial"):
# htmx partial update
return render_block("task-monitor.html", "content", result=task_result)
return render_block("task-monitor.html", "content", result=task_result, query_string=flask.request.query_string.decode(), delay=1000)
return flask.render_template("task-monitor.html", result=task_result)
# Since most tasks finish rather quickly, the initial delay is faster, so it doesn't wait for too long
return flask.render_template("task-monitor.html", result=task_result, query_string=flask.request.query_string.decode(), delay=125)
@repositories.route("/<username>/<repository>/prs/delete", methods=["POST"])
jinja_utils.py
@@ -1,7 +1,19 @@
from app import app
import flask
from datetime import datetime
import markdown
from markupsafe import Markup
from urllib.parse import urlencode
@app.template_global()
def modify_query(**new_values):
args = flask.request.args.copy()
for key, value in new_values.items():
args[key] = value
return f"{flask.request.path}?{urlencode(args)}"
@app.template_filter("split")
templates/task-monitor.html
@@ -7,7 +7,7 @@
{% endblock %}
{% block content %}
{# Update every 5 seconds #}
<x-frame style="--width: 896px;" class="flexible-space" {% if not result.ready() %}hx-swap="outerHTML" hx-get="/task/{{ result.id }}?partial=1" hx-trigger="load delay:1s"{% endif %}>
<x-frame style="--width: 896px;" class="flexible-space" {% if not result.ready() %}hx-swap="outerHTML" hx-get={{ modify_query(partial=1) }} hx-trigger="load delay:{{ delay }}ms"{% endif %}>
<x-hbox class="box-center">
<h1>{% trans %}Task results{% endtrans %}</h1>
<div class="flexible-space"></div>
@@ -15,54 +15,67 @@
<iconify-icon icon="mdi:check" style="font-size: 2em; color: var(--color-success);"></iconify-icon>
{% trans %}Done{% endtrans %}
{% else %}
<iconify-icon icon="material-symbols:autorenew" style="animation: rotate 750ms linear infinite; font-size: 2em; color: var(--color-info);"></iconify-icon>
<iconify-icon icon="material-symbols:autorenew" style="font-size: 2em; color: var(--color-info);"></iconify-icon>
{% trans %}Running...{% endtrans %}
{% endif %}
</x-hbox>
{% if result.get()[0] == "merge_simulator" %}
{% if result.get()[1] %}
<h2>{% trans %}Info{% endtrans %}</h2>
<pre aria-busy="true" aria-describedby="task-progress">{{ result.get()[1] | decode }}</pre>
{% endif %}
{% if result.get()[2] %}
<h2>{% trans %}Errors{% endtrans %}</h2>
<pre aria-busy="true" aria-describedby="task-progress">{{ result.get()[2] | decode }}</pre>
{% if result.ready() %}
{% if result.get()[0] == "merge" %}
{% if result.get()[1] %}
<h2>{% trans %}Info{% endtrans %}</h2>
<pre aria-busy="true" aria-describedby="task-progress">{{ result.get()[1] | decode }}</pre>
{% endif %}
{% if result.get()[2] %}
<h2>{% trans %}Errors{% endtrans %}</h2>
<pre aria-busy="true" aria-describedby="task-progress">{{ result.get()[2] | decode }}</pre>
{% endif %}
{% endif %}
{% if result.get()[7] %}
<h2>{% trans %}Cannot merge your branches{% endtrans %}</h2>
<p>
{% trans %}Since we can't help you with this yet, you'll need to resolve the merge conflicts on your own computer.{% endtrans %}
</p>
<p>
{% trans %}In a shell inside your repository execute:{% endtrans %}
</p>
{% if result.get()[3] != result.get()[5] %}
<pre>
<span class="decorative-dollar">git remote add UPSTREAM {{ result.get()[3] }}</span>
<span class="decorative-dollar">git remote update</span>
<span class="decorative-dollar">git checkout {{ result.get()[6] }}</span>
<span class="decorative-dollar">git merge --allow-unrelated-histories UPSTREAM/{{ result.get()[4] }}</span></pre>
{% if result.get()[0] == "merge_simulator" %}
{% if result.get()[1] %}
<h2>{% trans %}Info{% endtrans %}</h2>
<pre aria-busy="true" aria-describedby="task-progress">{{ result.get()[1] | decode }}</pre>
{% endif %}
{% if result.get()[2] %}
<h2>{% trans %}Errors{% endtrans %}</h2>
<pre aria-busy="true" aria-describedby="task-progress">{{ result.get()[2] | decode }}</pre>
{% endif %}
{% if result.get()[7] %}
<h2>{% trans %}Cannot merge your branches{% endtrans %}</h2>
<p>
{% trans %}Then fix your conflicts, merge, and finally, run:{% endtrans %}
{% trans %}Since we can't help you with this yet, you'll need to resolve the merge conflicts on your own computer.{% endtrans %}
</p>
<pre>
<span class="decorative-dollar">git remote rm UPSTREAM</span></pre>
<p>
{% trans %}and push the changes.{% endtrans %}
{% trans %}In a shell inside your repository execute:{% endtrans %}
</p>
{% if result.get()[3] != result.get()[5] %}
<pre>
<span class="decorative-dollar">git remote add UPSTREAM {{ result.get()[3] }}</span>
<span class="decorative-dollar">git remote update</span>
<span class="decorative-dollar">git checkout {{ result.get()[6] }}</span>
<span class="decorative-dollar">git merge --allow-unrelated-histories UPSTREAM/{{ result.get()[4] }}</span></pre>
<p>
{% trans %}Then fix your conflicts, merge, and finally, run:{% endtrans %}
</p>
<pre>
<span class="decorative-dollar">git remote rm UPSTREAM</span></pre>
<p>
{% trans %}and push the changes.{% endtrans %}
</p>
{% else %}
<pre>
<span class="decorative-dollar">git checkout {{ result.get()[6] }}</span>
<span class="decorative-dollar">git merge {{ result.get()[4] }}</span></pre>
<p>
{% trans %}Resolve your conflicts and merge, then push.{% endtrans %}
</p>
{% endif %}
{% else %}
<pre>
<span class="decorative-dollar">git checkout {{ result.get()[6] }}</span>
<span class="decorative-dollar">git merge {{ result.get()[4] }}</span></pre>
<p>
{% trans %}Resolve your conflicts and merge, then push.{% endtrans %}
</p>
<h2>{% trans %}Merge simulation went well; continue?{% endtrans %}</h2>
<a href="{{ result.get()[5] }}/prs/{{ request.args.get('pr-id') }}/merge" class="button">{% trans %}Merge{% endtrans %}</a>
{% endif %}
{% else %}
<h2>{% trans %}Merge simulation went well; continue?{% endtrans %}</h2>
<a href="{{ result.get()[5] }}/prs/{{ request.args.get('pr-id') }}/merge" class="button">{% trans %}Merge{% endtrans %}</a>
{% endif %}
{% endif %}
</x-frame>