]> git.ipfire.org Git - pbs.git/commitdiff
builds: Add a new listing module
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Jun 2022 10:35:01 +0000 (10:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Jun 2022 10:35:01 +0000 (10:35 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/buildservice/builds.py
src/templates/builds/index.html
src/templates/builds/modules/list.html [new file with mode: 0644]
src/web/__init__.py
src/web/builds.py

index 2c9f9e13b449d48e1592682b212e70ae7f96e8f0..829512bf32478c5bf78f95590762002e289d60db 100644 (file)
@@ -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 \
index 42fe985ef5ea916159508088002b01240f2a5fd8..ecbdd36129490cdd931fdf6af594176dd0af6f30 100644 (file)
@@ -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.
index a19591cf5341aa06fdf0b01f9c24ffae8fde19dd..85720b1be79c0879c8c3b87a9494e4f58d62e297 100644 (file)
@@ -2,45 +2,20 @@
 
 {% block title %}{{ _("Builds") }}{% end block %}
 
-{% block body %}
+{% block container %}
+       <nav aria-label="{{ _("You are here:") }}" role="navigation">
+               <ul class="breadcrumbs">
+                       <li>
+                               <a href="/">{{ _("Home") }}</a>
+                       </li>
+                       <li>
+                               <span class="show-for-sr">{{ _("Current") }}: </span> {{ _("Builds") }}
+                       </li>
+               </ul>
+       </nav>
 
-       <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 active">
-                                               <a href="/builds">{{ _("Builds") }}</a>
-                                       </li>
-                               </ol>
-                       </nav>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-9 col-lg-10 col-xl-10">
-                       <h2 style="word-wrap: break-word;">
-                               {{ _("Builds") }}
-                       </h2>
-               </div>
-               <div class="col-12 col-sm-12 col-md-3 col-lg-2 col-xl-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">
-                                       <a class="dropdown-item" href="/builds/comments">
-                                               {{ _("Show Comments") }}
-                                       </a>
-                               </div>
-                       </div>
-               </div>
-       </div>
-
-       <div class="row">
-               <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                       {% module BuildTable(builds, show_user=True) %}
-               </div>
-       </div>
+       <h1>{{ _("Builds") }}</h1>
 
+       {# 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 (file)
index 0000000..cf748e7
--- /dev/null
@@ -0,0 +1,43 @@
+{% for build in builds %}
+       {% set package = build.pkg %}
+
+       <div class="callout">
+               <h5>
+                       <a href="/builds/{{ build.uuid }}">{{ build }}</a>
+
+                       {% if package.summary %}
+                               <small>{{ package.summary }}</small>
+                       {% end %}
+               </h5>
+
+               {% if build.jobs %}
+                       <p>
+                               {% for job in build.jobs %}
+                                       <span class="label
+                                               {% if job.failed %}
+                                                       danger
+                                               {% elif job.is_running() %}
+                                                       primary
+                                               {% elif job.has_finished() %}
+                                                       success
+                                               {% else %}
+                                                       secondary
+                                               {% end %}">{{ job.arch }}</span>
+                               {% end %}
+                       </p>
+               {% end %}
+
+               <small>
+                       {% 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 %}
+               </small>
+
+               {# XXX show repository #}
+       </div>
+{% end %}
index 2df8973b5fff553cc5abef95c13e267f5b6e8081..30cc23b4cc36d063a07868f2ad2af30b15a82e2a 100644 (file)
@@ -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,
 
index e1141e755d7ec864aead3d1715983a01fb09b132..91bfb46bb5cbe4f0d46d856f262ab1fb7efff3b7 100644 (file)
@@ -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)