fix: open previewable assets from list preview click/double-click (#9077)

## Summary
- emit `preview-click` from `AssetsListItem` when clicking the preview
tile
- wire assets sidebar rows and queue job-history rows so preview-tile
click and row double-click open the viewer/gallery
- gate job-history preview opening by `taskRef.previewOutput` (not
`iconImageUrl`) and use preview output URL/type so video previews are
supported
- add/extend tests for preview click and double-click behavior in assets
list and job history

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9077-fix-open-previewable-assets-from-list-preview-click-double-click-30f6d73d3650810a873cfa2dc085bf97)
by [Unito](https://www.unito.io)
This commit is contained in:
Benjamin Lu
2026-02-25 18:03:07 -08:00
committed by GitHub
parent d23c8026d0
commit c957841862
8 changed files with 280 additions and 9 deletions

View File

@@ -35,4 +35,29 @@ describe('AssetsListItem', () => {
expect(wrapper.find('video').exists()).toBe(false)
expect(wrapper.find('.icon-\\[lucide--play\\]').exists()).toBe(false)
})
it('emits preview-click when preview is clicked', async () => {
const wrapper = mount(AssetsListItem, {
props: {
previewUrl: 'https://example.com/preview.jpg',
previewAlt: 'image.png'
}
})
await wrapper.find('img').trigger('click')
expect(wrapper.emitted('preview-click')).toHaveLength(1)
})
it('emits preview-click when fallback icon is clicked', async () => {
const wrapper = mount(AssetsListItem, {
props: {
iconName: 'icon-[lucide--box]'
}
})
await wrapper.find('i').trigger('click')
expect(wrapper.emitted('preview-click')).toHaveLength(1)
})
})

View File

@@ -35,7 +35,11 @@
:icon-class="iconClass"
:icon-aria-label="iconAriaLabel"
>
<div v-if="previewUrl" class="relative size-full">
<div
v-if="previewUrl"
class="relative size-full"
@click="emit('preview-click')"
>
<template v-if="isVideoPreview">
<video
:src="previewUrl"
@@ -53,7 +57,11 @@
class="size-full object-cover"
/>
</div>
<div v-else class="flex size-full items-center justify-center">
<div
v-else
class="flex size-full items-center justify-center"
@click="emit('preview-click')"
>
<i
aria-hidden="true"
:class="
@@ -135,6 +143,7 @@ import VideoPlayOverlay from './VideoPlayOverlay.vue'
const emit = defineEmits<{
'stack-toggle': []
'preview-click': []
}>()
const {