From 55dbdb262b7e49e502f2a3ec4a3d14bd69266191 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Sun, 17 Dec 2023 19:33:51 +0100 Subject: [PATCH] Show number of skipped files --- node-src/ui/tasks/upload.stories.ts | 10 ++++++++++ node-src/ui/tasks/upload.ts | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/node-src/ui/tasks/upload.stories.ts b/node-src/ui/tasks/upload.stories.ts index cf66e6368..6547bb9d3 100644 --- a/node-src/ui/tasks/upload.stories.ts +++ b/node-src/ui/tasks/upload.stories.ts @@ -63,6 +63,16 @@ export const Success = () => startedAt: -54321, uploadedBytes: 1234567, uploadedFiles: 42, + fileInfo: { paths: { length: 42 } }, + } as any); + +export const SuccessSkippedFiles = () => + success({ + now: 0, + startedAt: -54321, + uploadedBytes: 1234567, + uploadedFiles: 42, + fileInfo: { paths: { length: 100 } }, } as any); export const SuccessNoFiles = () => success({} as any); diff --git a/node-src/ui/tasks/upload.ts b/node-src/ui/tasks/upload.ts index c9f169e27..8fc016689 100644 --- a/node-src/ui/tasks/upload.ts +++ b/node-src/ui/tasks/upload.ts @@ -102,10 +102,15 @@ export const uploading = ({ percentage }: { percentage: number }) => ({ export const success = (ctx: Context) => { const files = pluralize('file', ctx.uploadedFiles, true); const bytes = filesize(ctx.uploadedBytes || 0); + const skipped = + ctx.fileInfo.paths.length > ctx.uploadedFiles + ? `, skipped ${pluralize('file', ctx.fileInfo.paths.length - ctx.uploadedFiles, true)}` + : ''; + return { status: 'success', title: ctx.uploadedBytes ? `Publish complete in ${getDuration(ctx)}` : `Publish complete`, - output: ctx.uploadedBytes ? `Uploaded ${files} (${bytes})` : 'No new files to upload', + output: ctx.uploadedBytes ? `Uploaded ${files} (${bytes})${skipped}` : 'No new files to upload', }; };