Skip to content

Commit 63f6854

Browse files
[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 <[email protected]>
1 parent 9806ba8 commit 63f6854

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/composables/queue/useJobList.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n'
33

44
import { useQueueProgress } from '@/composables/queue/useQueueProgress'
55
import { st } from '@/i18n'
6+
import { isCloud } from '@/platform/distribution/types'
67
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
78
import { useExecutionStore } from '@/stores/executionStore'
89
import { useQueueStore } from '@/stores/queueStore'
@@ -263,7 +264,8 @@ export function useJobList() {
263264
totalPercent: isActive ? totalPercent.value : undefined,
264265
currentNodePercent: isActive ? currentNodePercent.value : undefined,
265266
currentNodeName: isActive ? currentNodeName.value : undefined,
266-
showAddedHint
267+
showAddedHint,
268+
isCloud
267269
})
268270

269271
return {

src/locales/en/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@
989989
"initializingAlmostReady": "Initializing - Almost ready",
990990
"inQueue": "In queue...",
991991
"jobAddedToQueue": "Job added to queue",
992+
"completedIn": "Finished in {duration}",
992993
"jobMenu": {
993994
"openAsWorkflowNewTab": "Open as workflow in new tab",
994995
"openWorkflowNewTab": "Open workflow in new tab",

src/utils/queueDisplay.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { TaskItemImpl } from '@/stores/queueStore'
22
import type { JobState } from '@/types/queue'
3+
import { formatDuration } from '@/utils/formatUtil'
34
import { clampPercentInt, formatPercent0 } from '@/utils/numberUtil'
45

56
type BuildJobDisplayCtx = {
@@ -11,6 +12,8 @@ type BuildJobDisplayCtx = {
1112
currentNodePercent?: number
1213
currentNodeName?: string
1314
showAddedHint?: boolean
15+
/** Whether the app is running in cloud distribution */
16+
isCloud?: boolean
1417
}
1518

1619
type JobDisplay = {
@@ -122,13 +125,20 @@ export const buildJobDisplay = (
122125
const time = task.executionTimeInSeconds
123126
const preview = task.previewOutput
124127
const iconImageUrl = preview && preview.isImage ? preview.url : undefined
128+
129+
// Cloud shows "Completed in Xh Ym Zs", non-cloud shows filename
130+
const primary = ctx.isCloud
131+
? ctx.t('queue.completedIn', {
132+
duration: formatDuration(task.executionTime ?? 0)
133+
})
134+
: preview?.filename && preview.filename.length
135+
? preview.filename
136+
: buildTitle(task, ctx.t)
137+
125138
return {
126139
iconName: iconForJobState(state),
127140
iconImageUrl,
128-
primary:
129-
preview?.filename && preview.filename.length
130-
? preview.filename
131-
: buildTitle(task, ctx.t),
141+
primary,
132142
secondary: time !== undefined ? `${time.toFixed(2)}s` : '',
133143
showClear: false
134144
}

0 commit comments

Comments
 (0)