From: Michael Tremer Date: Fri, 18 Jul 2025 15:00:01 +0000 (+0000) Subject: frontend: Show build watchers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1449608df5f0d3afaeba99e72ace2881d6ec960d;p=pbs.git frontend: Show build watchers Signed-off-by: Michael Tremer --- diff --git a/frontend/src/api/builds.ts b/frontend/src/api/builds.ts index 12d64ad2..8b93e50a 100644 --- a/frontend/src/api/builds.ts +++ b/frontend/src/api/builds.ts @@ -1,5 +1,7 @@ import api from "@/api"; import type { Bug } from "@/api/bugs"; +import type { User } from "@/api/users"; +import { fetchUser } from "@/api/users"; export interface Build { // Name @@ -29,3 +31,16 @@ export async function fetchBuildBugs(uuid: string): Promise { const response = await api.get(`/v1/builds/${uuid}/bugs`); return response.data as Bug[]; } + +// Fetch all watchers by the build UUID +export async function fetchBuildWatchers(uuid: string): Promise { + const response = await api.get(`/v1/builds/${uuid}/watchers`); + + // Fetch all users by their name + const users = response.data.map( + ({ username }: { username: string }) => fetchUser(username) + ); + + // Fetch all users concurrently + return await Promise.all(users); +} diff --git a/frontend/src/components/BuildHeader.vue b/frontend/src/components/BuildHeader.vue index 2f63685e..690afda4 100644 --- a/frontend/src/components/BuildHeader.vue +++ b/frontend/src/components/BuildHeader.vue @@ -1,6 +1,10 @@ + + diff --git a/frontend/src/composables/builds.ts b/frontend/src/composables/builds.ts index ed174896..50a240b0 100644 --- a/frontend/src/composables/builds.ts +++ b/frontend/src/composables/builds.ts @@ -6,7 +6,9 @@ import type { Build } from "@/api/builds"; import { fetchBuild, fetchBuildBugs, + fetchBuildWatchers, } from "@/api/builds"; +import type { User } from "@/api/users"; export function useBuild(uuid: string) { const build = ref(); @@ -21,9 +23,15 @@ export function useBuild(uuid: string) { return await fetchBuildBugs(uuid); } + // Fetch all watchers + async function getWatchers(): Promise { + return await fetchBuildWatchers(uuid); + } + return { build, loadBuild, getBugs, + getWatchers, }; }