mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 18:22:40 +00:00
Fix queue sidebar tab task filter (#1682)
* Fix queue sidebar tab task filter * nit
This commit is contained in:
@@ -118,7 +118,11 @@ import OutputFilters from './queue/OutputFilters.vue'
|
|||||||
import ResultGallery from './queue/ResultGallery.vue'
|
import ResultGallery from './queue/ResultGallery.vue'
|
||||||
import SidebarTabTemplate from './SidebarTabTemplate.vue'
|
import SidebarTabTemplate from './SidebarTabTemplate.vue'
|
||||||
import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
|
import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
|
||||||
import { TaskItemImpl, useQueueStore } from '@/stores/queueStore'
|
import {
|
||||||
|
TaskItemDisplayStatus,
|
||||||
|
TaskItemImpl,
|
||||||
|
useQueueStore
|
||||||
|
} from '@/stores/queueStore'
|
||||||
import { api } from '@/scripts/api'
|
import { api } from '@/scripts/api'
|
||||||
import { ComfyNode } from '@/types/comfyWorkflow'
|
import { ComfyNode } from '@/types/comfyWorkflow'
|
||||||
import { useSettingStore } from '@/stores/settingStore'
|
import { useSettingStore } from '@/stores/settingStore'
|
||||||
@@ -170,9 +174,7 @@ const allTasks = computed(() =>
|
|||||||
? folderTask.value
|
? folderTask.value
|
||||||
? folderTask.value.flatten()
|
? folderTask.value.flatten()
|
||||||
: []
|
: []
|
||||||
: isExpanded.value
|
: filterTasks(isExpanded.value ? queueStore.flatTasks : queueStore.tasks)
|
||||||
? queueStore.flatTasks
|
|
||||||
: queueStore.tasks
|
|
||||||
)
|
)
|
||||||
const allGalleryItems = computed(() =>
|
const allGalleryItems = computed(() =>
|
||||||
allTasks.value.flatMap((task: TaskItemImpl) => {
|
allTasks.value.flatMap((task: TaskItemImpl) => {
|
||||||
@@ -182,30 +184,24 @@ const allGalleryItems = computed(() =>
|
|||||||
)
|
)
|
||||||
|
|
||||||
const filterTasks = (tasks: TaskItemImpl[]) =>
|
const filterTasks = (tasks: TaskItemImpl[]) =>
|
||||||
tasks
|
tasks.filter((task: TaskItemImpl) => {
|
||||||
.filter((t) => {
|
if (
|
||||||
if (
|
hideCanceled.value &&
|
||||||
hideCanceled.value &&
|
task.displayStatus === TaskItemDisplayStatus.Cancelled
|
||||||
t.status?.messages?.at(-1)?.[0] === 'execution_interrupted'
|
) {
|
||||||
) {
|
return false
|
||||||
return false
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (hideCached.value && task.isCached) {
|
||||||
hideCached.value &&
|
return false
|
||||||
t.flatOutputs?.length &&
|
}
|
||||||
t.flatOutputs.every((o) => o.cached)
|
|
||||||
) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
.slice(0, ITEMS_PER_PAGE)
|
|
||||||
|
|
||||||
const loadMoreItems = () => {
|
const loadMoreItems = () => {
|
||||||
const currentLength = visibleTasks.value.length
|
const currentLength = visibleTasks.value.length
|
||||||
const newTasks = filterTasks(allTasks.value).slice(
|
const newTasks = allTasks.value.slice(
|
||||||
currentLength,
|
currentLength,
|
||||||
currentLength + ITEMS_PER_PAGE
|
currentLength + ITEMS_PER_PAGE
|
||||||
)
|
)
|
||||||
@@ -240,7 +236,7 @@ useResizeObserver(scrollContainer, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const updateVisibleTasks = () => {
|
const updateVisibleTasks = () => {
|
||||||
visibleTasks.value = filterTasks(allTasks.value)
|
visibleTasks.value = allTasks.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleExpanded = () => {
|
const toggleExpanded = () => {
|
||||||
|
|||||||
@@ -265,6 +265,12 @@ export class TaskItemImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isCached() {
|
||||||
|
return (
|
||||||
|
this.flatOutputs && _.every(this.flatOutputs, (output) => output.cached)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
get executionStartTimestamp() {
|
get executionStartTimestamp() {
|
||||||
const message = this.messages.find(
|
const message = this.messages.find(
|
||||||
(message) => message[0] === 'execution_start'
|
(message) => message[0] === 'execution_start'
|
||||||
|
|||||||
Reference in New Issue
Block a user