From: Michael Tremer Date: Sun, 23 Oct 2022 12:23:59 +0000 (+0000) Subject: web: Drop BuildTable module and dependant modules X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a7bf2e633badb05c2d5a8cfeb4ef9468d647a3b;p=pbs.git web: Drop BuildTable module and dependant modules Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 25879dff..4771b2fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 418153ef..00000000 --- a/src/templates/modules/build-table.html +++ /dev/null @@ -1,99 +0,0 @@ -{% if dates %} -
- - - {% for date, builds in dates %} - - - - - - - {% if show_repo %} - - {% end %} - {% if show_user %} - - {% end %} - {% if show_when %} - - {% end %} - {% if show_repo_time %} - - {% end %} - {% if show_can_move_forward %} - - {% end %} - - - {% for build in builds %} - - - - - - {% if show_repo %} - - {% end %} - - {% if show_user %} - {% if build.type == "scratch" and build.user %} - - {% elif build.type == "release" %} - - {% else %} - - {% end %} - {% end %} - - {% if show_when %} - - {% end %} - - {% if show_repo_time %} - - {% end %} - - {% if show_can_move_forward %} - - {% end %} - - {% end %} - {% end %} - -
-

- {% module HeadingDate(date) %} - ({{ len(builds) }}) -

-
{{ _("Build") }}{{ _("Jobs") }}{{ _("Repository") }}{{ _("User") }}{{ _("Created") }}{{ _("In repository since") }}{{ _("Can be moved forward") }}
- - {% if build.is_broken() %} - {{ build.name }} - {% else %} - {{ build.name }} - {% end %} - - - {% module JobsStatus(build) %} - - {% if build.repo %} - {{ build.distro.name }} / - {{ build.repo.name }} - {% end %} - - {% module LinkToUser(build.user) %} - {% module LinkToUser(build.pkg.maintainer) %} - {{ format_date(build.created, relative=True) }} - - {{ format_date(build.repo_time, relative=False) }} - - {{ build.can_move_forward }} -
-
-{% else %} -

- {{ _("There are no builds to show at this place right now.") }} -

-{% end %} diff --git a/src/templates/modules/jobs/status.html b/src/templates/modules/jobs/status.html deleted file mode 100644 index 9bd496bd..00000000 --- a/src/templates/modules/jobs/status.html +++ /dev/null @@ -1,11 +0,0 @@ -{% if jobs %} - {% for j in jobs %} - - {% module JobState(j, show_arch=True) %} - - {% end %} -{% else %} - - {{ _("This build has got no jobs.") }} - -{% end %} diff --git a/src/web/__init__.py b/src/web/__init__.py index e07e8776..b90730db 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -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, diff --git a/src/web/ui_modules.py b/src/web/ui_modules.py index 1743f66e..8b24e53d 100644 --- a/src/web/ui_modules.py +++ b/src/web/ui_modules.py @@ -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 = """ %s""" % (icon, text) - - return """%s""" % (" ".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,