From 638aac817df0cd8ae2b6f7bfb91da4efbdebc054 Mon Sep 17 00:00:00 2001 From: Fabian Meyer <3982806+meyfa@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:23:34 +0200 Subject: [PATCH] feat: Handle empty repository autodiscovery When Renovate's autodiscovery turns up empty, for example when triggering a manual run with a non-existing repository scope, the log will not contain a list of matched repositories (not even an empty one). However, once the pod has completed, we know for a fact that no repositories are going to be discovered any more. We can then show an empty list indicator, instead of continuing to show a loading indicator, --- backend/src/api/pod-progress.ts | 9 +++++++-- frontend/src/pages/Job.tsx | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/src/api/pod-progress.ts b/backend/src/api/pod-progress.ts index db9a3a0..97f8e1d 100644 --- a/backend/src/api/pod-progress.ts +++ b/backend/src/api/pod-progress.ts @@ -9,7 +9,7 @@ export interface PodProgressRoute { Reply: ProgressItem[] } -export const podProgressRoute = ({ logsController }: Controllers, config: BackendConfig): FastifyPluginAsync => async (app) => { +export const podProgressRoute = ({ podController, logsController }: Controllers, config: BackendConfig): FastifyPluginAsync => async (app) => { app.addHook('preValidation', authenticateSession()) app.get { - if (progress == null || progress.length === 0) { + if (progress == null) { return 0 } + if (progress.length === 0) { + return 1 + } let value = 0 for (const item of progress ?? []) { switch (item.state) { @@ -208,6 +211,9 @@ const Pod: FunctionComponent<{ />
+ {progress.length === 0 && ( +

No repositories were processed.

+ )} {progress.map((item) => ( ))}