]> git.ipfire.org Git - pbs.git/commitdiff
distro: Drop old source handlers
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2022 15:13:50 +0000 (15:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2022 15:13:50 +0000 (15:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/distro-source-commit-detail.html [deleted file]
src/templates/distro-source-commit-reset.html [deleted file]
src/templates/distro-source-commits.html [deleted file]
src/templates/distro-source-detail.html [deleted file]
src/web/__init__.py
src/web/distributions.py

index 42cd14ae203315aa49b8418ed252e7299d031cbd..07a63ed16b70bd6977a37876fd56a1c2629af533 100644 (file)
@@ -157,10 +157,6 @@ webdir = $(buildservicedir)/web
 
 dist_templates_DATA = \
        src/templates/base.html \
-       src/templates/distro-source-commit-detail.html \
-       src/templates/distro-source-commit-reset.html \
-       src/templates/distro-source-commits.html \
-       src/templates/distro-source-detail.html \
        src/templates/index.html \
        src/templates/jobs-abort.html \
        src/templates/jobs-buildroot.html \
diff --git a/src/templates/distro-source-commit-detail.html b/src/templates/distro-source-commit-detail.html
deleted file mode 100644 (file)
index 4c7987a..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}{{ _("Commit") }}: {{ commit.revision }}{% end block %}
-
-{% block body %}
-
-
-<div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <nav aria-label="breadcrumb" role="navigation">
-                               <ol class="breadcrumb">
-                                       <li class="breadcrumb-item"><a href="/">{{ _("Home") }}</a></li>
-                                       <li class="breadcrumb-item"><a href="/distros">{{ _("Distributions") }}</a></li>
-                                       <li class="breadcrumb-item"><a href="/distro/{{ distro.identifier }}">{{ distro.name }}</a></li>
-                                       <li class="breadcrumb-item">
-                                               <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}">
-                                                       {{ _("Source: %s") % source.name }}
-                                               </a>
-                                       </li>
-                                       <li class="breadcrumb-item active">
-                                               <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}/{{ commit.revision }}">
-                                                       {{ commit.revision[:7] }}
-                                               </a>
-                                       </li>
-                               </ol>
-                       </nav>
-               </div>
-       </div>
-
-       <div class="row">
-                       {% if source.gitweb or (current_user and current_user.is_admin()) %}
-                       <div class="col-12 col-sm-12 col-md-9 col-lg-10 col-xl-10">
-                       <h2 style="word-wrap: break-word;">
-                                       {{ _("Source") }}: {{ source.name }}
-                                       <br />
-                                       <small>
-                                               {{ commit.revision[:7] }} - {{ commit.subject }}
-                                       </small>
-                               </h2>
-                       </div>
-                       <div class="col-12 col-sm-12 col-md-3 col-lg-2 col-xl-2 mb-2">
-                               <div class="dropdown">
-                                       <button class="btn btn-block btn-light dropdown-toggle mb-2" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                               {{ _("Actions") }}
-                                       </button>
-                                       <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
-                                               {% if source.gitweb %}
-                                                       <a class="dropdown-item" href="{{ source.gitweb }};a=commitdiff;h={{ commit.revision }}" target="_blank">
-                                                               {{ _("Open in gitweb") }}
-                                                       </a>
-                                               {% end %}
-                                               {% if current_user and current_user.is_admin() %}
-                                                       <a class="dropdown-item" href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}/{{ commit.revision }}/reset">
-                                                               {{ _("Reset commit") }}
-                                                       </a>
-                                               {% end %}
-                                       </div>
-                               </div>
-                       </div>
-               {% else %}
-                       <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                               <h2 style="word-wrap: break-word;">
-                                       {{ _("Source") }}: {{ source.name }}
-                                       <br />
-                                       <small>
-                                               {{ commit.revision[:7] }} - {{ commit.subject }}
-                                       </small>
-                               </h2>
-                       </div>
-               {% end %}
-       </div>
-
-
-       <div class="row">
-               {% if commit.message %}
-                       <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
-               {% else %}
-                       <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-               {% end %}
-                               <div class="table-responsive mb-2">
-                                       <table class="table">
-                                               <tbody>
-                                                       <tr>
-                                                               <td>{{ _("Revision") }}</td>
-                                                               <td>{{ commit.revision }}</td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>{{ _("Date") }}</td>
-                                                               <td>{{ format_date(commit.date, full_format=True) }}</td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>{{ _("Author") }}</td>
-                                                               <td>{% module LinkToUser(commit.author) %}</td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>{{ _("Committer") }}</td>
-                                                               <td>{% module LinkToUser(commit.committer) %}</td>
-                                                       </tr>
-                                               </tbody>
-                                       </table>
-                               </div>
-               </div>
-               {% if commit.message %}
-                       <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
-                               {% module CommitMessage(commit) %}
-                       </div>
-               {% end %}
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                               <h3 style="word-wrap: break-word;">
-                                               {{ _("Packages created from this commit") }}
-                               </h3>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       {% if commit.packages %}
-                               <div class="table-responsive">
-                                       <table class="table table-striped table-hover">
-                                               {% for pkg in commit.packages %}
-                                                       <tr>
-                                                               <td>
-                                                                       <a href="/package/{{ pkg.uuid }}">{{ pkg.friendly_name }}</a>
-                                                               </td>
-                                                               <td>
-                                                                       {{ pkg.summary }}
-                                                               </td>
-                                                       </tr>
-                                               {% end %}
-                                       </table>
-                               </div>
-                       {% else %}
-                               <p>{{ _("There were no packages created from this commit.") }}</p>
-                       {% end %}
-               </div>
-       </div>
-{% end block %}
diff --git a/src/templates/distro-source-commit-reset.html b/src/templates/distro-source-commit-reset.html
deleted file mode 100644 (file)
index f995518..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{% extends "base.html" %}
-
-{% block body %}
-       <ul class="breadcrumb">
-               <li>
-                       <a href="/">{{ _("Home") }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li>
-                       <a href="/distros">{{ _("Distributions") }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li>
-                       <a href="/distro/{{ distro.identifier }}">{{ distro.name }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li>
-                       <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}">
-                               {{ _("Source: %s") % source.name }}
-                       </a>
-                       <span class="divider">/</span>
-               </li>
-               <li class="active">
-                       <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}/{{ commit.revision }}">
-                               {{ commit.revision[:7] }}
-                       </a>
-               </li>
-       </ul>
-
-       <div class="page-header">
-               <h1>
-                       {{ _("Source") }}: {{ source.name }}
-                       <br />
-                       <small>
-                               {{ commit.revision[:7] }} - {{ commit.subject }}
-                       </small>
-               </h1>
-       </div>
-
-       <div class="row">
-               <div class="span6 offset3">
-                       <div class="alert alert-block alert-important">
-                               <h4 class="alert-heading">{{ _("Danger!") }}</h4>
-                               {{ _("This is a very dangerous action!") }}<br />
-                               {{ _("Don't do it, if you are not absolutely sure what you are doing.") }}
-                       </div>
-
-                       <p>
-                               {{ _("This commit will be reset. Which means all packages associated with it will be deleted, and the commit will be parsed again.") }}
-                               {{ _("This action may cause severe problems and may only be allowed when something went horribly wrong.") }}
-                       </p>
-
-                       <a class="btn btn-danger pull-right" href="?confirmed=1">
-                               {{ _("Reset commit") }}
-                       </a>
-               </div>
-       </div>
-
-       {% if commit.packages %}
-               <div class="row">
-                       <div class="span10 offset1">
-                               <h2>{{ _("These packages will be deleted") }}</h2>
-                               <table class="table table-striped table-hover">
-                                       {% for pkg in commit.packages %}
-                                               <tr>
-                                                       <td>
-                                                               <a href="/package/{{ pkg.uuid }}">{{ pkg.friendly_name }}</a>
-                                                       </td>
-                                                       <td>
-                                                               {{ pkg.summary }}
-                                                       </td>
-                                               </tr>
-                                       {% end %}
-                               </table>
-                       </div>
-               </div>
-       {% end %}
-{% end block %}
diff --git a/src/templates/distro-source-commits.html b/src/templates/distro-source-commits.html
deleted file mode 100644 (file)
index 32403c9..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-{% extends "base.html" %}
-
-{% block body %}
-<div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <nav aria-label="breadcrumb" role="navigation">
-                               <ol class="breadcrumb">
-                                       <li class="breadcrumb-item"><a href="/">{{ _("Home") }}</a></li>
-                                       <li class="breadcrumb-item"><a href="/distros">{{ _("Distributions") }}</a></li>
-                                       <li class="breadcrumb-item"><a href="/distro/{{ distro.identifier }}">{{ distro.name }}</a></li>
-                                       <li class="breadcrumb-item">
-                                               <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}">
-                                                       {{ _("Source: %s") % source.name }}
-                                               </a>
-                                       </li>
-                                       <li class="breadcrumb-item active">
-                                                       <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}/commits">
-                                                               {{ _("Commits") }}
-                                                       </a>
-                                               </li>
-                               </ol>
-                       </nav>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <h2 style="word-wrap: break-word;">
-                               {{ _("Distribution") }}: {{ distro.name }} </br>
-                               <span>{{ _("Source") }}: {{ source.name }} - {{ _("Commits") }}</span>
-                       </h2>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <p>
-                               {{ _("Source repository") }}:
-                               <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}">
-                                       {{ source.name }}
-                               </a>
-                       </p>
-               </div>
-       </div>
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       {% module CommitsTable(distro, source, commits) %}
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <nav aria-label="Page navigation example">
-                               <ul class="pagination justify-content-center">
-                                       {% if offset %}
-                                               <li class="page-item">
-                                                       <a class="page-link" href="?offset={{ offset - number }}">{{ _("Previous commits") }}</a>
-                                               </li>
-                                       {% end %}
-                                       {% if limit %}
-                                               <li class="page-item">
-                                                       <a class="page-link" href="?offset={{ offset + number }}">{{ _("Next commits") }}</a>
-                                               </li>
-                                       {% end %}
-                               </ul>
-                       </nav>
-               </div>
-       </div>
-{% end block %}
diff --git a/src/templates/distro-source-detail.html b/src/templates/distro-source-detail.html
deleted file mode 100644 (file)
index d8c74fe..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-{% extends "base.html" %}
-
-{% block body %}
-<div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <nav aria-label="breadcrumb" role="navigation">
-                               <ol class="breadcrumb">
-                                       <li class="breadcrumb-item"><a href="/">{{ _("Home") }}</a></li>
-                                       <li class="breadcrumb-item"><a href="/distros">{{ _("Distributions") }}</a></li>
-                                       <li class="breadcrumb-item"><a href="/distro/{{ distro.identifier }}">{{ distro.name }}</a></li>
-                                       <li class="breadcrumb-item active">
-                                               <a href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}">
-                                                       {{ _("Source: %s") % source.name }}
-                                               </a>
-                                       </li>
-                               </ol>
-                       </nav>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <h2 style="word-wrap: break-word;">
-                               {{ _("Source") }}: {{ source.name }}
-                       </h2>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <div class="table-responsive mb-2">
-                               <table class="table">
-                                       <tbody>
-                                               {% if source.gitweb %}
-                                                       <tr>
-                                                               <td>{{ _("Gitweb") }}</td>
-                                                               <td>
-                                                                       <a href="{{ source.gitweb }}" target="_blank">
-                                                                               {{ source.gitweb }}
-                                                                       </a>
-                                                               </td>
-                                                       </tr>
-                                               {% end %}
-                                               <tr>
-                                                       <td>{{ _("Branch") }}</td>
-                                                       <td>{{ source.branch }}</td>
-                                               </tr>
-                                               <tr>
-                                                       <td>{{ _("Imported commits") }}</td>
-                                                       <td>{{ len(source) }}</td>
-                                               </tr>
-                                       </tbody>
-                               </table>
-                       </div>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       <h3>{{ _("Latest commits") }}</h3>
-               </div>
-       </div>
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       {% module CommitsTable(distro, source, commits) %}
-               </div>
-       </div>
-       <div class="row justify-content-end">
-               <div class="col-12 col-sm-12 col-md-4 col-lg-3 col-xl-3">
-                       <a class="btn btn-primary btn-block" href="/distro/{{ distro.identifier }}/source/{{ source.identifier }}/commits">
-                               {{ _("Show all commits") }}
-                       </a>
-               </div>
-       </div>
-{% end block %}
index 33bad7be1a732d07badc2087dc14699401d2d560..0a69875021c298da04af765ddcc187b2ba41f7b8 100644 (file)
@@ -157,15 +157,6 @@ class Application(tornado.web.Application):
                        (r"/distros/(?P<distro_slug>[A-Za-z0-9\-\.]+)/repos/(?P<repo_slug>[A-Za-z0-9\-]+)/mirrorlist",
                                repos.MirrorlistHandler),
 
