mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 16:10:37 +00:00
fix: leave a tools workspace out of a read-only connection's list and say why in its card, select it from the card
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5d26fdf507
commit
f0254c990a
@@ -56,7 +56,7 @@ it('serves a tools workspace only to a connection covering it alone', () => {
|
||||
const session = ws('b', 'read_only')
|
||||
expect(servedOn([tools], false, 'full')).toEqual([tools])
|
||||
expect(servedOn([tools], true, 'full')).toEqual([])
|
||||
expect(servedOn([tools], true, 'read')).toEqual([tools])
|
||||
expect(servedOn([tools], true, 'read')).toEqual([])
|
||||
expect(servedOn([tools, session], false, 'full')).toEqual([session])
|
||||
})
|
||||
|
||||
|
||||
@@ -77,14 +77,14 @@ export function restriction(workspace: McpWorkspaceAccess, picked: McpAccess): s
|
||||
}
|
||||
|
||||
/** The covered workspaces a connection serves. One set to scripts and flows as tools is served
|
||||
* only to a connection covering it alone; a read-only one lists it as giving nothing. */
|
||||
* only to a connection covering it alone. */
|
||||
export function servedOn(
|
||||
covered: McpWorkspaceAccess[],
|
||||
all: boolean,
|
||||
picked: McpAccess
|
||||
): McpWorkspaceAccess[] {
|
||||
const alone = !all && covered.length === 1
|
||||
return covered.filter((w) => w.access !== 'runnables' || alone || picked === 'read')
|
||||
return covered.filter((w) => w.access !== 'runnables' || alone)
|
||||
}
|
||||
|
||||
/** The session toolset a connection with the `picked` access gets in a workspace, none where it
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
isGateway && !toolsOnly && !allWorkspaces && covered.length === 1 && isTools(covered[0])
|
||||
)
|
||||
const leftOut = $derived(
|
||||
isGateway && access !== 'selected' && access !== 'read'
|
||||
isGateway && access !== 'selected'
|
||||
? workspaceAccess.filter((w) => isTools(w) && !served.includes(w))
|
||||
: []
|
||||
)
|
||||
@@ -620,11 +620,16 @@
|
||||
? 'is not included'
|
||||
: 'are not included'}
|
||||
</Button>
|
||||
{#if leftOutOpen}
|
||||
{#if leftOutOpen && access === 'read'}
|
||||
<p class="text-xs text-primary">
|
||||
{one ? 'Its role offers' : 'Their roles offer'} only scripts and flows as tools, which
|
||||
a read-only client cannot run.
|
||||
</p>
|
||||
{:else if leftOutOpen}
|
||||
<p class="text-xs text-primary">
|
||||
Scripts and flows as tools need a connection of their own: add {one
|
||||
? 'its'
|
||||
: 'each'} workspace URL to your AI client, or connect it alone here.
|
||||
: 'each'} workspace URL to your AI client, or select it here instead.
|
||||
</p>
|
||||
<div class="flex flex-col gap-1">
|
||||
{#each leftOut as w (w.id)}
|
||||
@@ -643,7 +648,7 @@
|
||||
Copy workspace URL
|
||||
</Button>
|
||||
<Button variant="default" unifiedSize="xs" onClick={() => connectOnly(w.id)}>
|
||||
Connect only
|
||||
Select it
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user