<section class="section">
<div class="container">
<div class="buttons">
- <a class="button is-light" href="{{ monitoring.url }}/check">
+ <form id="check" method="POST" action="{{ monitoring.url }}/check">
+ {% raw xsrf_form_html() %}
+ </form>
+
+ <button class="button is-light" type="submit" form="check">
{{ _("Check Now") }}
- </a>
+ </button>
<a class="button is-warning" href="{{ monitoring.url }}/edit">
{{ _("Edit") }}
# Distro Monitorings
(r"/distros/([A-Za-z0-9\-\.]+)/monitorings/([\w\-_]+)", monitorings.ShowHandler),
+ (r"/distros/([A-Za-z0-9\-\.]+)/monitorings/([\w\-_]+)/check", monitorings.CheckHandler),
# Mirrors
(r"/mirrors", mirrors.IndexHandler),
self.render("monitorings/show.html", monitoring=monitoring)
+class CheckHandler(base.BaseHandler):
+ async def post(self, slug, name):
+ # Fetch the distribution
+ distro = self.backend.distros.get_by_slug(slug)
+ if not distro:
+ raise tornado.web.HTTPError(404, "Could not find distro %s" % slug)
+
+ # Fetch the monitoring
+ monitoring = self.backend.monitorings.get_by_distro_and_name(distro, name)
+ if not monitoring:
+ raise tornado.web.HTTPError(404, "Could not find monitoring for %s in %s" % (name, distro))
+
+ # Perform check
+ with self.db.transaction():
+ await monitoring.check()
+
+ # Redirect back
+ self.redirect(monitoring.url)
+
+
class ReleasesListModule(ui_modules.UIModule):
def render(self, releases, show_empty=True):
return self.render_string("monitorings/modules/releases-list.html",