From: Michael Tremer Date: Wed, 22 Jun 2022 10:35:01 +0000 (+0000) Subject: builds: Add a new listing module X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79a4d9b2a6ad97106cf4d0cb6d0eff6c1412944f;p=pbs.git builds: Add a new listing module Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 2c9f9e13..829512bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -213,6 +213,11 @@ dist_templates_builds_DATA = \ templates_buildsdir = $(templatesdir)/builds +dist_templates_builds_modules_DATA = \ + src/templates/builds/modules/list.html + +templates_builds_modulesdir = $(templates_buildsdir)/modules + dist_templates_errors_DATA = \ src/templates/errors/error.html \ src/templates/errors/error-400.html \ diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index 42fe985e..ecbdd361 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -359,6 +359,10 @@ class Build(base.DataObject): """ return self.data.type + @property + def time_created(self): + return self.data.time_created + def get_owner(self): """ The owner of this build. diff --git a/src/templates/builds/index.html b/src/templates/builds/index.html index a19591cf..85720b1b 100644 --- a/src/templates/builds/index.html +++ b/src/templates/builds/index.html @@ -2,45 +2,20 @@ {% block title %}{{ _("Builds") }}{% end block %} -{% block body %} +{% block container %} + -
- -
- -
-
-

- {{ _("Builds") }} -

-
-
- -
-
- -
-
- {% module BuildTable(builds, show_user=True) %} -
-
+

{{ _("Builds") }}

+ {# Render all builds #} + {% module BuildsList(builds) %} {% end block %} diff --git a/src/templates/builds/modules/list.html b/src/templates/builds/modules/list.html new file mode 100644 index 00000000..cf748e71 --- /dev/null +++ b/src/templates/builds/modules/list.html @@ -0,0 +1,43 @@ +{% for build in builds %} + {% set package = build.pkg %} + +
+
+ {{ build }} + + {% if package.summary %} + {{ package.summary }} + {% end %} +
+ + {% if build.jobs %} +

+ {% for job in build.jobs %} + {{ job.arch }} + {% end %} +

+ {% end %} + + + {% if build.owner %} + {{ _("Created %(when)s by %(author)s") % { + "when" : locale.format_date(build.time_created, shorter=True), + "author" : build.owner, + } }} + {% else %} + {{ _("Created %s") % locale.format_date(build.time_created, shorter=True) }} + {% end %} + + + {# XXX show repository #} +
+{% end %} diff --git a/src/web/__init__.py b/src/web/__init__.py index 2df8973b..30cc23b4 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -43,6 +43,7 @@ class Application(tornado.web.Application): "LogEntryComment" : ui_modules.LogEntryCommentModule, "BuildHeadline" : ui_modules.BuildHeadlineModule, + "BuildsList" : builds.ListModule, "BuildStateWarnings" : ui_modules.BuildStateWarningsModule, "BuildState" : ui_modules.BuildState, diff --git a/src/web/builds.py b/src/web/builds.py index e1141e75..91bfb46b 100644 --- a/src/web/builds.py +++ b/src/web/builds.py @@ -3,7 +3,7 @@ import tornado.web from . import base - +from . import ui_modules class BuildBaseHandler(base.BaseHandler): def get_build(self, uuid): @@ -372,3 +372,8 @@ class BuildListHandler(base.BaseHandler): limit=25) self.render("build-list.html", builds=builds) + + +class ListModule(ui_modules.UIModule): + def render(self, builds): + return self.render_string("builds/modules/list.html", builds=builds)