Commit 97092955 authored by Andreas Valder's avatar Andreas Valder
Browse files

added option to clear all failed jobs

parent 216e8810
......@@ -34,6 +34,14 @@ def jobs_overview():
jobs = query('SELECT * FROM jobs WHERE (type like ?) AND (worker like ? OR (worker IS NULL AND ? = "%")) AND (state like ?) ORDER BY `time_created` DESC LIMIT ? OFFSET ?', filter['type'], filter['worker'], filter['worker'], filter['state'], pagesize, page*pagesize)
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>')
@mod_required
@csrf_protect
def jobs_action(action):
if action == 'clear_failed':
query('UPDATE jobs SET state="deleted" WHERE state="failed"')
return redirect(request.values.get('ref', url_for('jobs_overview')))
def jobs_api_token_required(func):
@wraps(func)
def decorator(*args, **kwargs):
......
......@@ -34,9 +34,11 @@
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">
Jobs
</h1>
<h1 class="panel-title">
Jobs
<a class="btn btn-default">Job(s) erzeugen</a>
<a class="btn btn-default" href="{{url_for('jobs_action', action='clear_failed', ref=request.url)}}" >Alle fehlgeschlagenen Jobs löschen</a>
</h1>
</div>
<div class="panel-collapse collapse in">
<div class="panel-body">
......
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