Commit 07493f88 authored by Andreas Valder's avatar Andreas Valder
Browse files

added gui to only reschedule/delete one failed job; added option to insert a...

added gui to only reschedule/delete one failed job; added option to insert a copy of an existing job
parent d714fd78
......@@ -35,14 +35,17 @@ def jobs_overview():
return render_template('jobs_overview.html',worker=worker,jobs=jobs, filter_values=filter_values, filter=filter, page=page, pagesize=pagesize, pagecount=pagecount)
@app.route('/internal/jobs/action/<action>')
@app.route('/internal/jobs/action/<action>/<jobid>')
@mod_required
@csrf_protect
def jobs_action(action, jobid=None):
print(jobid)
if action == 'clear_failed':
query('UPDATE jobs SET state="deleted" WHERE state = "failed" AND (id = ? OR ? IS NULL)',jobid, jobid)
if action == 'retry_failed':
query('UPDATE jobs SET state="ready" WHERE state = "failed" AND (id = ? OR ? IS NULL)', jobid, jobid)
if action == 'copy':
if jobid:
query("INSERT INTO jobs SELECT NULL, type, priority, 'ready', '', '' , ?, '', NULL, data, '{}' FROM jobs where ID=?;", datetime.now(), jobid)
return redirect(request.values.get('ref', url_for('jobs_overview')))
def jobs_api_token_required(func):
......
......@@ -112,6 +112,7 @@
<th>Gescheduled am</th>
<th>Daten</th>
<th>Status</th>
<th></th>
</tr>
{% for i in jobs %}
{% if i.last_ping %}
......@@ -140,6 +141,20 @@
<td>{{i.time_scheduled}}</td>
<td>{{i.data}}</td>
<td>{{i.status}}</td>
<td>
{% if i.state == "failed" %}
<a class="btn btn-default" href="{{url_for('jobs_action', action='clear_failed', jobid=i.id, ref=request.url)}}" title="Löschen" >
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
</a>
<a class="btn btn-default" href="{{url_for('jobs_action', action='retry_failed', jobid=i.id, ref=request.url)}}" title="Neustarten">
<span class="fa fa-refresh" aria-hidden="true"></span>
</a>
{% else %}
<a class="btn btn-default" href="{{url_for('jobs_action', action='copy', jobid=i.id, ref=request.url)}}" title="Kopie neu einreihen">
<span class="fa fa-refresh" aria-hidden="true"></span>
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment