Skip to content

Commit

Permalink
Show number of skipped files
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Dec 17, 2023
1 parent 9eb3f3c commit 55dbdb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions node-src/ui/tasks/upload.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion node-src/ui/tasks/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
};

Expand Down

0 comments on commit 55dbdb2

Please sign in to comment.