src/web/jobs.py \
src/web/keys.py \
src/web/mirrors.py \
+ src/web/monitorings.py \
src/web/packages.py \
src/web/repos.py \
src/web/search.py \
templates_distros_modulesdir = $(templates_distrosdir)/modules
+dist_templates_monitorings_DATA = \
+ src/templates/monitorings/show.html
+
+templates_monitoringsdir = $(templatesdir)/monitorings
+
+dist_templates_monitorings_modules_DATA = \
+ src/templates/monitorings/modules/releases-list.html
+
+templates_monitorings_modulesdir = $(templates_monitoringsdir)/modules
+
dist_templates_errors_DATA = \
src/templates/errors/error.html
""", id,
)
+ def get_by_distro_and_name(self, distro, name):
+ return self._get_monitoring("""
+ SELECT
+ *
+ FROM
+ release_monitorings
+ WHERE
+ deleted_at IS NULL
+ AND
+ distro_id = %s
+ AND
+ name = %s
+ """, distro, name,
+ )
+
async def create(self, distro, name, created_by, project_id,
follow="mainline", create_builds=True):
monitoring = self._get_monitoring("""
return "%s - %s" % (self.distro, self.name)
@property
+ def url(self):
+ return "/distros/%s/monitorings/%s" % (self.distro.slug, self.name)
+
+ @lazy_property
def distro(self):
"""
The distribution
def project_id(self):
return self.data.project_id
+ # Last Check At
+
+ @property
+ def last_check_at(self):
+ return self.data.last_check_at
+
@property
def follow(self):
return self.data.follow
FROM
release_monitoring_releases
WHERE
- deleted_at IS NULL
- AND
monitoring_id = %s
ORDER BY
created_at DESC
def version(self):
return self.data.version
+ # Created At
+
+ @property
+ def created_at(self):
+ return self.data.created_at
+
# Bug
async def _create_bug(self):
return bug
+ @property
+ def bug_id(self):
+ return self.data.bug_id
+
# Build
def get_build(self):
--- /dev/null
+{# Show a message if we don't have any releases, yet #}
+{% if show_empty and not releases %}
+ <p class="notification">
+ {{ _("No new releases have been found, yet") }}
+ </p>
+
+{# Show releases #}
+{% elif releases %}
+ {% for release in releases %}
+ <div class="block">
+ <div class="box">
+ <h5 class="title is-5">
+ {{ release }}
+
+ <a class="is-pulled-right" href="{{ backend.bugzilla.bug_url(release.bug_id) }}">
+ <small>{{ _("Bug #%s") % release.bug_id }}</small>
+ </a>
+ </h5>
+ <h6 class="subtitle is-6">{{ locale.format_date(release.created_at, shorter=True) }}</h6>
+
+ {# XXX Show build and build status #}
+ </div>
+ </div>
+ {% end %}
+{% end %}
--- /dev/null
+{% extends "../base.html" %}
+
+{% block title %}{{ _("Release Monitoring") }} - {{ monitoring }}{% end block %}
+
+{% block body %}
+ <section class="hero is-light">
+ <div class="hero-body">
+ <div class="container">
+ <nav class="breadcrumb" aria-label="breadcrumbs">
+ <ul>
+ <li>
+ <a href="/distros">{{ _("Distributions") }}</a>
+ </li>
+ <li>
+ <a href="/distros/{{ monitoring.distro.slug }}">{{ monitoring.distro }}</a>
+ </li>
+ <li>
+ <a href="#" disabled>{{ _("Monitorings") }}</a>
+ </li>
+ <li class="is-active">
+ <a href="/distros/{{ monitoring.distro.slug }}/monitorings/{{ monitoring.name }}"
+ aria-current="page">{{ monitoring.name }}</a>
+ </li>
+ </ul>
+ </nav>
+
+ <h1 class="title is-1">{{ monitoring }}</h1>
+
+ <div class="level">
+ {% if monitoring.latest_release %}
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading">{{ _("Latest Release") }}</p>
+ <p>
+ {{ monitoring.latest_release.version }}
+ </p>
+ </div>
+ </div>
+ {% end %}
+
+ {% if monitoring.latest_build %}
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading">{{ _("Current Release") }}</p>
+ <p>
+ <a href="/builds/{{ monitoring.latest_build.uuid }}">
+ {{ monitoring.latest_build.pkg.evr }}
+ </a>
+ </p>
+ </div>
+ </div>
+ {% end %}
+
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading">{{ _("Last Check") }}</p>
+ <p>
+ {{ locale.format_date(monitoring.last_check_at, shorter=True) }}
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ {% if current_user and current_user.is_admin() %}
+ <section class="section">
+ <div class="container">
+ <div class="buttons">
+ <a class="button is-light" href="{{ monitoring.url }}/check">
+ {{ _("Check Now") }}
+ </a>
+
+ <a class="button is-warning" href="{{ monitoring.url }}/edit">
+ {{ _("Edit") }}
+ </a>
+
+ <a class="button is-danger" href="{{ monitoring.url }}/delete">
+ {{ _("Delete") }}
+ </a>
+ </div>
+ </div>
+ </section>
+ {% end %}
+
+ {# List Releases #}
+ <section class="section">
+ <div class="container">
+ {% module MonitoringsReleasesList(monitoring.releases) %}
+ </div>
+ </section>
+{% end block %}
<section class="section">
<div class="container">
{% for distro in distros %}
+ {# Fetch Monitoring Status #}
+ {% set monitoring = backend.monitorings.get_by_distro_and_name(distro, package.name) %}
+
<div class="block">
<h3 class="title is-3">{{ distro }}</h3>
{% end %}
{% end %}
</div>
+
+ {# Release Monitoring #}
+ {% if current_user and current_user.is_admin() %}
+ {% if monitoring %}
+ <div class="buttons">
+ <a class="button is-light" href="{{ monitoring.url }}">
+ {{ _("Show Upstream Releases") }}
+ </a>
+
+ <a class="button is-warning" href="{{ monitoring.url }}/edit">
+ {{ _("Edit Release Monitoring") }}
+ </a>
+ </div>
+ {% else %}
+ <a class="button is-success" href="{{ monitoring.url }}/create">
+ {{ _("Enable Release Monitoring") }}
+ </a>
+ {% end %}
+ {% end %}
{% end %}
</div>
</section>
from . import jobs
from . import keys
from . import mirrors
+from . import monitorings
from . import packages
from . import repos
from . import search
# Mirrors
"MirrorsList" : mirrors.ListModule,
+ # Monitorings
+ "MonitoringsReleasesList" : monitorings.ReleasesListModule,
+
# Packages
"PackageInfo" : packages.InfoModule,
"PackageDependencies": packages.DependenciesModule,
(r"/distros/(?P<distro_slug>[A-Za-z0-9\-\.]+)/repos/(?P<repo_slug>[A-Za-z0-9\-]+)/sources/(?P<source_slug>[A-Za-z0-9\-]+)",
sources.ShowHandler),
+ # Distro Monitorings
+ (r"/distros/([A-Za-z0-9\-\.]+)/monitorings/([\w\-_]+)", monitorings.ShowHandler),
+
# Mirrors
(r"/mirrors", mirrors.IndexHandler),
(r"/mirrors/create", mirrors.CreateHandler),
--- /dev/null
+###############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2022 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+import tornado.web
+
+from . import base
+from . import ui_modules
+
+class ShowHandler(base.BaseHandler):
+ def get(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))
+
+ self.render("monitorings/show.html", monitoring=monitoring)
+
+
+class ReleasesListModule(ui_modules.UIModule):
+ def render(self, releases, show_empty=True):
+ return self.render_string("monitorings/modules/releases-list.html",
+ releases=releases, show_empty=show_empty)