]> git.ipfire.org Git - pbs.git/commitdiff
web: Drop BuildTable module and dependant modules
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2022 12:23:59 +0000 (12:23 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2022 12:25:42 +0000 (12:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/modules/build-table.html [deleted file]
src/templates/modules/jobs/status.html [deleted file]
src/web/__init__.py
src/web/ui_modules.py

index 25879dffc1bab496f4b0106fd5fa433ca9344515..4771b2fbe55fdab1cbf8fc08a557f39478d4be73 100644 (file)
@@ -247,7 +247,6 @@ dist_templates_mirrors_DATA = \
 templates_mirrorsdir = $(templatesdir)/mirrors
 
 dist_templates_modules_DATA = \
-       src/templates/modules/build-table.html \
        src/templates/modules/commits-table.html \
        src/templates/modules/commit-message.html \
        src/templates/modules/link-to-user.html \
@@ -257,8 +256,7 @@ dist_templates_modules_DATA = \
 templates_modulesdir = $(templatesdir)/modules
 
 dist_templates_modules_jobs_DATA = \
-       src/templates/modules/jobs/list.html \
-       src/templates/modules/jobs/status.html
+       src/templates/modules/jobs/list.html
 
 templates_modules_jobsdir = $(templates_modulesdir)/jobs
 
diff --git a/src/templates/modules/build-table.html b/src/templates/modules/build-table.html
deleted file mode 100644 (file)
index 418153e..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-{% if dates %}
-       <div class="table-responsive">
-               <table class="table table-striped table-hover">
-                       <tbody>
-                               {% for date, builds in dates %}
-                                       <tr>
-                                               <td colspan="{{ colspan }}">
-                                                       <h4>
-                                                               {% module HeadingDate(date) %}
-                                                               <small>({{ len(builds) }})</small>
-                                                       </h4>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <th>{{ _("Build") }}</th>
-                                               <th>{{ _("Jobs") }}</th>
-                                               {% if show_repo %}
-                                                       <th>{{ _("Repository") }}</th>
-                                               {% end %}
-                                               {% if show_user %}
-                                                       <th>{{ _("User") }}</th>
-                                               {% end %}
-                                               {% if show_when %}
-                                                       <th>{{ _("Created") }}</th>
-                                               {% end %}
-                                               {% if show_repo_time %}
-                                                       <th>{{ _("In repository since") }}</th>
-                                               {% end %}
-                                               {% if show_can_move_forward %}
-                                                       <th>{{ _("Can be moved forward") }}</th>
-                                               {% end %}
-                                       </tr>
-
-                                       {% for build in builds %}
-                                               <tr>
-                                                       <td class="name">
-                                                               <a class="{% module BuildState(build.type, build.state) %}"
-                                                                       href="/build/{{ build.uuid }}">
-                                                                       {% if build.is_broken() %}
-                                                                               <s>{{ build.name }}</s>
-                                                                       {% else %}
-                                                                               {{ build.name }}
-                                                                       {% end %}
-                                                               </a>
-                                                       </td>
-
-                                                       <td>
-                                                               {% module JobsStatus(build) %}
-                                                       </td>
-
-                                                       {% if show_repo %}
-                                                               <td>
-                                                                       {% if build.repo %}
-                                                                               <a href="/distro/{{ build.distro.identifier }}">{{ build.distro.name }}</a> /
-                                                                               <a href="/distro/{{ build.distro.identifier }}/repo/{{ build.repo.identifier }}">{{ build.repo.name }}</a>
-                                                                       {% end %}
-                                                               </td>
-                                                       {% end %}
-
-                                                       {% if show_user %}
-                                                               {% if build.type == "scratch" and build.user %}
-                                                                       <td>
-                                                                               {% module LinkToUser(build.user) %}
-                                                                       </td>
-                                                               {% elif build.type == "release" %}
-                                                                       <td>{% module LinkToUser(build.pkg.maintainer) %}</td>
-                                                               {% else %}
-                                                                       <td></td>
-                                                               {% end %}
-                                                       {% end %}
-
-                                                       {% if show_when %}
-                                                               <td>
-                                                                       {{ format_date(build.created, relative=True) }}
-                                                               </td>
-                                                       {% end %}
-
-                                                       {% if show_repo_time %}
-                                                               <td>
-                                                                       {{ format_date(build.repo_time, relative=False) }}
-                                                               </td>
-                                                       {% end %}
-
-                                                       {% if show_can_move_forward %}
-                                                               <td>
-                                                                       {{ build.can_move_forward }}
-                                                               </td>
-                                                       {% end %}
-                                               </tr>
-                                       {% end %}
-                               {% end %}
-                       </tbody>
-               </table>
-       </div>
-{% else %}
-       <p class="text-muted">
-               {{ _("There are no builds to show at this place right now.") }}
-       </p>
-{% end %}
diff --git a/src/templates/modules/jobs/status.html b/src/templates/modules/jobs/status.html
deleted file mode 100644 (file)
index 9bd496b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{% if jobs %}
-       {% for j in jobs %}
-               <a href="/job/{{ j.uuid }}" data-toggle="tooltip" data-placement="top" title="{% module JobState(j, plain=True) %}">
-                       {% module JobState(j, show_arch=True) %}
-               </a>
-       {% end %}
-{% else %}
-       <span class="text-muted">
-               {{ _("This build has got no jobs.") }}
-       </span>
-{% end %}
index e07e87760884475f29d84294d411be2d490cd5f9..b90730db56a882da974e25ae0bc444766ac68cb7 100644 (file)
@@ -42,9 +42,8 @@ class Application(tornado.web.Application):
                                # Bugs
                                "BugsList"           : bugs.ListModule,
 
+                               # Builds
                                "BuildsList"         : builds.ListModule,
-                               "BuildState"         : ui_modules.BuildState,
-                               "BuildTable"         : ui_modules.BuildTableModule,
 
                                # Events
                                "EventsList"         : events.ListModule,
@@ -54,7 +53,6 @@ class Application(tornado.web.Application):
 
                                # Jobs
                                "JobsList"           : ui_modules.JobsListModule,
-                               "JobsStatus"         : ui_modules.JobsStatusModule,
 
                                # Packages
                                "PackageInfo"        : packages.InfoModule,
@@ -68,12 +66,9 @@ class Application(tornado.web.Application):
 
                                "CommitMessage"      : ui_modules.CommitMessageModule,
                                "CommitsTable"       : ui_modules.CommitsTableModule,
-                               "JobState"           : ui_modules.JobStateModule,
                                "LinkToUser"         : ui_modules.LinkToUserModule,
                                "PackageFilesTable"  : ui_modules.PackageFilesTableModule,
                                "SourceTable"        : ui_modules.SourceTableModule,
-
-                               "HeadingDate"        : ui_modules.HeadingDateModule,
                        },
                        ui_methods = {
                                "extract_hostname"   : self.extract_hostname,
index 1743f66ed8337fea80b86c0b71db7588e6ef93b2..8b24e53db42db7abb2a00df3f194a3c438c0a839 100644 (file)
@@ -1,6 +1,5 @@
 #!/usr/bin/python
 
-import datetime
 import markdown
 import pygments
 import pygments.formatters
@@ -79,12 +78,6 @@ class CommitMessageModule(UIModule):
                return self.render_string("modules/commit-message.html", commit=commit)
 
 
-class JobsStatusModule(UIModule):
-       def render(self, build):
-               return self.render_string("modules/jobs/status.html",
-                       build=build, jobs=build.jobs)
-
-
 class CommitsTableModule(UIModule):
        def render(self, distro, source, commits, full_format=True):
                return self.render_string("modules/commits-table.html",
@@ -92,149 +85,12 @@ class CommitsTableModule(UIModule):
                        full_format=full_format)
 
 
-class HeadingDateModule(UIModule):
-       def render(self, date):
-               _ = self.locale.translate
-
-               # Check if this is today.
-               today = datetime.date.today()
-               if date == today:
-                       return _("Today")
-
-               # Check if this was yesterday.
-               yesterday = today - datetime.timedelta(days=1)
-               if date == yesterday:
-                       return _("Yesterday")
-
-               # Convert date to datetime.
-               date = datetime.datetime(date.year, date.month, date.day)
-
-               return self.locale.format_date(date, shorter=True, relative=False)
-
-
 class PackageFilesTableModule(UIModule):
        def render(self, pkg, filelist):
                return self.render_string("modules/packages-files-table.html",
                        pkg=pkg, filelist=filelist)
 
 
-class BuildTableModule(UIModule):
-       def render(self, builds, **kwargs):
-               settings = dict(
-                       show_user = False,
-                       show_repo = False,
-                       show_repo_time = False,
-                       show_can_move_forward = False,
-                       show_when = True,
-               )
-               settings.update(kwargs)
-
-               colspan = 2
-
-               for key in settings.keys():
-                       if settings.get(key) == True:
-                               colspan = colspan + 1
-
-               settings.setdefault("colspan", colspan)
-
-               dates = {}
-
-               for b in builds:
-                       try:
-                               dates[b.date].append(b)
-                       except KeyError:
-                               dates[b.date] = [b,]
-
-               dates = sorted(list(dates.items()), reverse=True)
-
-               return self.render_string("modules/build-table.html", dates=dates, **settings)
-
-
-class BuildState(UIModule):
-       def render(self, build_type, build_state):
-               if build_type == "release" and build_state == "stable":
-                       return """text-success"""
-               elif build_type == "release" and build_state == "unstable":
-                       return """text-danger"""
-               elif build_type == "release" and build_state == "testing":
-                       return """text-warning"""
-               elif build_type == "release" and build_state == "obsolete":
-                       return """text-muted"""
-               elif build_type == "scratch" and build_state == "stable":
-                       return """text-success font-italic"""
-               elif build_type == "scratch" and build_state == "unstable":
-                       return """text-danger font-italic"""
-               elif build_type == "scratch" and build_state == "testing":
-                       return """text-warning font-italic"""
-               elif build_type == "scratch" and build_state == "obsolete":
-                       return """text-muted font-italic"""
-
-
-class JobStateModule(UIModule):
-       def render(self, job, cls=None, show_arch=False, show_icon=False, plain=False):
-               state = job.state
-
-               _ = self.locale.translate
-               classes = []
-
-               classes.append("badge")
-
-               icon = None
-               if state == "aborted":
-                       text = _("Aborted")
-                       classes.append("badge-secondary")
-                       icon = "icon-warning-sign"
-
-               elif state == "dispatching":
-                       text = _("Dispatching")
-                       classes.append("badge-info")
-                       icon = "icon-download-alt"
-
-               elif state == "failed":
-                       text = _("Failed")
-                       classes.append("badge-danger")
-                       icon = "icon-remove"
-
-               elif state == "finished":
-                       text = _("Finished")
-                       classes.append("badge-success")
-                       icon = "icon-ok"
-
-               elif state == "pending":
-                       text = _("Pending")
-                       classes.append("badge-secondary")
-                       icon = "icon-time"
-
-               elif state == "running":
-                       text = _("Running")
-                       classes.append("badge-info")
-                       icon = "icon-cogs"
-
-               elif state == "uploading":
-                       text = _("Uploading")
-                       classes.append("badge-info")
-                       icon = "icon-upload-alt"
-
-               # Return just the string, is state is unknown.
-               else:
-                       text = _("Unknown: %s") % state
-                       classes.append("text-muted")
-
-               if plain:
-                       return text
-
-               if cls:
-                       classes.append(cls)
-
-               if show_arch:
-                       text = job.arch
-
-               if show_icon and icon:
-                       text = """<i class="%s"></i> %s""" % (icon, text)
-
-               return """<span class="%s">%s</span>""" % (" ".join(classes), text)
-
-
 class JobsListModule(UIModule):
        def render(self, jobs, show_arch_only=False, show_packages=False):
                return self.render_string("modules/jobs/list.html", jobs=jobs,