Add list view

This commit is contained in:
Benjamin Lu
2025-12-22 18:21:23 -08:00
parent f128c61c53
commit db3edd522d
2 changed files with 12 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
:preview-alt="job.title"
:icon-name="job.iconName"
:icon-class="getJobIconClass(job)"
:icon-wrapper-class="getJobIconWrapperClass(job)"
:primary-text="job.title"
:secondary-text="job.meta"
:progress-total-percent="job.progressTotalPercent"
@@ -195,12 +196,22 @@ function onJobLeave(jobId: string) {
}
}
function getJobIconWrapperClass(job: JobListItem): string | undefined {
if (job.state === 'failed') {
return 'bg-modal-card-placeholder-background'
}
return undefined
}
function getJobIconClass(job: JobListItem): string | undefined {
const classes = []
const iconName = job.iconName ?? iconForJobState(job.state)
if (!job.iconImageUrl && iconName === iconForJobState('pending')) {
classes.push('animate-spin')
}
if (job.state === 'failed') {
classes.push('text-destructive-background')
}
return classes.length ? classes.join(' ') : undefined
}

View File

@@ -6,7 +6,7 @@ import type { JobListItem } from '@/composables/queue/useJobList'
import { useJobMenu } from '@/composables/queue/useJobMenu'
import type { JobState } from '@/types/queue'
type JobActionKey = 'cancel'
export type JobActionKey = 'cancel'
export type JobAction = {
key: JobActionKey