Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/components/queue/job/JobGroupsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { computed, onBeforeUnmount, ref, watch } from 'vue'

import QueueJobItem from '@/components/queue/job/QueueJobItem.vue'
import type { JobGroup, JobListItem } from '@/composables/queue/useJobList'

defineProps<{ displayedJobGroups: JobGroup[] }>()
const props = defineProps<{ displayedJobGroups: JobGroup[] }>()
const displayedJobGroups = computed(() => props.displayedJobGroups)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Props should be reactive by default.


const emit = defineEmits<{
(e: 'cancelItem', item: JobListItem): void
Expand Down Expand Up @@ -89,4 +90,23 @@ const onDetailsLeave = (jobId: string) => {
hideTimer.value = null
}, 150)
}

const allJobIds = computed(() =>
displayedJobGroups.value.flatMap((group) =>
group.items.map((item) => item.id)
)
)

watch(allJobIds, (ids) => {
if (activeDetailsId.value && !ids.includes(activeDetailsId.value)) {
clearHideTimer()
clearShowTimer()
activeDetailsId.value = null
}
})

onBeforeUnmount(() => {
clearHideTimer()
clearShowTimer()
})
Comment on lines +94 to +111
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How expensive is this with a long history?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a maxhistory of 64, if that gets removed, then it might be bad after a few thousand? Technically speaking this can be removed and each case handled on its own.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do plan to allow scrolling through history and not removing the tail and the maxhistory is configurable right? This isn't really blocking though

</script>
18 changes: 15 additions & 3 deletions src/components/queue/job/QueueJobItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
size="sm"
class="size-6 transform gap-1 rounded bg-destructive-background text-text-primary transition duration-150 ease-in-out hover:-translate-y-px hover:bg-destructive-background-hover hover:opacity-95"
:aria-label="t('g.delete')"
@click.stop="emit('delete')"
@click.stop="onDeleteClick"
>
<i class="icon-[lucide--trash-2] size-4" />
</IconButton>
Expand All @@ -150,7 +150,7 @@
size="sm"
class="size-6 transform gap-1 rounded bg-destructive-background text-text-primary transition duration-150 ease-in-out hover:-translate-y-px hover:bg-destructive-background-hover hover:opacity-95"
:aria-label="t('g.cancel')"
@click.stop="emit('cancel')"
@click.stop="onCancelClick"
>
<i class="icon-[lucide--x] size-4" />
</IconButton>
Expand Down Expand Up @@ -190,7 +190,7 @@
size="sm"
class="size-6 transform gap-1 rounded bg-destructive-background text-text-primary transition duration-150 ease-in-out hover:-translate-y-px hover:bg-destructive-background-hover hover:opacity-95"
:aria-label="t('g.cancel')"
@click.stop="emit('cancel')"
@click.stop="onCancelClick"
>
<i class="icon-[lucide--x] size-4" />
</IconButton>
Expand Down Expand Up @@ -355,6 +355,18 @@ const computedShowClear = computed(() => {
return props.state !== 'completed'
})

const emitDetailsLeave = () => emit('details-leave', props.jobId)

const onCancelClick = () => {
emitDetailsLeave()
emit('cancel')
}

const onDeleteClick = () => {
emitDetailsLeave()
emit('delete')
}

const onContextMenu = (event: MouseEvent) => {
const shouldShowMenu = props.showMenu !== undefined ? props.showMenu : true
if (shouldShowMenu) emit('menu', event)
Expand Down
Loading