From 2bd0e18154956bb3259b1d6b9bffc80932340cc3 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Fri, 6 Feb 2026 15:36:41 +0100 Subject: [PATCH] DropdownMenu --- .../src/lib/components/DropdownMenu.svelte | 31 +++++++++++++++++++ .../lib/components/RightClickPopover.svelte | 10 +++++- .../src/lib/components/runs/RunRow.svelte | 5 ++- .../src/lib/components/runs/RunsTable.svelte | 21 +++++++++++-- 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 frontend/src/lib/components/DropdownMenu.svelte diff --git a/frontend/src/lib/components/DropdownMenu.svelte b/frontend/src/lib/components/DropdownMenu.svelte new file mode 100644 index 0000000000..280f63ed08 --- /dev/null +++ b/frontend/src/lib/components/DropdownMenu.svelte @@ -0,0 +1,31 @@ + + + diff --git a/frontend/src/lib/components/RightClickPopover.svelte b/frontend/src/lib/components/RightClickPopover.svelte index a748d15987..8e81719a5c 100644 --- a/frontend/src/lib/components/RightClickPopover.svelte +++ b/frontend/src/lib/components/RightClickPopover.svelte @@ -2,6 +2,13 @@ import { clickOutside } from '$lib/utils' import { fly } from 'svelte/transition' import Portal from './Portal.svelte' + import type { Snippet } from 'svelte' + + type Props = { + children: Snippet + } + + const { children }: Props = $props() let isOpen = $state(false) let mousePos = $state({ x: 0, y: 0 }) @@ -19,7 +26,7 @@ {#if isOpen}
{ isOpen = false @@ -30,6 +37,7 @@ class="absolute left-0 top-0 z-[9999] w-fit" style="transform: translate({mousePos.x}px, {mousePos.y}px)" > + {@render children()}
{/if}
diff --git a/frontend/src/lib/components/runs/RunRow.svelte b/frontend/src/lib/components/runs/RunRow.svelte index 7e147103e7..f66d9670cd 100644 --- a/frontend/src/lib/components/runs/RunRow.svelte +++ b/frontend/src/lib/components/runs/RunRow.svelte @@ -73,9 +73,8 @@ class:grid-runs-table-no-tag={!containsLabel && !showTag} class:grid-runs-table-with-labels-no-tag={containsLabel && !showTag} style="width: {containerWidth}px" - onclick={() => { - dispatch('select') - }} + onclick={() => dispatch('select')} + oncontextmenu={(e) => !selected && dispatch('select')} >
diff --git a/frontend/src/lib/components/runs/RunsTable.svelte b/frontend/src/lib/components/runs/RunsTable.svelte index 84a6ad22fb..5507a3a103 100644 --- a/frontend/src/lib/components/runs/RunsTable.svelte +++ b/frontend/src/lib/components/runs/RunsTable.svelte @@ -4,13 +4,14 @@ import VirtualList from '@tutorlatin/svelte-tiny-virtual-list' import { createEventDispatcher } from 'svelte' import Tooltip from '../Tooltip.svelte' - import { AlertTriangle } from 'lucide-svelte' + import { AlertTriangle, CircleXIcon, RefreshCwIcon } from 'lucide-svelte' import Popover from '../Popover.svelte' import { workspaceStore } from '$lib/stores' import './runs-grid.css' import { useKeyPressed } from '$lib/svelte5Utils.svelte' import { twMerge } from 'tailwind-merge' import RightClickPopover from '../RightClickPopover.svelte' + import DropdownMenu from '../DropdownMenu.svelte' interface Props { //import InfiniteLoading from 'svelte-infinite-loading' @@ -383,7 +384,23 @@
- + + rightClickPopover?.close()} + items={[ + { + label: 'Cancel', + icon: CircleXIcon, + onClick: () => {} + }, + { + label: 'Run again', + icon: RefreshCwIcon, + onClick: () => {} + } + ]} + /> +