Files
windmill/frontend/src/lib/components/instanceSettings/SettingCard.svelte
T
Guilhem cfb0829f81 add fuzzy search to instance settings (#8000)
* feat: add fuzzy search to instance settings sidebar

Adds a search input at the top of the superadmin settings sidebar that
uses uFuzzy for fuzzy matching against all setting labels, descriptions,
and categories. Selecting a result navigates to the correct tab and
scrolls to the specific setting card with a brief highlight.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: improve settings search display and description matching

- Extract only the label portion from uFuzzy highlighted text for
  cleaner dropdown display
- Show description only when the match is in the description and NOT
  in the label
- Truncate descriptions to 80 chars in searchable items
- Add maxHeight prop to SelectDropdown for configurable height

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: fix search description truncation and handle undefined marked values

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove description from settings search dropdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add smooth outline transition for setting highlight animation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: highlight first search result by default for enter-to-select

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* nit

* clean code

* fix: address review feedback - sanitize html, remove max-w-40, document description field

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: constrain search dropdown width to prevent long title overflow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* perf: add 150ms debounce to settings search filter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: clean up timeouts on destroy and re-invocation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: extract settings search into reusable SettingsSearchInput component

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: use twMerge for class prop in SettingsSearchInput

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: wrap debounced state write in untrack to prevent re-triggering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:12:27 +00:00

77 lines
1.7 KiB
Svelte

<script lang="ts">
import { twMerge } from 'tailwind-merge'
import { enterpriseLicense } from '$lib/stores'
import EEOnly from '../EEOnly.svelte'
import Tooltip from '../Tooltip.svelte'
import { Button } from '../common'
import type { ButtonType } from '../common/button/model'
interface Props {
label?: string
description?: string
ee_only?: string
tooltip?: string
settingKey?: string
actionButton?: {
label: string
onclick: (values: Record<string, any>) => Promise<void>
variant?: ButtonType.Variant
}
values?: Record<string, any>
children: import('svelte').Snippet
class?: string
}
let {
label,
description,
ee_only,
tooltip,
settingKey,
actionButton,
values,
children,
class: clazz
}: Props = $props()
</script>
<div
data-setting-key={settingKey}
class={twMerge('p-4 rounded-md bg-surface-tertiary shadow-sm flex flex-col gap-1', clazz)}
>
{#if label}
<div class="flex items-center justify-between gap-2 w-full">
<div class="flex gap-1 items-baseline">
<span class="text-emphasis font-semibold text-xs">{label}</span>
{#if ee_only != undefined && !$enterpriseLicense}
{#if ee_only != ''}
<EEOnly>{ee_only}</EEOnly>
{:else}
<EEOnly />
{/if}
{/if}
{#if tooltip}
<Tooltip>{tooltip}</Tooltip>
{/if}
</div>
{#if actionButton}
<Button
disabled={ee_only != undefined && !$enterpriseLicense}
variant={actionButton.variant ?? 'default'}
unifiedSize="sm"
onclick={async () => await actionButton?.onclick(values ?? {})}
>
{actionButton.label}
</Button>
{/if}
</div>
{#if description}
<span class="text-secondary font-normal text-xs">
{@html description}
</span>
{/if}
{/if}
{@render children()}
</div>