mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 10:59:53 +00:00
Add stories for the media assets sidebar tab for easier prototyping. Includes mocks for storybook. Because some functions in the mocks are only used in the storybook main.ts resolve, knip flags them as unused because it doesn't check that path. So knipIgnoreUnusedButUsedByStorybook was added. Part of the QPO v2 iteration, figma design can be found [here](https://www.figma.com/design/LVilZgHGk5RwWOkVN6yCEK/Queue-Progress-Modal?node-id=3330-37286&m=dev). This will be implemented in a series of stacked PRs that can be reviewed and merged individually. main <-- #7737, #7743, #7745 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7743-QPOv2-Add-stories-for-list-view-and-general-job-card-2d26d73d365081bca59afa925fb232d7) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import { computed, ref } from 'vue'
|
|
|
|
import type { TaskItemImpl } from '../../stores/queueStore'
|
|
import type {
|
|
JobGroup,
|
|
JobListItem,
|
|
JobSortMode,
|
|
JobTab
|
|
} from '../../composables/queue/useJobList'
|
|
|
|
const jobItems = ref<JobListItem[]>([])
|
|
|
|
function buildGroupedJobItems(): JobGroup[] {
|
|
return [
|
|
{
|
|
key: 'storybook',
|
|
label: 'Storybook',
|
|
items: jobItems.value
|
|
}
|
|
]
|
|
}
|
|
|
|
const groupedJobItems = computed<JobGroup[]>(buildGroupedJobItems)
|
|
|
|
const selectedJobTab = ref<JobTab>('All')
|
|
const selectedWorkflowFilter = ref<'all' | 'current'>('all')
|
|
const selectedSortMode = ref<JobSortMode>('mostRecent')
|
|
const currentNodeName = ref('KSampler')
|
|
function buildEmptyTasks(): TaskItemImpl[] {
|
|
return []
|
|
}
|
|
|
|
const allTasksSorted = computed<TaskItemImpl[]>(buildEmptyTasks)
|
|
const filteredTasks = computed<TaskItemImpl[]>(buildEmptyTasks)
|
|
|
|
function buildHasFailedJobs() {
|
|
return jobItems.value.some((item) => item.state === 'failed')
|
|
}
|
|
|
|
const hasFailedJobs = computed(buildHasFailedJobs)
|
|
|
|
export function setMockJobItems(items: JobListItem[]) {
|
|
jobItems.value = items
|
|
}
|
|
|
|
export function useJobList() {
|
|
return {
|
|
selectedJobTab,
|
|
selectedWorkflowFilter,
|
|
selectedSortMode,
|
|
hasFailedJobs,
|
|
allTasksSorted,
|
|
filteredTasks,
|
|
jobItems,
|
|
groupedJobItems,
|
|
currentNodeName
|
|
}
|
|
}
|