fix: pens next to the workspace and access values on the mcp consent page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-12-03 16:27:32 +01:00
co-authored by Claude Opus 5.5
parent 48b5ac13f5
commit 41f17d63db
3 changed files with 29 additions and 27 deletions
@@ -2,6 +2,7 @@
import type { McpWorkspaceAccess } from '$lib/gen'
import type { McpAccess } from './McpAccessPicker.svelte'
import Tooltip from '$lib/components/Tooltip.svelte'
import type { Snippet } from 'svelte'
import { connectionLevel, narrows } from './workspaceAccess'
interface Props {
@@ -10,9 +11,11 @@
access: McpAccess
/** Names the level, for where no select already shows it. */
labelled?: boolean
/** Rendered after the level, to change it. */
edit?: Snippet
}
let { workspaces, access, labelled = false }: Props = $props()
let { workspaces, access, labelled = false, edit }: Props = $props()
const shown = $derived(connectionLevel(workspaces, access))
// Under a select, a workspace giving less than the level picked is what the sentence is about.
@@ -23,6 +26,7 @@
<div class="flex items-center gap-1.5 text-xs text-primary">
{shown.label}
{#if shown.hint}<Tooltip small>{shown.hint}</Tooltip>{/if}
{@render edit?.()}
</div>
{/if}
{#if less}
@@ -9,12 +9,10 @@
/** The tools "Show tools" lists: a level's, or the scripts and flows a role offers as tools
* in `workspace`. None hides the button. */
tools?: { level?: ToolsetLevel; workspace?: string }
/** Next to the label, to change the access. */
edit?: Snippet
children: Snippet
}
let { tools, edit, children }: Props = $props()
let { tools, children }: Props = $props()
let open = $state(false)
const shown = $derived(!!tools && (!!tools.level || !!tools.workspace))
@@ -23,7 +21,6 @@
<div class="flex flex-col gap-1">
<div class="flex items-center gap-1.5">
<span class="text-xs font-semibold text-emphasis">Access</span>
{@render edit?.()}
{#if shown}
<div class="grow"></div>
<Button
@@ -464,22 +464,9 @@
{#if isGateway}
<div class="mb-6 flex flex-col gap-2">
<div class="flex items-center gap-1.5">
<p class="text-xs font-semibold text-emphasis">
{access === 'selected' || toolsOnly || toolsAlone ? 'Workspace' : 'Workspaces'}
</p>
{#if toolsAlone && !loadingWorkspaces}
<Button
variant="subtle"
unifiedSize="xs"
iconOnly
startIcon={{ icon: Pencil }}
aria-label="Change workspaces"
title="Change workspaces"
onClick={coverDefault}
/>
{/if}
</div>
<p class="text-xs font-semibold text-emphasis">
{access === 'selected' || toolsOnly || toolsAlone ? 'Workspace' : 'Workspaces'}
</p>
{#if loadingWorkspaces}
<p class="text-xs text-secondary">Loading workspaces...</p>
{:else if accessLoadFailed}
@@ -509,7 +496,18 @@
Your role lets you connect scripts and flows as tools, one workspace per connection.
</p>
{:else if toolsAlone}
<p class="text-xs text-primary">{covered[0].name}</p>
<div class="flex items-center gap-1.5">
<p class="text-xs text-primary">{covered[0].name}</p>
<Button
variant="subtle"
unifiedSize="xs"
iconOnly
startIcon={{ icon: Pencil }}
aria-label="Change workspaces"
title="Change workspaces"
onClick={coverDefault}
/>
</div>
{:else}
<Toggle
bind:checked={allWorkspaces}
@@ -590,13 +588,16 @@
{/snippet}
{#if !loadingWorkspaces && (served.length > 0 || access === 'selected')}
<div class="mb-6">
<McpAccessSection tools={{ level: connectionTools, workspace: runnablesHere }} edit={pen}>
<McpAccessSection tools={{ level: connectionTools, workspace: runnablesHere }}>
{#if served.length > 0}
<McpAccessLine labelled workspaces={served} {access} />
<McpAccessLine labelled workspaces={served} {access} edit={pen} />
{:else}
<p class="text-xs text-primary">
Scripts and flows as tools. Choose the workspace and its scripts and flows.
</p>
<div class="flex items-center gap-1.5">
<p class="text-xs text-primary">
Scripts and flows as tools. Choose the workspace and its scripts and flows.
</p>
{@render pen()}
</div>
{/if}
</McpAccessSection>
</div>