-                       (r"/distro/([A-Za-z0-9\-\.]+)/source/([A-Za-z0-9\-\.]+)",
-                               distributions.DistroSourceDetailHandler),
-                       (r"/distro/([A-Za-z0-9\-\.]+)/source/([A-Za-z0-9\-\.]+)/commits",
-                               distributions.DistroSourceCommitsHandler),
-                       (r"/distro/([A-Za-z0-9\-\.]+)/source/([A-Za-z0-9\-\.]+)/([\w]{40})",
-                               distributions.DistroSourceCommitDetailHandler),
-                       (r"/distro/([A-Za-z0-9\-\.]+)/source/([A-Za-z0-9\-\.]+)/([\w]{40})/reset",
-                               distributions.DistroSourceCommitResetHandler),
-
                        # Mirrors
                        (r"/mirrors",                                   mirrors.MirrorListHandler),
                        (r"/mirror/new",                                mirrors.MirrorNewHandler),
index 3bd68f87fac975cf86ff7267655c61c0d68b4e25..e078ce8b467da2c523fc8d031d235805fe673cf0 100644 (file)
@@ -48,105 +48,6 @@ class EditHandler(base.BaseHandler):
                self.redirect("/distros/%s" % distro.slug)
 
 
-class DistroSourceDetailHandler(base.BaseHandler):
-       def get(self, slug, source_ident):
-               distro = self.backend.distros.get_by_slug(slug)
-               if not distro:
-                       raise tornado.web.HTTPError(404, "Distro not found")
-
-               source = distro.get_source(source_ident)
-               if not source:
-                       raise tornado.web.HTTPError(404, "Source '%s' not found in distro '%s'" \
-                               % (source_ident, distro.name))
-
-               # Get the latest commits.
-               commits = source.get_commits(limit=5)
-
-               self.render("distro-source-detail.html", distro=distro, source=source,
-                       commits=commits)
-
-
-class DistroSourceCommitsHandler(base.BaseHandler):
-       def get(self, slug, source_ident):
-               distro = self.backend.distros.get_by_slug(slug)
-               if not distro:
-                       raise tornado.web.HTTPError(404, "Distro not found")
-
-               source = distro.get_source(source_ident)
-               if not source:
-                       raise tornado.web.HTTPError(404, "Source '%s' not found in distro '%s'" \
-                               % (source_ident, distro.name))
-
-               offset = self.get_argument("offset", 0)
-               try:
-                       offset = int(offset)
-               except ValueError:
-                       offset = 0
-
-               limit  = self.get_argument("limit", 50)
-               try:
-                       limit = int(limit)
-               except ValueError:
-                       limit = 50
-
-               commits = source.get_commits(limit=limit, offset=offset)
-
-               self.render("distro-source-commits.html", distro=distro, source=source,
-                       commits=commits, limit=limit, offset=offset, number=50)
-
-
-class DistroSourceCommitDetailHandler(base.BaseHandler):
-       def get(self, slug, source_ident, commit_ident):
-               distro = self.backend.distros.get_by_slug(slug)
-               if not distro:
-                       raise tornado.web.HTTPError(404, "Distribution '%s' not found" % slug)
-
-               source = distro.get_source(source_ident)
-               if not source:
-                       raise tornado.web.HTTPError(404, "Source '%s' not found in distro '%s'" \
-                               % (source_ident, distro.name))
-
-               commit = source.get_commit(commit_ident)
-               if not commit:
-                       raise tornado.web.HTTPError(404, "Commit '%s' not found in source '%s'" \
-                               % (commit_ident, source.name))
-
-               self.render("distro-source-commit-detail.html", distro=distro,
-                       source=source, commit=commit)
-
-
-class DistroSourceCommitResetHandler(base.BaseHandler):
-       @tornado.web.authenticated
-       def get(self, slug, source_ident, commit_ident):
-               distro = self.backend.distros.get_by_slug(slug)
-               if not distro:
-                       raise tornado.web.HTTPError(404, "Distribution '%s' not found" % slug)
-
-               source = distro.get_source(source_ident)
-               if not source:
-                       raise tornado.web.HTTPError(404, "Source '%s' not found in distro '%s'" \
-                               % (source_ident, distro.name))
-
-               commit = source.get_commit(commit_ident)
-               if not commit:
-                       raise tornado.web.HTTPError(404, "Commit '%s' not found in source '%s'" \
-                               % (commit_ident, source.name))
-
-               if not self.current_user.is_admin():
-                       raise tornado.web.HTTPError(403)
-
-               confirmed = self.get_argument("confirmed", None)
-               if confirmed:
-                       commit.reset()
-
-                       self.redirect("/distro/%s/source/%s/%s" % \
-                               (distro.slug, source.identifier, commit.revision))
-                       return
-
-               self.render("distro-source-commit-reset.html", distro=distro,
-                       source=source, commit=commit)
-
-
 class ListModule(ui_modules.UIModule):
        def render(self, distros):
                return self.render_string("distros/modules/list.html", distros=distros)