mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +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:
@@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
|
|
||||||
import { useQueueProgress } from '@/composables/queue/useQueueProgress'
|
import { useQueueProgress } from '@/composables/queue/useQueueProgress'
|
||||||
import { st } from '@/i18n'
|
import { st } from '@/i18n'
|
||||||
|
import { isCloud } from '@/platform/distribution/types'
|
||||||
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
|
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
|
||||||
import { useExecutionStore } from '@/stores/executionStore'
|
import { useExecutionStore } from '@/stores/executionStore'
|
||||||
import { useQueueStore } from '@/stores/queueStore'
|
import { useQueueStore } from '@/stores/queueStore'
|
||||||
@@ -263,7 +264,8 @@ export function useJobList() {
|
|||||||
totalPercent: isActive ? totalPercent.value : undefined,
|
totalPercent: isActive ? totalPercent.value : undefined,
|
||||||
currentNodePercent: isActive ? currentNodePercent.value : undefined,
|
currentNodePercent: isActive ? currentNodePercent.value : undefined,
|
||||||
currentNodeName: isActive ? currentNodeName.value : undefined,
|
currentNodeName: isActive ? currentNodeName.value : undefined,
|
||||||
showAddedHint
|
showAddedHint,
|
||||||
|
isCloud
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -989,6 +989,7 @@
|
|||||||
"initializingAlmostReady": "Initializing - Almost ready",
|
"initializingAlmostReady": "Initializing - Almost ready",
|
||||||
"inQueue": "In queue...",
|
"inQueue": "In queue...",
|
||||||
"jobAddedToQueue": "Job added to queue",
|
"jobAddedToQueue": "Job added to queue",
|
||||||
|
"completedIn": "Finished in {duration}",
|
||||||
"jobMenu": {
|
"jobMenu": {
|
||||||
"openAsWorkflowNewTab": "Open as workflow in new tab",
|
"openAsWorkflowNewTab": "Open as workflow in new tab",
|
||||||
"openWorkflowNewTab": "Open workflow in new tab",
|
"openWorkflowNewTab": "Open workflow in new tab",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { TaskItemImpl } from '@/stores/queueStore'
|
import type { TaskItemImpl } from '@/stores/queueStore'
|
||||||
import type { JobState } from '@/types/queue'
|
import type { JobState } from '@/types/queue'
|
||||||
|
import { formatDuration } from '@/utils/formatUtil'
|
||||||
import { clampPercentInt, formatPercent0 } from '@/utils/numberUtil'
|
import { clampPercentInt, formatPercent0 } from '@/utils/numberUtil'
|
||||||
|
|
||||||
type BuildJobDisplayCtx = {
|
type BuildJobDisplayCtx = {
|
||||||
@@ -11,6 +12,8 @@ type BuildJobDisplayCtx = {
|
|||||||
currentNodePercent?: number
|
currentNodePercent?: number
|
||||||
currentNodeName?: string
|
currentNodeName?: string
|
||||||
showAddedHint?: boolean
|
showAddedHint?: boolean
|
||||||
|
/** Whether the app is running in cloud distribution */
|
||||||
|
isCloud?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobDisplay = {
|
type JobDisplay = {
|
||||||
@@ -122,13 +125,20 @@ export const buildJobDisplay = (
|
|||||||
const time = task.executionTimeInSeconds
|
const time = task.executionTimeInSeconds
|
||||||
const preview = task.previewOutput
|
const preview = task.previewOutput
|
||||||
const iconImageUrl = preview && preview.isImage ? preview.url : undefined
|
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 {
|
return {
|
||||||
iconName: iconForJobState(state),
|
iconName: iconForJobState(state),
|
||||||
iconImageUrl,
|
iconImageUrl,
|
||||||
primary:
|
primary,
|
||||||
preview?.filename && preview.filename.length
|
|
||||||
? preview.filename
|
|
||||||
: buildTitle(task, ctx.t),
|
|
||||||
secondary: time !== undefined ? `${time.toFixed(2)}s` : '',
|
secondary: time !== undefined ? `${time.toFixed(2)}s` : '',
|
||||||
showClear: false
|
showClear: false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user