mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 23:50:08 +00:00
[feat] Show "Finished in" duration for completed jobs in cloud (#6895)
## Summary In cloud distribution, completed jobs now show "Finished in Xh Ym Zs" as the primary text instead of the filename. - Uses `formatDuration` to display time as `1h 30m 45s`, `30m 45s`, or `45s` - Gated with `isCloud` - non-cloud continues to show filename - Added i18n key `queue.completedIn` for localization Filename is not fetchable right now in cloud. This is what design wanted as the alternative. <img width="679" height="1097" alt="image" src="https://github.com/user-attachments/assets/291deb42-77d8-4de9-b4f8-ee65f3c25011" /> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { TaskItemImpl } from '@/stores/queueStore'
|
||||
import type { JobState } from '@/types/queue'
|
||||
import { formatDuration } from '@/utils/formatUtil'
|
||||
import { clampPercentInt, formatPercent0 } from '@/utils/numberUtil'
|
||||
|
||||
type BuildJobDisplayCtx = {
|
||||
@@ -11,6 +12,8 @@ type BuildJobDisplayCtx = {
|
||||
currentNodePercent?: number
|
||||
currentNodeName?: string
|
||||
showAddedHint?: boolean
|
||||
/** Whether the app is running in cloud distribution */
|
||||
isCloud?: boolean
|
||||
}
|
||||
|
||||
type JobDisplay = {
|
||||
@@ -122,13 +125,20 @@ export const buildJobDisplay = (
|
||||
const time = task.executionTimeInSeconds
|
||||
const preview = task.previewOutput
|
||||
const iconImageUrl = preview && preview.isImage ? preview.url : undefined
|
||||
|
||||
// Cloud shows "Completed in Xh Ym Zs", non-cloud shows filename
|
||||
const primary = ctx.isCloud
|
||||
? ctx.t('queue.completedIn', {
|
||||
duration: formatDuration(task.executionTime ?? 0)
|
||||
})
|
||||
: preview?.filename && preview.filename.length
|
||||
? preview.filename
|
||||
: buildTitle(task, ctx.t)
|
||||
|
||||
return {
|
||||
iconName: iconForJobState(state),
|
||||
iconImageUrl,
|
||||
primary:
|
||||
preview?.filename && preview.filename.length
|
||||
? preview.filename
|
||||
: buildTitle(task, ctx.t),
|
||||
primary,
|
||||
secondary: time !== undefined ? `${time.toFixed(2)}s` : '',
|
||||
showClear: false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user