Skip to content

Commit ed2e3bc

Browse files
committed
feat(ui): route to Settings for auth instead of disabling inline
Authentication is an application-wide control, so the per-workspace install panel no longer flips it inline. The auth nudge now links to Settings → Security (via navigateTo('settings')) where the user makes the deliberate choice. Drops the inline setGatewayAuthDisabled call from the panel. Test updated: the nudge renders an "Open Settings" action that navigates to settings rather than toggling auth in place. Claude-Session: https://claude.ai/code/session_01Baan9JmzR43uxxRUh7CAMF Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent c4ef327 commit ed2e3bc

2 files changed

Lines changed: 21 additions & 39 deletions

File tree

apps/desktop/src/features/workspaces/WorkspaceInstallPanel.tsx

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { useCallback, useEffect, useState } from 'react';
22
import { Check, Copy, Download, Loader2, ShieldCheck, ShieldOff, AlertCircle } from 'lucide-react';
33
import { Button } from '@mcpmux/ui';
44
import { getGatewayStatus } from '@/lib/api/gateway';
5+
import { useNavigateTo } from '@/stores';
56
import {
67
generateWorkspaceConfigSnippet,
78
getGatewayAuthDisabled,
89
installWorkspaceMcpConfig,
910
listWorkspaceInstallClients,
10-
setGatewayAuthDisabled,
1111
type WorkspaceInstallClient,
1212
type WorkspaceInstallResult,
1313
} from '@/lib/api/workspaceInstall';
@@ -62,7 +62,7 @@ export function WorkspaceInstallPanel({ workspaceRoot }: { workspaceRoot: string
6262
const [results, setResults] = useState<WorkspaceInstallResult[] | null>(null);
6363
const [copiedId, setCopiedId] = useState<string | null>(null);
6464
const [error, setError] = useState<string | null>(null);
65-
const [togglingAuth, setTogglingAuth] = useState(false);
65+
const navigateTo = useNavigateTo();
6666

6767
useEffect(() => {
6868
let cancelled = false;
@@ -146,18 +146,6 @@ export function WorkspaceInstallPanel({ workspaceRoot }: { workspaceRoot: string
146146
}
147147
};
148148

149-
const handleDisableAuth = async () => {
150-
setTogglingAuth(true);
151-
try {
152-
const v = await setGatewayAuthDisabled(true);
153-
setAuthDisabled(v);
154-
} catch (e) {
155-
setError(e instanceof Error ? e.message : String(e));
156-
} finally {
157-
setTogglingAuth(false);
158-
}
159-
};
160-
161149
return (
162150
<div className="space-y-4" data-testid="workspace-install-panel">
163151
<p className="text-sm text-[rgb(var(--muted))]">
@@ -179,23 +167,18 @@ export function WorkspaceInstallPanel({ workspaceRoot }: { workspaceRoot: string
179167
Apps will need an access key to connect.
180168
</p>
181169
<p className="mt-0.5 text-amber-700 dark:text-amber-400">
182-
For zero-config setup, disable system-wide authentication — apps then connect with
183-
just the URL and this workspace header.
170+
Authentication is an application-wide setting. For zero-config setup, turn it off in
171+
Settings → Security — apps then connect with just the URL and this workspace header.
184172
</p>
185173
<Button
186174
variant="secondary"
187175
size="sm"
188176
className="mt-2 h-7 text-xs"
189-
disabled={togglingAuth}
190-
onClick={handleDisableAuth}
191-
data-testid="workspace-install-disable-auth"
177+
onClick={() => navigateTo('settings')}
178+
data-testid="workspace-install-open-auth-settings"
192179
>
193-
{togglingAuth ? (
194-
<Loader2 className="mr-1.5 h-3 w-3 animate-spin" />
195-
) : (
196-
<ShieldOff className="mr-1.5 h-3 w-3" />
197-
)}
198-
Disable authentication
180+
<ShieldOff className="mr-1.5 h-3 w-3" />
181+
Open Settings
199182
</Button>
200183
</div>
201184
</div>

tests/ts/components/WorkspaceInstallPanel.test.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,32 @@ const {
1919
installMock,
2020
snippetMock,
2121
getAuthMock,
22-
setAuthMock,
2322
gatewayStatusMock,
23+
navigateMock,
2424
} = vi.hoisted(() => ({
2525
listClientsMock: vi.fn(),
2626
installMock: vi.fn(),
2727
snippetMock: vi.fn(),
2828
getAuthMock: vi.fn(),
29-
setAuthMock: vi.fn(),
3029
gatewayStatusMock: vi.fn(),
30+
navigateMock: vi.fn(),
3131
}));
3232

3333
vi.mock('@/lib/api/workspaceInstall', () => ({
3434
listWorkspaceInstallClients: listClientsMock,
3535
installWorkspaceMcpConfig: installMock,
3636
generateWorkspaceConfigSnippet: snippetMock,
3737
getGatewayAuthDisabled: getAuthMock,
38-
setGatewayAuthDisabled: setAuthMock,
3938
}));
4039

4140
vi.mock('@/lib/api/gateway', () => ({
4241
getGatewayStatus: gatewayStatusMock,
4342
}));
4443

44+
vi.mock('@/stores', () => ({
45+
useNavigateTo: () => navigateMock,
46+
}));
47+
4548
import { WorkspaceInstallPanel } from '@/features/workspaces/WorkspaceInstallPanel';
4649

4750
const CLIENTS = [
@@ -61,7 +64,7 @@ describe('WorkspaceInstallPanel', () => {
6164
installMock.mockReset();
6265
snippetMock.mockReset();
6366
getAuthMock.mockReset().mockResolvedValue(true);
64-
setAuthMock.mockReset();
67+
navigateMock.mockReset();
6568
gatewayStatusMock
6669
.mockReset()
6770
.mockResolvedValue({ running: true, url: 'http://localhost:45818' });
@@ -122,20 +125,16 @@ describe('WorkspaceInstallPanel', () => {
122125
expect(installMock.mock.calls[0][0].clients).toEqual(['opencode']);
123126
});
124127

125-
it('shows the auth nudge and disables auth inline', async () => {
128+
it('shows the auth nudge and routes to Settings (no inline disable)', async () => {
126129
const user = userEvent.setup();
127130
getAuthMock.mockResolvedValue(false); // auth currently required
128-
setAuthMock.mockResolvedValue(true);
129131
render(<WorkspaceInstallPanel workspaceRoot={ROOT} />);
130132

131-
const disableBtn = await screen.findByTestId('workspace-install-disable-auth');
132-
await user.click(disableBtn);
133-
134-
await waitFor(() => expect(setAuthMock).toHaveBeenCalledWith(true));
135-
// Nudge is replaced by the "auth is off" confirmation.
136-
await waitFor(() =>
137-
expect(screen.queryByTestId('workspace-install-auth-nudge')).toBeNull()
138-
);
133+
// Auth is application-wide: the panel links to Settings instead of
134+
// flipping it inline.
135+
const openSettings = await screen.findByTestId('workspace-install-open-auth-settings');
136+
await user.click(openSettings);
137+
expect(navigateMock).toHaveBeenCalledWith('settings');
139138
});
140139

141140
it('copies a client snippet to the clipboard', async () => {

0 commit comments

Comments
 (0)