Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Home keeps only the workspace at a glance; its admin cards move to Admin

Simon Flack27130fa20e43
diff --git a/console/apps/switch-console-desktop/src/renderer/features/admin/admin-frame.tsx b/console/apps/switch-console-desktop/src/renderer/features/admin/admin-frame.tsx
index 9bed9589c..f88a814c1 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/admin/admin-frame.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/admin/admin-frame.tsx
@@ -28,6 +28,7 @@ export function adminGroupsInScope(serverId: string, serviceConnections: boolean
const server = switchServersStore.servers.find((s) => s.id === serverId);
return adminGroups({
administers: administersWorkspaceInScope(serverId),
+ operator: operatesServer(serverId),
operatesGatewaylessServer:
operatesServer(serverId) && server !== undefined && !servesWebGateway(server),
serviceConnections,
diff --git a/console/apps/switch-console-desktop/src/renderer/features/admin/admin-sections.ts b/console/apps/switch-console-desktop/src/renderer/features/admin/admin-sections.ts
index 169ab84e0..0dabbfbe8 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/admin/admin-sections.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/admin/admin-sections.ts
@@ -1,9 +1,11 @@
-export type AdminSection = 'connectors' | 'apps';
+export type AdminSection = 'messaging-apps' | 'connectors' | 'switch-trust' | 'apps';
export type AdminScope = 'workspace' | 'server';
export const ADMIN_MENU_LABELS = {
+ 'messaging-apps': 'Messaging apps',
connectors: 'Connectors',
+ 'switch-trust': 'Switch Trust',
apps: 'Connector apps',
} as const satisfies Record<AdminSection, string>;
@@ -12,18 +14,26 @@ export type AdminGroup = { scope: AdminScope; items: AdminSection[] };
/**
* The Admin menu's entries the signed-in account may use, grouped by what
* they reach. Each is there only for the role that may use it, so nobody is
- * shown a control the server would refuse, and only where the server has
- * service connections on.
+ * shown a control the server would refuse.
*
- * Admin holds only what the web gateway does not have yet. The workspace's
- * connector switches are its admins' (the server's operator administers every
- * workspace). The apps connectors sign in through are the operator's, and are
- * in the gateway, so they are here only for a Switch that serves no gateway:
- * one this Console runs without Docker. A server's status is in Settings.
- * A group with nothing in it is left out.
+ * Admin holds only what the web gateway does not have yet, and each entry
+ * goes once it does:
+ * - Messaging apps: the workspace's side of its apps (replacing a token,
+ * the default app, confirming older links, guided set-up), for its admins.
+ * Your own accounts are linked in Settings.
+ * - Connectors: the workspace's connector switches, for its admins, where
+ * the server has service connections on.
+ * - Switch Trust: the deployment's guardrails, for the server's operator.
+ * - Connector apps: the apps connectors sign in through, for the operator of
+ * a Switch that serves no gateway (one this Console runs without Docker),
+ * where the server has service connections on.
+ *
+ * The server's operator administers every workspace. A server's status is in
+ * Settings. A group with nothing in it is left out.
*/
export function adminGroups(person: {
administers: boolean;
+ operator: boolean;
operatesGatewaylessServer: boolean;
serviceConnections: boolean;
}): AdminGroup[] {
@@ -31,11 +41,16 @@ export function adminGroups(person: {
const groups: AdminGroup[] = [
{
scope: 'workspace',
- items: serviceConnections && person.administers ? ['connectors'] : [],
+ items: person.administers
+ ? ['messaging-apps', ...(serviceConnections ? (['connectors'] as const) : [])]
+ : [],
},
{
scope: 'server',
- items: serviceConnections && person.operatesGatewaylessServer ? ['apps'] : [],
+ items: [
+ ...(person.operator ? (['switch-trust'] as const) : []),
+ ...(serviceConnections && person.operatesGatewaylessServer ? (['apps'] as const) : []),
+ ],
},
];
return groups.filter((group) => group.items.length > 0);
diff --git a/console/apps/switch-console-desktop/src/renderer/features/admin/admin-view.tsx b/console/apps/switch-console-desktop/src/renderer/features/admin/admin-view.tsx
index 776daf9b3..373a3a080 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/admin/admin-view.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/admin/admin-view.tsx
@@ -1,12 +1,14 @@
import { ShieldCheck } from 'lucide-react';
import { observer } from 'mobx-react-lite';
-import { useEffect, useState } from 'react';
+import { useState } from 'react';
import type { GuardResult, ViewDefinition } from '@renderer/app/view-registry';
import { connectorsPageAccess } from '@renderer/features/connectors/connectors-catalog';
import {
useConnectorCatalog,
useServerFeatureFlags,
} from '@renderer/features/connectors/connectors-queries';
+import { GuardrailsSection } from '@renderer/features/switch-servers/GuardrailsSection';
+import { MessagingAppsCard } from '@renderer/features/switch-servers/MessagingAppsCard';
import { ServerPage } from '@renderer/features/switch-servers/server-page';
import { ServerSectionTitlebar } from '@renderer/features/switch-servers/server-section-titlebar';
import { switchServersStore } from '@renderer/features/switch-servers/switch-servers-store';
@@ -42,52 +44,67 @@ const AdminTitlebar = observer(function AdminTitlebar() {
});
/**
- * What the workspace's admins, and whoever runs a Switch with no gateway,
- * manage for other people that the web gateway does not have yet. Laid out
- * like Settings: its sections down the side, grouped by what they reach,
- * each shown only to the role that may use it. Its sections are about
- * connectors, so like the Connectors page they are behind the server's
- * `service_connections` flag; with the flag off it sends you to Your Agents.
+ * What workspace admins and the server's operator look after that the web
+ * gateway does not have yet (see `adminGroups`). Laid out like Settings: its
+ * sections down the side, grouped by what they reach, each shown only to the
+ * role that may use it.
*/
const AdminPanel = observer(function AdminPanel() {
const { params } = useParams('admin');
const { serverId } = params;
- const { navigate } = useNavigate();
const access = connectorsPageAccess(useServerFeatureFlags(serverId));
const workspace = workspacesStore.onServerInScope(serverId);
const groups = adminGroupsInScope(serverId, access === 'shown');
const section = shownAdminSection(groups, params.section);
- const redirect =
- access === 'loading' || section !== null ? null : access === 'absent' ? 'serverAgents' : null;
- useEffect(() => {
- if (redirect !== null) navigate(redirect, { serverId });
- }, [redirect, navigate, serverId]);
+ const serverName =
+ switchServersStore.servers.find((s) => s.id === serverId)?.name ?? 'This server';
- if (access !== 'shown' || workspace === null || redirect !== null)
+ if (access === 'loading' || workspace === null)
return (
<ServerPage width={880} title="Admin" description="">
<Spinner />
</ServerPage>
);
- // The apps are read only where the menu offers them.
- const operator = groups.some((group) => group.items.includes('apps'));
if (section === null)
return (
<ServerPage width={880} title="Admin" description="Ask a workspace admin to change these.">
{null}
</ServerPage>
);
+ if (section === 'messaging-apps' || section === 'switch-trust')
+ return (
+ <AdminFrame serverId={serverId} groups={groups} active={section}>
+ <PageContent className="px-0">
+ <div className="space-y-6 pb-10">
+ <PageHeader
+ sticky
+ title={ADMIN_MENU_LABELS[section]}
+ description={
+ section === 'messaging-apps'
+ ? `The apps people in ${workspace.name} reach their agents from. Everyone links their own account in Settings.`
+ : `The guardrails every message on ${serverName} is checked against before it goes out.`
+ }
+ />
+ {section === 'messaging-apps' ? (
+ <MessagingAppsCard serverId={serverId} />
+ ) : (
+ <GuardrailsSection serverId={serverId} initiallyOpen />
+ )}
+ </div>
+ </PageContent>
+ </AdminFrame>
+ );
// Keyed so a workspace switch starts the search afresh.
return (
<Admin
key={workspace.id}
serverId={serverId}
- operator={operator}
+ operator={groups.some((group) => group.items.includes('apps'))}
groups={groups}
section={section}
openApp={params.app ?? null}
workspace={workspace}
- serverName={switchServersStore.servers.find((s) => s.id === serverId)?.name ?? 'This server'}
+ serverName={serverName}
/>
);
});
@@ -109,7 +126,7 @@ function Admin({
serverId: string;
operator: boolean;
groups: AdminGroup[];
- section: AdminSection;
+ section: 'connectors' | 'apps';
openApp: string | null;
workspace: { id: string; name: string };
serverName: string;
diff --git a/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.test.ts b/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.test.ts
index c137d1664..989a17e13 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.test.ts
@@ -95,7 +95,10 @@ describe('openConsoleLink', () => {
it('opens a dialog over the page it belongs to', async () => {
await openConsoleLink('switchdash://open/messaging-apps/connect');
- expect(navigate).toHaveBeenCalledWith('server', { serverId: 'srv-1' });
+ expect(navigate).toHaveBeenCalledWith('admin', {
+ serverId: 'srv-1',
+ section: 'messaging-apps',
+ });
expect(showModal).toHaveBeenCalledWith(
'connectMessagingAppModal',
expect.objectContaining({ serverId: 'srv-1' })
@@ -104,6 +107,13 @@ describe('openConsoleLink', () => {
expect(showModal).toHaveBeenCalledWith('invitePeopleModal', { workspaceId: 'ws-1' });
});
+ it('sends someone who cannot connect an app to their own accounts in Settings', async () => {
+ administers.mockReturnValueOnce(false);
+ await openConsoleLink('switchdash://open/messaging-apps/connect');
+ expect(navigate).toHaveBeenCalledWith('settings', { tab: 'messaging-apps' });
+ expect(showModal).not.toHaveBeenCalledWith('connectMessagingAppModal', expect.anything());
+ });
+
it('opens an agent on the section its tab names', async () => {
list.mockResolvedValueOnce([{ agentId: 'a-1', name: 'switch-buddy-ada' }]);
await openConsoleLink('switchdash://open/agent/a-1?tab=settings');
diff --git a/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.ts b/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.ts
index 8eec608fa..328f9d63d 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/deeplinks/open-console-link.ts
@@ -112,7 +112,13 @@ async function openOnServer(serverId: string, link: ConsoleLink): Promise<void>
navigation.navigate('templateDetail', { serverId, templateId: link.id! });
return;
case 'messaging-apps/connect':
- navigation.navigate('server', { serverId });
+ // Connecting an app is the workspace admins'; anyone else can only link
+ // their own account, which Settings does.
+ if (!administersWorkspaceInScope(serverId)) {
+ navigation.navigate('settings', { tab: 'messaging-apps' });
+ return;
+ }
+ navigation.navigate('admin', { serverId, section: 'messaging-apps' });
showModal('connectMessagingAppModal', { serverId, onClosed: () => {} });
return;
case 'connections':
diff --git a/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav-views.ts b/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav-views.ts
index c2c455680..a827296d8 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav-views.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav-views.ts
@@ -9,29 +9,20 @@ export type WorkspaceNavView =
/**
* The active server's destinations, in order. Connectors follows Templates
* only where the server has service connections on: with them off its routes
- * are not mounted, so there is nothing to show.
- *
- * Admin holds only what has no other home yet. Workspace and server settings
- * belong to the server's web gateway; what is still here is the workspace's
- * connector switches, for whoever administers the workspace (the gateway has
- * no page for them yet), and connector apps for the operator of a Switch this
- * Console runs without a gateway of its own. A Switch this Console runs is
- * operated from Settings → System status, not from here.
+ * are not mounted, so there is nothing to show. Admin is there when it holds
+ * something the person may use (`adminGroups`).
*/
export function workspaceNavViews(server: {
serviceConnections: boolean;
- administers: boolean;
- /** The operator of a Switch this Console runs that serves no web gateway. */
- operatesGatewaylessServer: boolean;
+ /** Whether Admin has any section for this person. */
+ admin: boolean;
}): WorkspaceNavView[] {
- const admin =
- server.serviceConnections && (server.administers || server.operatesGatewaylessServer);
return [
'server',
'serverAgents',
'serverRooms',
'templates',
...(server.serviceConnections ? (['connectors'] as const) : []),
- ...(admin ? (['admin'] as const) : []),
+ ...(server.admin ? (['admin'] as const) : []),
];
}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav.tsx b/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav.tsx
index f4a4f0fdf..493dabf65 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/sidebar/workspace-nav.tsx
@@ -9,15 +9,11 @@ import {
ShieldCheck,
} from 'lucide-react';
import { observer } from 'mobx-react-lite';
+import { adminGroupsInScope } from '@renderer/features/admin/admin-frame';
import { useRoomHealth } from '@renderer/features/switch-rooms/connection-health';
import { ManagedServerDot } from '@renderer/features/switch-servers/managed-server-dot';
import { FROZEN, isFrozenServer } from '@renderer/features/switch-servers/managed-server-state';
-import { servesWebGateway } from '@renderer/features/switch-servers/server-gateway';
import { switchServersStore } from '@renderer/features/switch-servers/switch-servers-store';
-import {
- administersWorkspaceInScope,
- operatesServer,
-} from '@renderer/features/switch-servers/workspace-admin';
import { useFeatureFlags } from '@renderer/lib/hooks/useFeatureFlags';
import { isCurrentView, useNavigate, useParams } from '@renderer/lib/layout/navigation-provider';
import { useWorkspaceSlots } from '@renderer/lib/layout/workspace-slots';
@@ -67,8 +63,7 @@ export const WorkspaceNav = observer(function WorkspaceNav() {
const shown = active
? workspaceNavViews({
serviceConnections,
- administers: administersWorkspaceInScope(active.id),
- operatesGatewaylessServer: operatesServer(active.id) && !servesWebGateway(active),
+ admin: adminGroupsInScope(active.id, serviceConnections).length > 0,
})
: [];
const onSettings =
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/GuardrailsSection.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/GuardrailsSection.tsx
index be7fbf163..95bd37c82 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/GuardrailsSection.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/GuardrailsSection.tsx
@@ -43,8 +43,8 @@ function recoverableResultText(result: { kind: string; message?: string }): stri
}
/**
- * Switch Trust's one server-global guardrails settings, inline on the
- * server's Home page between Messaging apps and the admin interface link.
+ * Switch Trust's one server-global guardrails settings, in Admin under
+ * Server. Here until the web gateway has a page for them; then this goes.
*
* Admin-only (a deployment operator, not a workspace admin) — one policy
* covers the whole deployment, not a workspace, so `switchServersStore`'s
@@ -56,9 +56,12 @@ function recoverableResultText(result: { kind: string; message?: string }): stri
export const GuardrailsSection = observer(function GuardrailsSection({
serverId,
className,
+ initiallyOpen = false,
}: {
serverId: string;
className?: string;
+ /** Open on arrival, where the settings are the page rather than one row of it. */
+ initiallyOpen?: boolean;
}) {
const isOperator = switchServersStore.statusFor(serverId)?.user?.role === 'admin';
@@ -69,7 +72,7 @@ export const GuardrailsSection = observer(function GuardrailsSection({
const [saving, setSaving] = useState(false);
const [confirmingOff, setConfirmingOff] = useState(false);
const [clearing, setClearing] = useState(false);
- const [open, setOpen] = useState(false);
+ const [open, setOpen] = useState(initiallyOpen);
useEffect(() => {
if (!isOperator) return;
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/MessagingAppsCard.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/MessagingAppsCard.tsx
index 8d36d6a79..a0114f1d7 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/MessagingAppsCard.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/MessagingAppsCard.tsx
@@ -118,7 +118,7 @@ export const MessagingAppsCard = observer(function MessagingAppsCard({
/**
* Only your own accounts in each app, for Settings: linking and unlinking
* them. The workspace's side — connecting an app, its token, its defaults —
- * is for its admins, on Home and in the workspace settings.
+ * is for its admins, in Admin and the workspace settings.
*/
personal?: boolean;
}) {
@@ -378,11 +378,11 @@ export const MessagingAppsCard = observer(function MessagingAppsCard({
) : bridges.length === 0 && !bridgesQuery.isLoading ? (
<p className="mt-3 text-xs text-foreground-muted">
{chatsWithoutApp
- ? `No messaging app is connected. They are optional: chats and rooms in Switch Console work without one. ${isAdmin ? 'Connect one to also reach your agents from Slack, Discord and others.' : administers ? 'Connect one from Home to also reach your agents from Slack, Discord and others.' : 'An owner or admin of this workspace can connect one to reach your agents from Slack, Discord and others.'}`
+ ? `No messaging app is connected. They are optional: chats and rooms in Switch Console work without one. ${isAdmin ? 'Connect one to also reach your agents from Slack, Discord and others.' : administers ? 'Connect one from Admin to also reach your agents from Slack, Discord and others.' : 'An owner or admin of this workspace can connect one to reach your agents from Slack, Discord and others.'}`
: isAdmin
? 'No messaging app is connected, so rooms created here would be unreachable. Connect one to get started.'
: administers
- ? 'No messaging app is connected. Connect one from Home.'
+ ? 'No messaging app is connected. Connect one from Admin.'
: 'No messaging app is connected. An owner or admin of this workspace can connect one.'}
</p>
) : (
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/view.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/view.tsx
index edd8d9809..bafc26af4 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/view.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/view.tsx
@@ -33,9 +33,7 @@ import {
} from '@renderer/lib/ui/dropdown-menu';
import { Spinner } from '@renderer/lib/ui/spinner';
import { type SwitchServer } from '@shared/core/switch-servers/switch-servers';
-import { GuardrailsSection } from './GuardrailsSection';
import { localServerStore } from './local-server-store';
-import { MessagingAppsCard } from './MessagingAppsCard';
import { remoteServerStore } from './remote-server-store';
import { serverIcon } from './server-icon';
import { serverPlacementLabel } from './server-presentation';
@@ -52,7 +50,6 @@ import { isSwitchCloudServer } from './switch-cloud-store';
import { switchRoomsStore } from './switch-rooms-store';
import { switchServersStore } from './switch-servers-store';
import { myIdentitiesQueryKey } from './use-my-identities';
-import { administersWorkspaceInScope } from './workspace-admin';
/** Whether a managed server's stack is currently running (via the store that
* owns its lifecycle). Non-managed servers are always "reachable". */
@@ -304,12 +301,6 @@ const ServerMainPanel = observer(function ServerMainPanel() {
)}
{connected && <ServerStatTiles serverId={serverId} />}
- {/* Your own accounts in each app are linked in Settings; what is
- left here is the workspace's side, for its admins. */}
- {connected && administersWorkspaceInScope(serverId) && (
- <MessagingAppsCard serverId={serverId} />
- )}
- {connected && <GuardrailsSection serverId={serverId} />}
</>
)}
</div>
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/admin.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/admin.test.ts
index f5824bf39..56857b618 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/admin.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/admin.test.ts
@@ -44,40 +44,55 @@ function entry(slug: string, category: string): ConnectionCatalogEntry {
describe('the Admin page’s sections', () => {
const person = {
administers: false,
+ operator: false,
operatesGatewaylessServer: false,
serviceConnections: true,
};
- it('shows the workspace switches to its admins', () => {
+ it('gives workspace admins its messaging apps and connector switches', () => {
expect(adminGroups({ ...person, administers: true })).toEqual([
- { scope: 'workspace', items: ['connectors'] },
+ { scope: 'workspace', items: ['messaging-apps', 'connectors'] },
]);
expect(adminGroups(person)).toEqual([]);
});
- it('keeps the connector apps only for whoever runs a Switch with no gateway to set them in', () => {
- expect(adminGroups({ ...person, administers: true, operatesGatewaylessServer: true })).toEqual([
- { scope: 'workspace', items: ['connectors'] },
- { scope: 'server', items: ['apps'] },
+ it('gives the server’s operator Switch Trust, and connector apps only on a Switch with no gateway', () => {
+ const operator = { ...person, administers: true, operator: true };
+ expect(adminGroups(operator)).toEqual([
+ { scope: 'workspace', items: ['messaging-apps', 'connectors'] },
+ { scope: 'server', items: ['switch-trust'] },
]);
+ expect(adminGroups({ ...operator, operatesGatewaylessServer: true })[1]).toEqual({
+ scope: 'server',
+ items: ['switch-trust', 'apps'],
+ });
});
- it('keeps every section behind service connections', () => {
+ it('keeps only the connector sections behind service connections', () => {
expect(
adminGroups({
administers: true,
+ operator: true,
operatesGatewaylessServer: true,
serviceConnections: false,
})
- ).toEqual([]);
+ ).toEqual([
+ { scope: 'workspace', items: ['messaging-apps'] },
+ { scope: 'server', items: ['switch-trust'] },
+ ]);
});
it('opens the section asked for when the person may use it, otherwise the first', () => {
- const operator = adminGroups({ ...person, administers: true, operatesGatewaylessServer: true });
+ const operator = adminGroups({
+ ...person,
+ administers: true,
+ operator: true,
+ operatesGatewaylessServer: true,
+ });
const admin = adminGroups({ ...person, administers: true });
expect(shownAdminSection(operator, 'apps')).toBe('apps');
- expect(shownAdminSection(admin, 'apps')).toBe('connectors');
- expect(shownAdminSection(admin, undefined)).toBe('connectors');
+ expect(shownAdminSection(admin, 'apps')).toBe('messaging-apps');
+ expect(shownAdminSection(admin, 'connectors')).toBe('connectors');
expect(shownAdminSection([], 'connectors')).toBeNull();
});
});
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/admin-page.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/admin-page.test.tsx
index 3cb815714..9368d8861 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/admin-page.test.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/admin-page.test.tsx
@@ -81,7 +81,8 @@ vi.mock('@renderer/features/switch-servers/workspace-admin', () => ({
/** Stands in for the app's navigation: a tile opens its profile by navigating. */
const navigation = vi.hoisted(() => {
- let params: Record<string, string | undefined> = { serverId: 'server' };
+ // Opened on the connector switches, which these tests are about.
+ let params: Record<string, string | undefined> = { serverId: 'server', section: 'connectors' };
const listeners = new Set<() => void>();
return {
params: () => params,
@@ -96,7 +97,7 @@ const navigation = vi.hoisted(() => {
};
},
reset: () => {
- params = { serverId: 'server' };
+ params = { serverId: 'server', section: 'connectors' };
},
};
});
@@ -193,7 +194,7 @@ it('lists its sections under what they reach, and each service as a tile with wh
expect(workspaces.getWorkspaceServices).toHaveBeenCalledWith('workspace');
expect(page.textContent).toContain('Choose which services people in Acme can connect');
const workspace = page.querySelector('nav [role="group"][aria-label="Workspace"]')!;
- expect(workspace.textContent).toBe('Workspace · AcmeConnectors');
+ expect(workspace.textContent).toBe('Workspace · AcmeMessaging appsConnectors');
expect(workspace.querySelector('[aria-current="page"]')!.textContent).toBe('Connectors');
expect(page.querySelector('nav [role="group"][aria-label="Server"]')).toBeNull();
expect(tiles(page)!.textContent).toContain('3 members connected · 2 agents use it');
@@ -350,7 +351,7 @@ it("gives the server's operator Connector apps under Server, the app needing set
await vi.waitFor(() => expect(tiles(page)).not.toBeNull());
const server = page.querySelector('nav [role="group"][aria-label="Server"]')!;
- expect(server.textContent).toBe('Server · Dev ServerConnector apps');
+ expect(server.textContent).toBe('Server · Dev ServerSwitch TrustConnector apps');
await act(async () => button(/^Connector apps$/, server)!.click());
expect(navigation.params()).toEqual({ serverId: 'server', section: 'apps' });
await vi.waitFor(() => expect(appTiles(page)).not.toBeNull());
@@ -382,7 +383,8 @@ it('leaves the apps to the web gateway where the server serves one', async () =>
const page = await render();
await vi.waitFor(() => expect(tiles(page)).not.toBeNull());
- expect(page.querySelector('nav [role="group"][aria-label="Server"]')).toBeNull();
+ const server = page.querySelector('nav [role="group"][aria-label="Server"]')!;
+ expect(server.textContent).toBe('Server · Dev ServerSwitch Trust');
expect(switchServers.getConnectorApps).not.toHaveBeenCalled();
});
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/connectors.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/connectors.test.ts
index c8956a84b..62d733d9d 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/connectors.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/connectors.test.ts
@@ -771,38 +771,29 @@ describe('with the service_connections flag off', () => {
error: null,
});
- it('leaves Connectors and Admin out of the nav', () => {
- const shown = workspaceNavViews({
- serviceConnections: false,
- administers: true,
- operatesGatewaylessServer: true,
- });
- expect(shown).toEqual(['server', 'serverAgents', 'serverRooms', 'templates']);
- expect(
- workspaceNavViews({
- serviceConnections: true,
- administers: true,
- operatesGatewaylessServer: false,
- })
- ).toEqual(['server', 'serverAgents', 'serverRooms', 'templates', 'connectors', 'admin']);
- });
-
- it('shows Admin only for what has no other home: workspace connector switches, or connector apps on a Switch with no gateway', () => {
- expect(
- workspaceNavViews({
- serviceConnections: true,
- administers: false,
- operatesGatewaylessServer: false,
- })
- ).toEqual(['server', 'serverAgents', 'serverRooms', 'templates', 'connectors']);
- // The operator of a Switch this Console runs without Docker keeps connector apps here.
- expect(
- workspaceNavViews({
- serviceConnections: true,
- administers: false,
- operatesGatewaylessServer: true,
- })
- ).toContain('admin');
+ it('leaves Connectors out of the nav, and shows Admin when it has something for you', () => {
+ expect(workspaceNavViews({ serviceConnections: false, admin: false })).toEqual([
+ 'server',
+ 'serverAgents',
+ 'serverRooms',
+ 'templates',
+ ]);
+ // Admin's messaging apps and Switch Trust do not need service connections.
+ expect(workspaceNavViews({ serviceConnections: false, admin: true })).toEqual([
+ 'server',
+ 'serverAgents',
+ 'serverRooms',
+ 'templates',
+ 'admin',
+ ]);
+ expect(workspaceNavViews({ serviceConnections: true, admin: true })).toEqual([
+ 'server',
+ 'serverAgents',
+ 'serverRooms',
+ 'templates',
+ 'connectors',
+ 'admin',
+ ]);
});
it('has no page to show, rather than an empty one', () => {
diff --git a/console/apps/switch-console-desktop/src/shared/core/deeplinks/console-links.ts b/console/apps/switch-console-desktop/src/shared/core/deeplinks/console-links.ts
index af7330b8e..6cd2ab0aa 100644
--- a/console/apps/switch-console-desktop/src/shared/core/deeplinks/console-links.ts
+++ b/console/apps/switch-console-desktop/src/shared/core/deeplinks/console-links.ts
@@ -59,8 +59,8 @@ export const CONSOLE_PAGES = {
invite: { description: 'Invite people to the workspace.' },
admin: {
description:
- "Admin, for the workspace's admins: which connectors the workspace offers, and, on a Switch with no web gateway, the apps they sign in through.",
- tabs: ['connectors', 'apps'],
+ "Admin, for the workspace's admins and the server's operator: what the web gateway does not have yet.",
+ tabs: ['messaging-apps', 'connectors', 'switch-trust', 'apps'],
},
settings: {
description: "Switch Console's settings.",
diff --git a/core/switch_core/official_templates/switch-buddy/AGENT.md b/core/switch_core/official_templates/switch-buddy/AGENT.md
index 2b4834199..790e7ce22 100644
--- a/core/switch_core/official_templates/switch-buddy/AGENT.md
+++ b/core/switch_core/official_templates/switch-buddy/AGENT.md
@@ -217,7 +217,7 @@ per place, at the moment it is needed; not a list of every page.
| Connect a messaging app | `switchdash://open/messaging-apps/connect` |
| Connectors: services such as GitHub | `switchdash://open/connections` |
| Invite people to the workspace | `switchdash://open/invite` |
-| Admin, for workspace admins: which connectors the workspace offers (`tab=connectors`), and the apps they sign in through (`tab=apps`, only for whoever runs a Switch on their own computer without Docker; elsewhere they are in the web gateway). A server's status is in settings (`tab=status`) | `switchdash://open/admin` |
+| Admin, for workspace admins: the workspace's messaging apps (`tab=messaging-apps`) and which connectors it offers (`tab=connectors`); for whoever runs the server, Switch Trust guardrails (`tab=switch-trust`) and, on a Switch run without Docker, the apps connectors sign in through (`tab=apps`). A server's status is in settings (`tab=status`) | `switchdash://open/admin` |
| Switch Console's settings (`tab=preferences`, `messaging-apps` to link their own accounts, `clis-models` for agent providers, `api-keys`, `devices` for their machines and SSH hosts, `managed-agents`, `status` or `account`) | `switchdash://open/settings` |
- Ids come from your tools: an agent's id from `list_managed_agents` or