From c270ab11718f8d41fe764d5d2116bb3b9aa20cb2 Mon Sep 17 00:00:00 2001 From: wendrul <53628737+wendrul@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:08:16 +0200 Subject: [PATCH] fix: search modal improvements (#4128) * Message when runs filter is empty * Improve height and width of modal --- .../search/GlobalSearchModal.svelte | 59 +++++++++++++------ .../components/search/QuickMenuItem.svelte | 2 +- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/frontend/src/lib/components/search/GlobalSearchModal.svelte b/frontend/src/lib/components/search/GlobalSearchModal.svelte index 84cc7d9260..443db93a37 100644 --- a/frontend/src/lib/components/search/GlobalSearchModal.svelte +++ b/frontend/src/lib/components/search/GlobalSearchModal.svelte @@ -461,26 +461,42 @@ open = false } - let height: number | undefined = undefined + function maxModalWidth(tab: SearchMode) { + if (tab === 'runs') { + return 'max-w-7xl' + } else { + return 'max-w-4xl' + } + } + + function maxModalHeight(tab: SearchMode) { + if (tab === 'runs') { + return '' + } else if (tab === 'content') { + return 'max-h-[70vh]' + } else { + return 'max-h-[60vh]' + } + } {#if open}
{ open = false }} > -
+
-
+
{#if tab === 'default' || tab === 'switch-mode'} {@const items = (itemMap[tab] ?? []).filter((e) => defaultMenuItems.includes(e))} {#if items.length > 0} @@ -538,7 +554,7 @@ {/if} {#if (itemMap[tab] ?? []).length === 0} -
+
Nothing found
Tip: press `esc` to quickly clear the search bar
@@ -561,7 +577,7 @@
{:else if tab === 'runs'} -
+
{#if loadingCompletedRuns}
@@ -569,7 +585,7 @@
{:else if itemMap['runs'] && itemMap['runs'].length > 0} -
+
{#each itemMap['runs'] ?? [] as r} { @@ -583,12 +599,12 @@ id={r?.document.id[0]} hovered={selectedItem && r?.document.id[0] === selectedItem?.document.id[0]} icon={r?.icon} - containerClass="!rounded-none" + containerClass="rounded-md px-2 py-1 my-2" >
@@ -618,20 +634,27 @@ {/each}
{#if selectedItem === undefined} - select a result to preview + Select a result to preview {:else} -
+
{/if} {:else} -
+
-
No runs found
-
There were no completed runs that match your query
-
Note that new runs might take a while to become searchable (by default ~5min)
+ {#if searchTerm === RUNS_PREFIX} +
Enter your search terms
+
Start typing to do full-text search across completed runs
+ {:else} +
No runs found
+
There were no completed runs that match your query
+ {/if} +
+ Note that new runs might take a while to become searchable (by default ~5min) +
{#if !$enterpriseLicense}
diff --git a/frontend/src/lib/components/search/QuickMenuItem.svelte b/frontend/src/lib/components/search/QuickMenuItem.svelte index c7f7d942cb..8822fc0f2d 100644 --- a/frontend/src/lib/components/search/QuickMenuItem.svelte +++ b/frontend/src/lib/components/search/QuickMenuItem.svelte @@ -51,7 +51,7 @@ on:click|stopPropagation={runAction} on:mouseenter={() => dispatch('hover')} class={twMerge( - `rounded-md w-full transition-all cursor-pointer hover:bg-surface-hover ${ + `rounded-md w-full transition-all cursor-pointer ${ hovered ? 'bg-surface-hover' : '' }`, containerClass