]> git.ipfire.org Git - pbs.git/commitdiff
web: Drop more unused UI modules
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 13 Oct 2022 10:46:54 +0000 (10:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 13 Oct 2022 10:46:54 +0000 (10:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/modules/jobs-table.html [deleted file]
src/templates/modules/package-header.html [deleted file]
src/templates/modules/package-table-detail.html [deleted file]
src/templates/modules/packages-table.html [deleted file]
src/templates/modules/repo-actions-table.html [deleted file]
src/templates/modules/watchers-sidebar-table.html [deleted file]
src/web/__init__.py
src/web/ui_modules.py

index 889f7ae809bf458ae5be807b3c8ae8c8ab578040..d43aed563db936f4eba8425b2b18d8487ff94573 100644 (file)
@@ -269,21 +269,15 @@ dist_templates_modules_DATA = \
        src/templates/modules/commits-table.html \
        src/templates/modules/commit-message.html \
        src/templates/modules/files-table.html \
-       src/templates/modules/jobs-table.html \
        src/templates/modules/link-to-user.html \
        src/templates/modules/log-files-table.html \
        src/templates/modules/modal-base.html \
        src/templates/modules/modal-build-comment.html \
        src/templates/modules/modal-build-push.html \
        src/templates/modules/modal-build-unpush.html \
-       src/templates/modules/package-header.html \
        src/templates/modules/packages-files-table.html \
-       src/templates/modules/packages-table.html \
-       src/templates/modules/package-table-detail.html \
-       src/templates/modules/repo-actions-table.html \
        src/templates/modules/source-table.html \
-       src/templates/modules/text.html \
-       src/templates/modules/watchers-sidebar-table.html
+       src/templates/modules/text.html
 
 templates_modulesdir = $(templatesdir)/modules
 
diff --git a/src/templates/modules/jobs-table.html b/src/templates/modules/jobs-table.html
deleted file mode 100644 (file)
index 4414872..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<!--
-       The documentation says <table class="table table-striped table-hover table-responsive">
-       but we have to use a div class instead to get the table width enough
--->
-<div class="table-responsive">
-       <table class="table table-striped table-hover">
-               <thead>
-                       <tr>
-                               <th scope="col">{{ _("Arch") }}</th>
-                               <th scope="col">{{ _("State") }}</th>
-                               <th scope="col">{{ _("Host") }}</th>
-                               <th scope="col">{{ _("Duration") }}</th>
-                       </tr>
-               </thead>
-               <tbody>
-                       {% if jobs %}
-                               {% for job in jobs %}
-                                       <tr>
-                                               <td>
-                                                       <a href="/job/{{ job.uuid }}">{{ job.arch }}</a>
-                                               </td>
-                                               <td>
-                                                       {% if job.state == "pending" %}
-                                                               {{ _("Pending") }}
-                                                       {% elif job.state == "failed" %}
-                                                               {{ _("Failed") }}
-                                                       {% elif job.state == "dispatching" %}
-                                                               {{ _("Dispatching") }}
-                                                       {% elif job.state == "finished" %}
-                                                               {{ _("Finished") }}
-                                                       {% elif job.state == "running" %}
-                                                               {{ _("Running") }}
-                                                       {% elif job.state == "aborted" %}
-                                                               {{ _("Aborted") }}
-                                                       {% else %}
-                                                               {{ job.state }}
-                                                       {% end %}
-                                               </td>
-                                               <td>
-                                                       {% if job.builder %}
-                                                               <a href="/builders/{{ job.builder.name }}">{{ job.builder.name }}</a>
-                                                       {% else %}
-                                                               {{ _("N/A") }}
-                                                       {% end %}
-                                               </td>
-                                               <td>
-                                                       {% if job.state == "running" %}
-                                                               {{ _("Running since %s") % friendly_time(job.duration) }}
-                                                       {% elif job.duration %}
-                                                               {{ friendly_time(job.duration) }}
-                                                       {% else %}
-                                                               {{ _("Not finished, yet.") }}
-                                                       {% end %}
-                                               </td>
-                                       </tr>
-                               {% end %}
-
-                               {% if not build.supported_arches == "all" %}
-                                       <tr>
-                                               <td colspan="4">
-                                                       {{ _("This package only supports %s.") % locale.list(build.supported_arches.split()) }}
-                                               </td>
-                                       </tr>
-                               {% end %}
-                       {% else %}
-                               <tr>
-                                       <td colspan="4">{{ _("No jobs, yet.") }}</td>
-                               </tr>
-                       {% end %}
-               </tbody>
-       </table>
-</div>
diff --git a/src/templates/modules/package-header.html b/src/templates/modules/package-header.html
deleted file mode 100644 (file)
index 6308bd4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<p class="lead">
-       {% module Text(pkg.description) %}
-</p>
-
-<div class="table-responsive">
-       <table class="table table-hover table-sm">
-               <tbody>
-                       {% if pkg.url %}
-                               <tr>
-                                       <th >{{ _("Home") }}</th>
-                                       <td>{% raw linkify(pkg.url, shorten=True) %}</td>
-                               </tr>
-                       {% end %}
-                       {% if pkg.license %}
-                               <tr>
-                                       <th >{{ _("License") }}</th>
-                                       <td>{{ pkg.license }}</td>
-                               </tr>
-                       {% end %}
-
-                       {% if pkg.groups %}
-                               <tr>
-                                       <th >{{ _("Group", "Groups", len(pkg.groups)) }}</th>
-                                       <td>{{ locale.list(pkg.groups) }}</td>
-                               </tr>
-                       {% end %}
-
-                       {% if pkg.maintainer %}
-                               <tr>
-                                       <th >{{ _("Maintainer") }}</th>
-                                       <td>{% module LinkToUser(pkg.maintainer) %}</td>
-                               </tr>
-                       {% end %}
-
-               </tbody>
-         </table>
-</div>
\ No newline at end of file
diff --git a/src/templates/modules/package-table-detail.html b/src/templates/modules/package-table-detail.html
deleted file mode 100644 (file)
index 318e80d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<ul class="packages">
-       {% for pkg in packages %}
-               <li>
-                       <a href="/package/{{ pkg.name }}/{{ pkg.epoch }}/{{ pkg.version }}/{{ pkg.release }}">{{ pkg.friendly_name }}</a>
-               </li>
-       {% end %}
-</ul>
diff --git a/src/templates/modules/packages-table.html b/src/templates/modules/packages-table.html
deleted file mode 100644 (file)
index 34b3682..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<div class="table-responsive mb-2">
-       <table class="table table-striped table-hover">
-               <thead>
-                       <tr>
-                               <th>{{ _("Name") }}</th>
-                               <th>{{ _("Summary") }}</th>
-                               <th>{{ _("Size") }}</th>
-                               <th>&nbsp;</th>
-                       </tr>
-               </thead>
-               <tbody>
-                       {% for package in packages %}
-                               <tr>
-                                       <td>
-                                               <a href="/package/{{ package.uuid }}">{{ package.friendly_name }}</a>
-                                       </td>
-                                       <td>{{ package.summary }}</td>
-                                       <td>{{ format_size(package.filesize) }}</td>
-                                       <td>
-                                               <a class="btn btn-light" href="{{ job.build.download_prefix }}/{{ package.path }}">
-                                                       <i class="icon-download"></i>{{ _("Download") }}
-                                               </a>
-                                       </td>
-                               </tr>
-                       {% end %}
-               </tbody>
-       </table>
-</div>
\ No newline at end of file
diff --git a/src/templates/modules/repo-actions-table.html b/src/templates/modules/repo-actions-table.html
deleted file mode 100644 (file)
index a59611e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<div class="repo-actions">
-       {% for action in actions %}
-               <div class="action {{ action.action }}" id="action-{{ action.id }}">
-                       <a id="action-link-{{ action.id }}" href="#">{{ action.pkg.friendly_name }}</a>
-                       {{ _("added %s") % locale.format_date(action.time_added) }}
-
-                       {% if current_user and action.have_permission(current_user) %}
-                               <p class="buttons">
-                                       {% if action.is_doable() %}
-                                               <a href="javascript:action_run({{ action.id }})">{{ _("Run") }}</a>
-                                       {% end %}
-                                       <a href="?action=remove">{{ _("Remove action") }}</a>
-                               </p>
-                       {% end %}
-
-                       <div id="action-info-{{ action.id }}">
-                               <p>
-                                       {% if action.score_needed %}
-                                               {{ _("One more score needed.", "%(score)s more scores needed.", action.score_needed) % { "score" : action.score_needed } }}
-                                       {% else %}
-                                               {{ _("No more scores needed.") }}
-                                       {% end %}
-                                       <br />
-                                       {% if action.pkg.maintainer %}
-                                               {{ _("Maintainer: %s") % action.pkg.maintainer }}
-                                               <br />
-                                       {% end %}
-                                       <a href="/package/{{ action.pkg.name }}/{{ action.pkg.epoch }}/{{ action.pkg.version }}/{{ action.pkg.release }}">{{ _("Go to package description") }}</a>
-                                       <br />
-                               </p>
-                       </div>
-
-                       <script>
-                               $(function() {
-                                       $("#action-info-{{ action.id }}").hide();
-                                       $("#action-link-{{ action.id }}").toggle(
-                                               function() { $("#action-info-{{ action.id }}").show(); },
-                                               function() { $("#action-info-{{ action.id }}").hide(); }
-                                       );
-                               });
-                       </script>
-               </div>
-       {% end %}
-</div>
-<div style="clear: both;">&nbsp;</div>
diff --git a/src/templates/modules/watchers-sidebar-table.html b/src/templates/modules/watchers-sidebar-table.html
deleted file mode 100644 (file)
index 122e327..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<p>
-       <a href="#watchers" data-toggle="modal">
-               {% if current_user and current_user in watchers %}
-                       {% if len(watchers) == 1 %}
-                               {{ _("You.") }}
-                       {% elif len(watchers) == 2 %}
-                               {{ _("You and one other.") }}
-                       {% else %}
-                               {{ _("You and %s others.") % (len(watchers) - 1) }}
-                       {% end %}
-               {% else %}
-                       {{ _("One person.", "%(num)s people.", len(watchers)) % { "num" : len(watchers) } }}
-               {% end %}
-       </a>
-</p>
-
-<div class="modal fade" id="watchers" tabindex="-1">
-       <div class="modal-dialog modal-lg" role="document">
-               <div class="modal-content">
-                       <div class="modal-header">
-                               <h3 style="word-wrap: break-word;" class="modal-title" id="watchers">
-                                               {{ _("Watchers of %s") % build.name }}
-                               </h3>
-                               <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-                                       <span aria-hidden="true">&times;</span>
-                               </button>
-                       </div>
-                       <div class="modal-body">
-                               <p>
-                                       {{ _("All users who watch this build will be automatically notified about status changes and comments.") }}
-                                       {{ _("This is an easy way of staying up to date.") }}
-                               </p>
-                               <hr/>
-
-                               {% if watchers %}
-                                       <ul>
-                                               {% if current_user and current_user in watchers %}
-                                                       <li>
-                                                               <strong>{{ _("You.") }}</strong>
-                                                       </li>
-                                               {% end %}
-
-                                               {% for watcher in [w for w in watchers if current_user and not w == current_user] %}
-                                                       <li>
-                                                               <a href="/user/{{ watcher.name }}">{{ watcher.realname }}</a>
-                                                       </li>
-                                               {% end %}
-                                       </ul>
-                               {% else %}
-                                       <p>
-                                               {{ _("Nobody watches this build, yet. Be the first one.") }}
-                                       </p>
-                               {% end %}
-                       </div>
-
-                       <div class="modal-footer">
-                               <div class="float-right" style="width:100%">
-                                       {% if current_user %}
-                                               {% if not current_user in watchers %}
-                                                       <a class="btn btn-primary mb-2" href="/build/{{ build.uuid }}/watch">{{ _("Watch this build") }}</a>
-                                               {% end %}
-                                               {% if current_user.is_admin() %}
-                                                       <a class="btn btn-primary mb-2" href="/build/{{ build.uuid }}/watch">{{ _("Add a watcher") }}</a>
-                                               {% end %}
-                                       {% end %}
-                                       <a class="btn mb-2" data-dismiss="modal">
-                                               {{ _("Close") }}
-                                       </a>
-                               </div>
-                       </div>
-               </div>
-       </div>
-</div>
index 31c5f136242462bc93cacc3f2c45b99cdc059773..b8110b3d8b976f46496500a900b305ad5e8c94f6 100644 (file)
@@ -74,17 +74,11 @@ class Application(tornado.web.Application):
                                "CommitMessage"      : ui_modules.CommitMessageModule,
                                "CommitsTable"       : ui_modules.CommitsTableModule,
                                "JobState"           : ui_modules.JobStateModule,
-                               "JobsTable"          : ui_modules.JobsTableModule,
                                "FilesTable"         : ui_modules.FilesTableModule,
                                "LinkToUser"         : ui_modules.LinkToUserModule,
                                "LogFilesTable"      : ui_modules.LogFilesTableModule,
-                               "PackagesTable"      : ui_modules.PackagesTableModule,
-                               "PackageTable2"      : ui_modules.PackageTable2Module,
-                               "PackageHeader"      : ui_modules.PackageHeaderModule,
                                "PackageFilesTable"  : ui_modules.PackageFilesTableModule,
-                               "RepoActionsTable"   : ui_modules.RepoActionsTableModule,
                                "SourceTable"        : ui_modules.SourceTableModule,
-                               "WatchersSidebarTable" : ui_modules.WatchersSidebarTableModule,
 
                                "HeadingDate"        : ui_modules.HeadingDateModule,
 
index 1361efd98572c88f1a200e92151419a9a58fd03e..56def25b26a074a8dd546e26830f2113914f07de 100644 (file)
@@ -122,18 +122,6 @@ class HeadingDateModule(UIModule):
                return self.locale.format_date(date, shorter=True, relative=False)
 
 
-class PackagesTableModule(UIModule):
-       def render(self, job, packages):
-               return self.render_string("modules/packages-table.html", job=job,
-                       packages=packages)
-
-
-class PackageTable2Module(UIModule):
-       def render(self, packages):
-               return self.render_string("modules/package-table-detail.html",
-                       packages=packages)
-
-
 class FilesTableModule(UIModule):
        def render(self, files):
                return self.render_string("modules/files-table.html", files=files)
@@ -145,11 +133,6 @@ class LogFilesTableModule(UIModule):
                        files=files)
 
 
-class PackageHeaderModule(UIModule):
-       def render(self, pkg):
-               return self.render_string("modules/package-header.html", pkg=pkg)
-
-
 class PackageFilesTableModule(UIModule):
        def render(self, pkg, filelist):
                return self.render_string("modules/packages-files-table.html",
@@ -277,15 +260,6 @@ class JobStateModule(UIModule):
                return """<span class="%s">%s</span>""" % (" ".join(classes), text)
 
 
-class JobsTableModule(UIModule):
-       def render(self, build, jobs=None, type="release"):
-               if jobs is None:
-                       jobs = build.jobs
-
-               return self.render_string("modules/jobs-table.html", build=build,
-                       jobs=jobs, type=type)
-
-
 class JobsListModule(UIModule):
        def render(self, jobs, show_arch_only=False, show_packages=False):
                return self.render_string("modules/jobs/list.html", jobs=jobs,
@@ -308,23 +282,6 @@ class BuildOffsetModule(UIModule):
                return self.render_string("modules/build-offset.html")
 
 
-class RepoActionsTableModule(UIModule):
-       def render(self, repo):
-               actions = repo.get_actions()
-
-               return self.render_string("modules/repo-actions-table.html",
-                       repo=repo, actions=actions)
-
-
-class WatchersSidebarTableModule(UIModule):
-       def render(self, build, watchers, limit=5):
-               # Sort the watchers by their realname.
-               watchers.sort(key=lambda watcher: watcher.realname)
-
-               return self.render_string("modules/watchers-sidebar-table.html",
-                       build=build, watchers=watchers, limit=limit)
-
-
 class SelectLocaleModule(UIModule):
        LOCALE_NAMES = [
                # local code, English name, name