diff --git a/src/lib/components/modals/AddBeaconModal.svelte b/src/lib/components/modals/AddBeaconModal.svelte index e0d1f99..107f600 100644 --- a/src/lib/components/modals/AddBeaconModal.svelte +++ b/src/lib/components/modals/AddBeaconModal.svelte @@ -4,7 +4,7 @@ import { onMount } from 'svelte'; import type { BeaconInstance } from '@/beacon-api/types'; import { addInstance, updateInstance, removeInstance } from '@/services/beacon-instance'; - import { testInstance } from '@/services/beacon-instance-connect'; + import { checkInstance, testInstance } from '@/services/beacon-instance-connect'; import Button from '$lib/components/buttons/Button.svelte'; import { Utils } from '@/utils'; import SaveIcon from '@lucide/svelte/icons/save'; @@ -95,6 +95,10 @@ addInstance(values); } + // The table shows this instance right away. Without this, its status stays + // "unknown" until the next sweep or page reload. + void checkInstance({ url, token }); + onSave(); } diff --git a/src/lib/components/query-builder/QueryBuilderSelectorBlock.svelte b/src/lib/components/query-builder/QueryBuilderSelectorBlock.svelte index 2ad6e3b..9488f20 100644 --- a/src/lib/components/query-builder/QueryBuilderSelectorBlock.svelte +++ b/src/lib/components/query-builder/QueryBuilderSelectorBlock.svelte @@ -137,11 +137,37 @@ add new query blocks, duplicate blocks, close clocks, select active blocks }); } + let rowEl: HTMLDivElement | undefined = $state(); + + function scrollActiveBlockIntoView(): void { + const activeId = workspace.activeBlockId; + if (!rowEl || !activeId) return; + + const activeEl = rowEl.querySelector(`[data-block-id="${CSS.escape(activeId)}"]`); + activeEl?.scrollIntoView({ block: 'nearest', inline: 'nearest' }); + } + + // Keep the active block fully in view, including right after a page load/reload. + $effect(() => { + scrollActiveBlockIntoView(); + }); + + // Re-correct on width changes, e.g. the page scrollbar appearing/disappearing + // shrinks this row without changing activeBlockId, which would otherwise leave + // an edge block clipped. + $effect(() => { + if (!rowEl) return; + + const observer = new ResizeObserver(() => scrollActiveBlockIntoView()); + observer.observe(rowEl); + + return () => observer.disconnect(); + });
-
+
{#each workspace.blocks as block (block.id)} {@const status = QueryWorkspace.getStatus(block)} @@ -156,7 +182,7 @@ add new query blocks, duplicate blocks, close clocks, select active blocks {@const missingUrl = workspace.missingInstanceUrlFor(block)} {@const blockReason = blockReasonFor(block)}
openInWorkbench(entry)} - title="Open in Query Workbench" + title="Open in Query Builder" > - Workbench + Query Builder