# Abort!
- async def abort(self, user=None):
+ async def abort(self, aborted_by=None):
"""
Aborts the job
"""
# Mark as aborted
self.aborted = True
- if user:
- self.aborted_by = user
+ if aborted_by:
+ self.aborted_by = aborted_by
# Try to dispatch more jobs in the background
await self.backend.jobs.queue.dispatch()
-{% extends "../base.html" %}
+{% extends "modal.html" %}
-{% block title %}{{ _("Abort Job %s") % job }}{% end block %}
+{% block title %}{{ _("Abort Job %s") % job }}{% endblock %}
-{% block container %}
+{% block breadcrumbs %}
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li>
</li>
</ul>
</nav>
+{% endblock %}
- <div class="columns is-centered">
- <div class="column is-6">
- <h1 class="title is-1">{{ _("Abort Job") }}</h1>
+{% block modal_title %}
+ <h4 class="title is-4">{{ _("Abort Job") }}</h4>
+ <h6 class="subtitle is-6">{{ job }}</h6>
+{% endblock %}
- <form method="POST" action="">
- <div class="box">
- {% raw xsrf_form_html() %}
+{% block modal %}
+ <form method="POST" action="">
+ {{ xsrf_form_html() | safe }}
- <input class="button is-danger" type="submit"
- value="{{ _("Abort Job") }}" />
- </div>
- </form>
+ <div class="content">
+ <p>
+ {{ _("Do you want to abort %s?") % job }}
+ </p>
</div>
- </div>
-{% end block %}
+
+ {# Submit! #}
+ <div class="field">
+ <button type="submit" class="button is-danger is-fullwidth">
+ {{ _("Abort Job") }}
+ </button>
+ </div>
+ </form>
+{% endblock %}
if not job.has_perm(self.current_user):
raise tornado.web.HTTPError(403)
- self.render("jobs/abort.html", job=job)
+ await self.render("jobs/abort.html", job=job)
@base.authenticated
async def post(self, uuid):
if not job.has_perm(self.current_user):
raise tornado.web.HTTPError(403)
+ # Abort the job
async with await self.db.transaction():
- await job.abort(self.current_user)
+ await job.abort(aborted_by=self.current_user)
self.redirect("/builds/%s" % job.build.uuid)