From: Michael Tremer Date: Tue, 25 Oct 2022 11:52:44 +0000 (+0000) Subject: events: Show deprecated builds X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdfd27cfe8b29a2f877d9e762c5cae52c4527c51;p=pbs.git events: Show deprecated builds Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/events.py b/src/buildservice/events.py index 767f5c07..b37a15d3 100644 --- a/src/buildservice/events.py +++ b/src/buildservice/events.py @@ -39,6 +39,8 @@ log = logging.getLogger("pakfire.buildservice.events") # t (timestamp) # priority # build +# by_build +# build_comment # user # by_user # @@ -50,6 +52,7 @@ EVENTS_VIEW = """ builds.created_at AS t, 4 AS priority, builds.id AS build, + NULL::integer AS by_build, NULL::integer AS build_comment, NULL::integer AS user, builds.owner_id AS by_user @@ -72,6 +75,7 @@ EVENTS_VIEW = """ ELSE 4 END AS priority, builds.id AS build, + NULL AS by_build, NULL AS build_comment, NULL AS user, NULL AS by_user @@ -88,6 +92,7 @@ EVENTS_VIEW = """ builds.deleted_at AS t, 4 AS priority, builds.id AS build, + NULL AS by_build, NULL AS build_comment, NULL AS user, builds.deleted_by AS by_user @@ -98,12 +103,37 @@ EVENTS_VIEW = """ UNION ALL + -- Deprecated Builds + + SELECT + 'build-deprecated' AS type, + deprecated_builds.created_at AS t, + 4 AS priority, + builds.id AS build, + builds.deprecated_by AS by_build, + NULL AS build_comment, + NULL AS user, + builds.owner_id AS by_user + FROM + builds + LEFT JOIN + builds deprecated_builds ON builds.deprecated_by = deprecated_builds.id + WHERE + builds.deleted_at IS NULL + AND + deprecated_builds.deleted_at IS NULL + AND + builds.deprecated_by IS NOT NULL + + UNION ALL + -- Build Comments SELECT 'build-comment' AS type, build_comments.created_at AS t, 4 AS priority, build_comments.build_id AS build, + NULL AS by_build, build_comments.id AS build_comment, NULL AS user, build_comments.user_id AS by_user @@ -120,6 +150,7 @@ EVENTS_VIEW = """ build_watchers.added_at AS t, 1 AS priority, build_watchers.build_id AS build, + NULL AS by_build, NULL AS build_comment, build_watchers.user_id AS user, NULL AS by_user @@ -134,6 +165,7 @@ EVENTS_VIEW = """ build_watchers.deleted_at AS t, 1 AS priority, build_watchers.build_id AS build, + NULL AS by_build, NULL AS build_comment, build_watchers.user_id AS user, NULL AS by_user @@ -149,7 +181,8 @@ class Events(base.Object): def map(self): return { # Builds - "build" : self.backend.builds.get_by_id, + "build" : self.backend.builds.get_by_id, + "by_build" : self.backend.builds.get_by_id, # Build Comments "build_comment" : self.backend.builds.comments.get_by_id, diff --git a/src/templates/events/modules/system-message.html b/src/templates/events/modules/system-message.html index 41ed67d9..ac20f6cc 100644 --- a/src/templates/events/modules/system-message.html +++ b/src/templates/events/modules/system-message.html @@ -7,6 +7,8 @@ {{ _("Build Created") }} {% elif event.type == "build-deleted" %} {{ _("Build Deleted") }} + {% elif event.type == "build-deprecated" %} + {{ _("This build was deprecated") }} {% elif event.type == "build-watcher-added" %} {{ _("%s started watching this build") % event.user }} {% elif event.type == "build-watcher-removed" %} @@ -22,12 +24,21 @@