File tree Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 31
31
class =" toggle-expanded-button"
32
32
v-tooltip =" $t('sideToolbar.queueTab.showFlatList')"
33
33
/>
34
+ <Button
35
+ v-if =" queueStore.hasPendingTasks"
36
+ icon =" pi pi-stop"
37
+ text
38
+ severity =" danger"
39
+ @click =" clearPendingTasks"
40
+ class =" clear-pending-button"
41
+ v-tooltip =" $t('sideToolbar.queueTab.clearPendingTasks')"
42
+ />
34
43
<Button
35
44
icon =" pi pi-trash"
36
45
text
@@ -221,6 +230,16 @@ const confirmRemoveAll = (event: Event) => {
221
230
})
222
231
}
223
232
233
+ const clearPendingTasks = async () => {
234
+ await queueStore .clear ([' queue' ])
235
+ toast .add ({
236
+ severity: ' info' ,
237
+ summary: ' Confirmed' ,
238
+ detail: ' Pending tasks deleted' ,
239
+ life: 3000
240
+ })
241
+ }
242
+
224
243
const onStatus = async () => {
225
244
await queueStore .update ()
226
245
updateVisibleTasks ()
Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ const messages = {
54
54
showFlatList : 'Show Flat List' ,
55
55
backToAllTasks : 'Back to All Tasks' ,
56
56
containImagePreview : 'Fill Image Preview' ,
57
- coverImagePreview : 'Fit Image Preview'
57
+ coverImagePreview : 'Fit Image Preview' ,
58
+ clearPendingTasks : 'Clear Pending Tasks'
58
59
}
59
60
}
60
61
} ,
@@ -97,7 +98,8 @@ const messages = {
97
98
} ,
98
99
queueTab : {
99
100
showFlatList : '平铺结果' ,
100
- backToAllTasks : '返回'
101
+ backToAllTasks : '返回' ,
102
+ clearPendingTasks : '清除待处理任务'
101
103
}
102
104
}
103
105
}
Original file line number Diff line number Diff line change @@ -277,6 +277,9 @@ export const useQueueStore = defineStore('queue', {
277
277
} ,
278
278
lastHistoryQueueIndex ( state ) {
279
279
return state . historyTasks . length ? state . historyTasks [ 0 ] . queueIndex : - 1
280
+ } ,
281
+ hasPendingTasks ( state ) {
282
+ return state . pendingTasks . length > 0
280
283
}
281
284
} ,
282
285
actions : {
@@ -325,10 +328,11 @@ export const useQueueStore = defineStore('queue', {
325
328
this . isLoading = false
326
329
}
327
330
} ,
328
- async clear ( ) {
329
- await Promise . all (
330
- [ 'queue' , 'history' ] . map ( ( type ) => api . clearItems ( type ) )
331
- )
331
+ async clear ( targets : ( 'queue' | 'history' ) [ ] = [ 'queue' , 'history' ] ) {
332
+ if ( targets . length === 0 ) {
333
+ return
334
+ }
335
+ await Promise . all ( targets . map ( ( type ) => api . clearItems ( type ) ) )
332
336
await this . update ( )
333
337
} ,
334
338
async delete ( task : TaskItemImpl ) {
You can’t perform that action at this time.
0 commit comments