mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +00:00
Revert "Sort queue groups by latest timestamp and keep undated first"
This reverts commit 35978e1462.
This commit is contained in:
@@ -51,11 +51,6 @@ export type JobGroup = {
|
|||||||
items: JobListItem[]
|
items: JobListItem[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobGroupWithTimestamp = {
|
|
||||||
group: JobGroup
|
|
||||||
latestTimestamp?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
const ADDED_HINT_DURATION_MS = 3000
|
const ADDED_HINT_DURATION_MS = 3000
|
||||||
const relativeTimeFormatterCache = new Map<string, Intl.RelativeTimeFormat>()
|
const relativeTimeFormatterCache = new Map<string, Intl.RelativeTimeFormat>()
|
||||||
const taskIdToKey = (id: string | number | undefined) => {
|
const taskIdToKey = (id: string | number | undefined) => {
|
||||||
@@ -323,7 +318,7 @@ export function useJobList() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const groupedJobItems = computed<JobGroup[]>(() => {
|
const groupedJobItems = computed<JobGroup[]>(() => {
|
||||||
const groups: JobGroupWithTimestamp[] = []
|
const groups: JobGroup[] = []
|
||||||
const index = new Map<string, number>()
|
const index = new Map<string, number>()
|
||||||
const localeValue = locale.value
|
const localeValue = locale.value
|
||||||
for (const { task, state } of filteredTaskEntries.value) {
|
for (const { task, state } of filteredTaskEntries.value) {
|
||||||
@@ -339,21 +334,12 @@ export function useJobList() {
|
|||||||
localeValue,
|
localeValue,
|
||||||
relativeTimeFormatter.value
|
relativeTimeFormatter.value
|
||||||
)
|
)
|
||||||
groups.push({ group: { key, label, items: [] }, latestTimestamp: ts })
|
groups.push({ key, label, items: [] })
|
||||||
groupIdx = groups.length - 1
|
groupIdx = groups.length - 1
|
||||||
index.set(key, groupIdx)
|
index.set(key, groupIdx)
|
||||||
}
|
}
|
||||||
const ji = jobItemById.value.get(String(task.promptId))
|
const ji = jobItemById.value.get(String(task.promptId))
|
||||||
if (ji) {
|
if (ji) groups[groupIdx].items.push(ji)
|
||||||
groups[groupIdx].group.items.push(ji)
|
|
||||||
if (
|
|
||||||
ts !== undefined &&
|
|
||||||
(groups[groupIdx].latestTimestamp === undefined ||
|
|
||||||
ts > groups[groupIdx].latestTimestamp!)
|
|
||||||
) {
|
|
||||||
groups[groupIdx].latestTimestamp = ts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedSortMode.value === 'totalGenerationTime') {
|
if (selectedSortMode.value === 'totalGenerationTime') {
|
||||||
@@ -362,22 +348,13 @@ export function useJobList() {
|
|||||||
const sortByExecutionTimeDesc = (a: JobListItem, b: JobListItem) =>
|
const sortByExecutionTimeDesc = (a: JobListItem, b: JobListItem) =>
|
||||||
valueOrDefault(b.executionTimeMs) - valueOrDefault(a.executionTimeMs)
|
valueOrDefault(b.executionTimeMs) - valueOrDefault(a.executionTimeMs)
|
||||||
|
|
||||||
groups.forEach((groupWithTs) => {
|
groups.forEach((group) => {
|
||||||
groupWithTs.group.items.sort(sortByExecutionTimeDesc)
|
group.items.sort(sortByExecutionTimeDesc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const undated = groups
|
const undated = groups.filter((group) => group.key === 'undated')
|
||||||
.filter((group) => group.group.key === 'undated')
|
const dated = groups.filter((group) => group.key !== 'undated')
|
||||||
.map(({ group }) => group)
|
|
||||||
const dated = groups
|
|
||||||
.filter((group) => group.group.key !== 'undated')
|
|
||||||
.sort((a, b) => {
|
|
||||||
const tsA = a.latestTimestamp ?? -Infinity
|
|
||||||
const tsB = b.latestTimestamp ?? -Infinity
|
|
||||||
return tsB - tsA
|
|
||||||
})
|
|
||||||
.map(({ group }) => group)
|
|
||||||
|
|
||||||
return [...undated, ...dated]
|
return [...undated, ...dated]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user