From 96afa49a40feecf91f77412293f69001e4839d58 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 12 Feb 2025 15:22:11 +0000 Subject: [PATCH] jobs: Unify the job listing There used to be a separate listing for the job queue which is not necessary as we can unify them. Signed-off-by: Michael Tremer --- src/templates/index.html | 4 +- src/templates/jobs/index.html | 4 +- src/templates/jobs/macros.html | 343 ++++++++++++++++----------------- src/templates/jobs/queue.html | 4 +- 4 files changed, 170 insertions(+), 185 deletions(-) diff --git a/src/templates/index.html b/src/templates/index.html index 40b65f2d..d0fa7d83 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% from "jobs/macros.html" import JobQueue with context %} +{% from "jobs/macros.html" import JobList with context %} {% from "users/macros.html" import UserPushSubscribeButton with context %} {% block title %}{{ _("Welcome!") }}{% endblock %} @@ -53,7 +53,7 @@
- {{ JobQueue(jobs) }} + {{ JobList(jobs) }}
diff --git a/src/templates/jobs/index.html b/src/templates/jobs/index.html index 07a240ce..457f3f18 100644 --- a/src/templates/jobs/index.html +++ b/src/templates/jobs/index.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% from "jobs/macros.html" import JobQueue with context %} +{% from "jobs/macros.html" import JobList with context %} {% block title %}{{ _("Recent Jobs") }}{% endblock %} @@ -44,7 +44,7 @@

{{ date | format_day }}

- {{ JobQueue(items) }} + {{ JobList(items) }}
{% endfor %} diff --git a/src/templates/jobs/macros.html b/src/templates/jobs/macros.html index 27fd885a..a0cdd7ae 100644 --- a/src/templates/jobs/macros.html +++ b/src/templates/jobs/macros.html @@ -19,202 +19,187 @@ ##############################################################################} {% macro JobList(jobs, show_arch_only=False) %} - {% for job in jobs | sort %} - {% set build = job.build %} - -
-
-
-
-
-
- {% if show_arch_only %} - {{ job.arch }} - {% else %} - - {{ job }} - +
+ {% for job in jobs | sort %} +
+
+
+
+ + {# Halted #} + {% if job.is_halted() %} + + + {# Queued #} + {% elif job.is_queued() %} + + + {# Dependency Problems #} + {% elif job.is_pending(installcheck=False) %} + + + {# Pending #} + {% elif job.is_pending() %} + + + {# Running #} + {% elif job.is_running() %} + + + {# Aborted #} + {% elif job.is_aborted() %} + + + {# Failed #} + {% elif job.has_failed() %} + + + {# Finished #} + {% elif job.has_finished() %} + {% endif %} -
+
-
- {% if job.is_halted() %} - {{ _("Halted") }} - {% elif job.is_queued() %} - {{ _("Queued") }} - {% elif job.is_pending(installcheck=False) %} - {{ _("Dependency Problems") }} - {% elif job.is_pending() %} - {{ _("Pending") }} - {% elif job.is_running() %} - {{ _("Running...") }} - {% elif job.is_aborted() %} - {{ _("Aborted") }} - {% elif job.has_failed() %} - {{ _("Failed") }} - {% elif job.has_finished() %} - {{ _("Finished") }} - {% endif %} +
+
+
+ {% if show_arch_only %} + {{ job.arch }} + {% else %} + + {{ job }} + + {% endif %} +
+ + {# Running #} + {% if job.is_running() %} +

+ + {{ _("Started %s...") % job.started_at | format_date(shorter=True) }} + +

+ + {# Aborted #} + {% elif job.is_aborted() %} +

+ + {% set args = { + "when" : job.aborted_at | format_date(shorter=True), + "who" : job.aborted_by, + } %} + + {% if job.aborted_by %} + {{ _("Was aborted %(when)s by %(who)s") % args }} + {% else %} + {{ _("Was automatically aborted %(when)s") % args }} + {% endif %} + +

+ + {# Failed #} + {% elif job.has_failed() %} +

+ + {{ _("Failed %s") % job.finished_at | format_date(shorter=True) }} + +

+ + {# Finished #} + {% elif job.has_finished() %} +

+ + {{ _("Finished %s") % job.finished_at | format_date(shorter=True) }} + +

+ {% endif %} +
-
- {# Log #} - {% if job.is_running() %} -
- {{ JobLogStream(job, limit=5) }} -
- - {# Dependency Issues #} - {% elif job.is_pending() and job.installcheck_succeeded is false %} -
-
    - {% for line in job.message.splitlines() %} -
  • {{ line }}
  • - {% endfor %} -
-
- {% endif %} - - {% if job.is_running() or job.has_finished() %} -
-
-
-
- {{ job.duration | format_time }} - - {# If the job is approaching its timeout, we will show a warning #} - {% if job.times_out_in and job.times_out_in <= datetime.timedelta(hours=1) %} - / {{ job.timeout | format_time }} - {% endif %} -
+
+ {# Retry? #} + {% if job.can_be_retried() %} + -
-
-
- {% if job.show_log() %} - {% if job.preceeding_jobs %} - - {% else %} - - {{ _("View Log") }} - - {% endif %} - {% endif %} + {# Abort? #} + {% elif job.is_running() %} + + {% endif %} - {% if job.can_be_retried() %} - - {{ _("Retry") }} - - {% elif job.is_running() %} - - {{ _("Abort") }} + {# Logs #} + {% if job.show_log() %} +
+ {% if job.preceeding_jobs %} + -
+ {% else %} + + + + + + {% endif %}
-
-
- {% endif %} -
-
- {% endfor %} -{% endmacro %} + {% endif %} -{% macro JobQueue(jobs) %} -
{% endfor %} - +
{% endmacro %} {% macro JobLogStream(job, small=False, limit=None) %} diff --git a/src/templates/jobs/queue.html b/src/templates/jobs/queue.html index 4d265bed..ce63091e 100644 --- a/src/templates/jobs/queue.html +++ b/src/templates/jobs/queue.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% from "jobs/macros.html" import JobQueue with context %} +{% from "jobs/macros.html" import JobList with context %} {% block title %}{{ _("Job Queue") }}{% endblock %} @@ -29,7 +29,7 @@
- {{ JobQueue(queue) }} + {{ JobList(queue) }}
{% endblock %} -- 2.47.3