11<template >
2- <SideBarTabTemplate :title =" $t('sideToolbar.queue')" >
2+ <SidebarTabTemplate :title =" $t('sideToolbar.queue')" >
33 <template #tool-buttons >
44 <Button
5- :icon =" isExpanded ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
5+ v-if =" isInFolderView"
6+ icon =" pi pi-arrow-left"
67 text
78 severity =" secondary"
8- @click =" toggleExpanded"
9- class =" toggle-expanded-button"
10- v-tooltip =" $t('sideToolbar.queueTab.showFlatList')"
11- />
12- <Button
13- icon =" pi pi-trash"
14- text
15- severity =" primary"
16- @click =" confirmRemoveAll($event)"
17- class =" clear-all-button"
9+ @click =" exitFolderView"
10+ class =" back-button"
11+ v-tooltip =" $t('sideToolbar.queueTab.backToAllTasks')"
1812 />
13+ <template v-else >
14+ <Button
15+ :icon =" isExpanded ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
16+ text
17+ severity =" secondary"
18+ @click =" toggleExpanded"
19+ class =" toggle-expanded-button"
20+ v-tooltip =" $t('sideToolbar.queueTab.showFlatList')"
21+ />
22+ <Button
23+ icon =" pi pi-trash"
24+ text
25+ severity =" primary"
26+ @click =" confirmRemoveAll($event)"
27+ class =" clear-all-button"
28+ />
29+ </template >
1930 </template >
2031 <template #body >
2132 <div
2839 v-for =" task in visibleTasks"
2940 :key =" task.key"
3041 :task =" task"
31- :isFlatTask =" isExpanded"
42+ :isFlatTask =" isExpanded || isInFolderView "
3243 @contextmenu =" handleContextMenu"
3344 @preview =" handlePreview"
45+ @taskOutputLengthClicked =" enterFolderView($event)"
3446 />
3547 </div >
3648 <div ref =" loadMoreTrigger" style =" height : 1px " />
4355 />
4456 </div >
4557 </template >
46- </SideBarTabTemplate >
58+ </SidebarTabTemplate >
4759 <ConfirmPopup />
4860 <ContextMenu ref =" menu" :model =" menuItems" />
4961 <ResultGallery
@@ -64,7 +76,7 @@ import ContextMenu from 'primevue/contextmenu'
6476import type { MenuItem } from ' primevue/menuitem'
6577import TaskItem from ' ./queue/TaskItem.vue'
6678import ResultGallery from ' ./queue/ResultGallery.vue'
67- import SideBarTabTemplate from ' ./SidebarTabTemplate.vue'
79+ import SidebarTabTemplate from ' ./SidebarTabTemplate.vue'
6880import NoResultsPlaceholder from ' @/components/common/NoResultsPlaceholder.vue'
6981import { TaskItemImpl , useQueueStore } from ' @/stores/queueStore'
7082import { api } from ' @/scripts/api'
@@ -74,17 +86,27 @@ const toast = useToast()
7486const queueStore = useQueueStore ()
7587const { t } = useI18n ()
7688
89+ // Expanded view: show all outputs in a flat list.
7790const isExpanded = ref (false )
7891const visibleTasks = ref <TaskItemImpl []>([])
7992const scrollContainer = ref <HTMLElement | null >(null )
8093const loadMoreTrigger = ref <HTMLElement | null >(null )
8194const galleryActiveIndex = ref (- 1 )
95+ // Folder view: only show outputs from a single selected task.
96+ const folderTask = ref <TaskItemImpl | null >(null )
97+ const isInFolderView = computed (() => folderTask .value !== null )
8298
8399const ITEMS_PER_PAGE = 8
84100const SCROLL_THRESHOLD = 100 // pixels from bottom to trigger load
85101
86102const allTasks = computed (() =>
87- isExpanded .value ? queueStore .flatTasks : queueStore .tasks
103+ isInFolderView .value
104+ ? folderTask .value
105+ ? folderTask .value .flatten ()
106+ : []
107+ : isExpanded .value
108+ ? queueStore .flatTasks
109+ : queueStore .tasks
88110)
89111const allGalleryItems = computed (() =>
90112 allTasks .value .flatMap ((task : TaskItemImpl ) => {
@@ -129,9 +151,13 @@ useResizeObserver(scrollContainer, () => {
129151 })
130152})
131153
154+ const updateVisibleTasks = () => {
155+ visibleTasks .value = allTasks .value .slice (0 , ITEMS_PER_PAGE )
156+ }
157+
132158const toggleExpanded = () => {
133159 isExpanded .value = ! isExpanded .value
134- visibleTasks . value = allTasks . value . slice ( 0 , ITEMS_PER_PAGE )
160+ updateVisibleTasks ( )
135161}
136162
137163const removeTask = (task : TaskItemImpl ) => {
@@ -173,7 +199,7 @@ const confirmRemoveAll = (event: Event) => {
173199
174200const onStatus = async () => {
175201 await queueStore .update ()
176- visibleTasks . value = allTasks . value . slice ( 0 , ITEMS_PER_PAGE )
202+ updateVisibleTasks ( )
177203}
178204
179205const menu = ref (null )
@@ -182,7 +208,8 @@ const menuItems = computed<MenuItem[]>(() => [
182208 {
183209 label: t (' delete' ),
184210 icon: ' pi pi-trash' ,
185- command : () => menuTargetTask .value && removeTask (menuTargetTask .value )
211+ command : () => menuTargetTask .value && removeTask (menuTargetTask .value ),
212+ disabled: isExpanded .value || isInFolderView .value
186213 },
187214 {
188215 label: t (' loadWorkflow' ),
@@ -208,6 +235,16 @@ const handlePreview = (task: TaskItemImpl) => {
208235 )
209236}
210237
238+ const enterFolderView = (task : TaskItemImpl ) => {
239+ folderTask .value = task
240+ updateVisibleTasks ()
241+ }
242+
243+ const exitFolderView = () => {
244+ folderTask .value = null
245+ updateVisibleTasks ()
246+ }
247+
211248onMounted (() => {
212249 api .addEventListener (' status' , onStatus )
213250 queueStore .update ()
@@ -225,7 +262,7 @@ watch(
225262 visibleTasks .value .length === 0 ||
226263 visibleTasks .value .length > newTasks .length
227264 ) {
228- visibleTasks . value = newTasks . slice ( 0 , ITEMS_PER_PAGE )
265+ updateVisibleTasks ( )
229266 }
230267
231268 nextTick (() => {
0 commit comments