diff --git a/jobs.py b/jobs.py index 11958284176b22b465125ee4ebcf5ea5be4c88f2..d831bdbe1473348913302affc8ed8c1cd83f2258 100644 --- a/jobs.py +++ b/jobs.py @@ -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): diff --git a/templates/jobs_overview.html b/templates/jobs_overview.html index 66db8474566da34d1505e1c5e16e3986a9858fb8..775da81e00e3f63c937fdd8677ac64ef9fe43dd5 100644 --- a/templates/jobs_overview.html +++ b/templates/jobs_overview.html @@ -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>