mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-01 13:59:54 +00:00
## Summary Show active jobs in grid view matching the list view behavior, with refactored component structure. ## Changes - **ActiveJobCard**: New component for grid view job display with progress bar - **AssetsSidebarGridView**: Extracted grid view logic from AssetsSidebarTab (matching ListView pattern) - **Progress styling**: Use `useProgressBarBackground` composable for consistent progress bar styling - **Assets header**: Add "Generated/Imported assets" header in grid view
39 lines
976 B
TypeScript
39 lines
976 B
TypeScript
import type { TaskItemImpl } from '@/stores/queueStore'
|
|
import type { JobState } from '@/types/queue'
|
|
|
|
/**
|
|
* Checks if a job state represents an active (in-progress) job.
|
|
*/
|
|
export function isActiveJobState(state: JobState): boolean {
|
|
return (
|
|
state === 'pending' || state === 'initialization' || state === 'running'
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Map a task to a UI job state, including initialization override.
|
|
*
|
|
* @param task Task item from the queue store
|
|
* @param isInitializing True if the prompt is currently initializing
|
|
* @returns JobState for UI
|
|
*/
|
|
export const jobStateFromTask = (
|
|
task: TaskItemImpl,
|
|
isInitializing: boolean
|
|
): JobState => {
|
|
if (isInitializing) return 'initialization'
|
|
const status = task.displayStatus
|
|
switch (status) {
|
|
case 'Running':
|
|
return 'running'
|
|
case 'Pending':
|
|
return 'pending'
|
|
case 'Completed':
|
|
return 'completed'
|
|
case 'Failed':
|
|
case 'Cancelled':
|
|
return 'failed'
|
|
}
|
|
return 'failed'
|
|
}
|