From: Michael Tremer Date: Tue, 11 Feb 2025 18:06:57 +0000 (+0000) Subject: builds: Make the list cleaner X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2155e8c84cd6a0d9c77476a78d62e442670e8b84;p=pbs.git builds: Make the list cleaner Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index d6cf3731..34fd8237 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -462,6 +462,19 @@ class Build(database.Base, database.BackendMixin, database.SoftDeleteMixin): owner = sqlalchemy.orm.relationship("User", foreign_keys=[owner_id], lazy="joined") + # Is this a scratch build? + + def is_scratch(self): + # We must have an owner + if self.owner is None: + return False + + # Test builds don't count as scratch builds + if self.is_test(): + return False + + return True + # Repo ID repo_id = Column(Integer, ForeignKey("repositories.id"), nullable=False) diff --git a/src/templates/builds/macros.html b/src/templates/builds/macros.html index 4f15ac8e..63120d5d 100644 --- a/src/templates/builds/macros.html +++ b/src/templates/builds/macros.html @@ -34,97 +34,99 @@ {% endif %} - {% if build.jobs %} -
- {% for job in build.jobs | sort %} - {# Pending #} - {% if job.is_pending() %} - - - - + + + + + {{ build }} + + + + + + {# Scratch Build? #} + {% if build.is_scratch() %} + +
+ {{ Avatar(build.owner, size=48) }} +
+
+ {% endif %} + + + + {% for job in build.jobs | sort %} + {# Pending #} + {% if job.is_pending() %} + + + + + + + {{ job.arch }} + - {{ job.arch }} - - + {# Running #} + {% elif job.is_running() %} + + + + + - {# Running #} - {% elif job.is_running() %} - - - - + {{ job.arch }} + - {{ job.arch }} - - + {# Failed #} + {% elif job.has_failed() %} + + + + + - {# Failed #} - {% elif job.has_failed() %} - - - - + {{ job.arch }} + - {{ job.arch }} - - + {# Aborted #} + {% elif job.is_aborted() %} + + + + + - {# Aborted #} - {% elif job.is_aborted() %} - - - - + {{ job.arch }} + - {{ job.arch }} - - + {# Finished #} + {% elif job.has_finished() %} + + + + + - {# Finished #} - {% elif job.has_finished() %} - - - - + {{ job.arch }} + - {{ job.arch }} - - - - {# Unknown State #} - {% else %} - - {{ _("Unknown State") }} - {{ job.arch }} - - {% endif %} - {% endfor %} -
- {% endif %} - - - {{ build }} - - - {% if not shorter %} -

- - {% if build.owner %} - {{ _("Created %(when)s by %(owner)s") % { - "when" : locale.format_date(build.created_at, shorter=True), - "owner" : build.owner, - } }} - {% else %} - {{ _("Created %s") % locale.format_date(build.created_at, shorter=True) }} - {% endif %} - -

- {% endif %} + {# Unknown State #} + {% else %} + + {{ _("Unknown State") }} - {{ job.arch }} + + {% endif %} + {% endfor %} + + + +
{% endfor %}