Files
ComfyUI_frontend/src/utils/queueUtil.ts
Jin Yi e4d2bc2b59 [feat] Add active jobs display to grid view (#8209)
## 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
2026-01-22 11:02:28 +09:00

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'
}