Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
feat(dashboard): an organization's Connectors, on its Organization page
Petr Bauch2cbeb1e454c3
diff --git a/gateway/src/data/api.ts b/gateway/src/data/api.tsindex 9648a62a6..8226c506c 100644--- a/gateway/src/data/api.ts+++ b/gateway/src/data/api.ts@@ -2313,6 +2313,8 @@ export interface ServiceConnection {unavailable_reason: string | null;/** Whether it waits on the server's operator setting up its app under Connectors. */server_setup_needed: boolean;+ /** Whose app it signs in through here: the workspace's organization's own, or the server's. */+ app_source: "organization" | "server";status: "not_connected" | "active" | "needs_reauthorization" | "error";/** Whether a grant hands the agent the owner's own token: on or off, at the connection's level. */pass_through: boolean;@@ -2446,6 +2448,9 @@ export interface ConnectorApp {workspaces: number;/** Connections made through an app this server no longer uses. */stale_connections: number;+ /** An organization's page only: whether the server has an app its+ * workspaces use while the organization saves none of its own. */+ server_app?: boolean;}/** The server's connector apps; a service that needs no app of the operator's is not listed. */@@ -2492,8 +2497,17 @@ export class ConnectorAppRefusal extends ApiError {export const CONNECTORS_NOT_ENABLED ="Connectors are not enabled on this server. An operator turns them on by adding service_connections to FEATURE_FLAGS_ENABLED.";-export async function fetchConnectorApps(): Promise<ConnectorApps> {- return jsonRequest<ConnectorApps>("/connector-apps", "GET");+/** Whose apps a page manages: the server's, its operator's alone, or the+ * current workspace's organization's, its org admins'. */+export type ConnectorAppScope = "server" | "organization";++const CONNECTOR_APPS_PATH: Record<ConnectorAppScope, string> = {+ server: "/connector-apps",+ organization: "/organizations/current/connector-apps",+};++export async function fetchConnectorApps(scope: ConnectorAppScope): Promise<ConnectorApps> {+ return jsonRequest<ConnectorApps>(CONNECTOR_APPS_PATH[scope], "GET");}/** A saved app, and what the vendor said when Switch checked it; none from an older server. */@@ -2503,10 +2517,11 @@ export interface SavedConnectorApp {}export async function saveConnectorApp(+ scope: ConnectorAppScope,service: string,input: SaveConnectorAppInput,): Promise<SavedConnectorApp> {- const res = await fetch(`${BASE}/connector-apps/${service}`, {+ const res = await fetch(`${BASE}${CONNECTOR_APPS_PATH[scope]}/${service}`, {method: "PUT",credentials: "include",headers: { "Content-Type": "application/json" },@@ -2530,19 +2545,27 @@ export async function importConnectorApp(service: string): Promise<ConnectorApp>}export async function checkConnectorApp(+ scope: ConnectorAppScope,service: string,): Promise<{ ok: boolean; checks: ConnectorAppCheck[] }> {- return jsonRequest(`/connector-apps/${service}/check`, "POST");+ return jsonRequest(`${CONNECTOR_APPS_PATH[scope]}/${service}/check`, "POST");}export async function fetchConnectorAppImpact(+ scope: ConnectorAppScope,service: string,clientId: string,): Promise<ConnectorAppImpact> {const params = new URLSearchParams({ client_id: clientId });- return jsonRequest<ConnectorAppImpact>(`/connector-apps/${service}/impact?${params}`, "GET");+ return jsonRequest<ConnectorAppImpact>(+ `${CONNECTOR_APPS_PATH[scope]}/${service}/impact?${params}`,+ "GET",+ );}-export async function removeConnectorApp(service: string): Promise<ConnectorAppImpact> {- return jsonRequest<ConnectorAppImpact>(`/connector-apps/${service}`, "DELETE");+export async function removeConnectorApp(+ scope: ConnectorAppScope,+ service: string,+): Promise<ConnectorAppImpact> {+ return jsonRequest<ConnectorAppImpact>(`${CONNECTOR_APPS_PATH[scope]}/${service}`, "DELETE");}diff --git a/gateway/src/data/hooks.ts b/gateway/src/data/hooks.tsindex 33b8afe99..02e090241 100644--- a/gateway/src/data/hooks.ts+++ b/gateway/src/data/hooks.ts@@ -1,7 +1,7 @@import { useCallback, useEffect, useState } from "react";import {ApiError,- CONNECTORS_NOT_ENABLED,+ type ConnectorAppScope,type ConnectorApps,fetchConnectorApps,type AgentDetail,@@ -183,8 +183,13 @@ export function useKnownAgentTypes(): UseQueryResult<KnownAgentType[]> {return useQuery(fetchKnownAgentTypes);}-/** The server's connector apps; the operator's only, so call it only for them. */-export function useConnectorApps(): UseQueryResult<ConnectorApps> {+/** The connector apps of `scope`: the server's, which only its operator+ * reads, or the current organization's, which only its org admins do. A 404+ * is the routes not being mounted: `notEnabled` says so. */+export function useConnectorApps(+ scope: ConnectorAppScope,+ notEnabled: string,+): UseQueryResult<ConnectorApps> {const [data, setData] = useState<ConnectorApps | null>(null);const [loading, setLoading] = useState(true);const [error, setError] = useState<string | null>(null);@@ -194,7 +199,7 @@ export function useConnectorApps(): UseQueryResult<ConnectorApps> {useEffect(() => {let cancelled = false;setLoading(true);- fetchConnectorApps().then(+ fetchConnectorApps(scope).then((result) => {if (cancelled) return;setData(result);@@ -205,7 +210,7 @@ export function useConnectorApps(): UseQueryResult<ConnectorApps> {if (cancelled) return;setError(err instanceof ApiError && err.status === 404- ? CONNECTORS_NOT_ENABLED+ ? notEnabled: err instanceof Error? err.message: String(err),@@ -216,7 +221,7 @@ export function useConnectorApps(): UseQueryResult<ConnectorApps> {return () => {cancelled = true;};- }, [tick]);+ }, [scope, notEnabled, tick]);return { data, loading, error, refetch };}diff --git a/gateway/src/pages/agents/ServiceAccessSection.test.tsx b/gateway/src/pages/agents/ServiceAccessSection.test.tsxindex 6c6db0207..a40913729 100644--- a/gateway/src/pages/agents/ServiceAccessSection.test.tsx+++ b/gateway/src/pages/agents/ServiceAccessSection.test.tsx@@ -181,6 +181,7 @@ describe("ServiceAccessSection", () => {connectable: true,unavailable_reason: null,server_setup_needed: false,+ app_source: "server",status,pass_through: true,token_lifetime: 3600,diff --git a/gateway/src/pages/agents/ServiceAccessSection.tsx b/gateway/src/pages/agents/ServiceAccessSection.tsxindex 73e0fbace..71ae3dd62 100644--- a/gateway/src/pages/agents/ServiceAccessSection.tsx+++ b/gateway/src/pages/agents/ServiceAccessSection.tsx@@ -332,6 +332,11 @@ function OnOffGrant({{grant.summary}</Typography>)}+ {service.app_source === "organization" && (+ <Typography variant="body2" color="text.secondary" sx={{ mt: 0.5 }}>+ Signs in through your organization's {service.name} app.+ </Typography>+ )}{service.unavailable_reason && (<Typography variant="body2" color="text.secondary" sx={{ mt: 0.5 }}>{service.unavailable_reason}diff --git a/gateway/src/pages/connector-apps/ConnectorAppCard.tsx b/gateway/src/pages/connector-apps/ConnectorAppCard.tsxindex 5954e6075..b9876e8ae 100644--- a/gateway/src/pages/connector-apps/ConnectorAppCard.tsx+++ b/gateway/src/pages/connector-apps/ConnectorAppCard.tsx@@ -46,6 +46,7 @@ import {usedBy,} from "./connectorApps";import RemoveDialog from "./RemoveDialog";+import { useConnectorAppScope } from "./scope";import SetupDialog, { type SetupMode } from "./SetupDialog";import UpdateSecretDialog from "./UpdateSecretDialog";@@ -160,6 +161,7 @@ export default function ConnectorAppCard({onCheckFailure: (message: string | null) => void;onChanged: (message: string) => void;}) {+ const scope = useConnectorAppScope();const [menu, setMenu] = useState<HTMLElement | null>(null);const [setup, setSetup] = useState<SetupMode | null>(null);const [updating, setUpdating] = useState(false);@@ -180,7 +182,7 @@ export default function ConnectorAppCard({setChecking(true);setError(null);try {- const result = await checkConnectorApp(app.slug);+ const result = await checkConnectorApp(scope, app.slug);setChecks(result.checks);onCheckFailure(result.ok ? null : (result.checks.find((c) => !c.ok)?.message ?? null));} catch (err) {diff --git a/gateway/src/pages/connector-apps/ConnectorAppsPage.tsx b/gateway/src/pages/connector-apps/ConnectorAppsPage.tsxindex 1418a2dd5..fe7cf2de9 100644--- a/gateway/src/pages/connector-apps/ConnectorAppsPage.tsx+++ b/gateway/src/pages/connector-apps/ConnectorAppsPage.tsx@@ -1,6 +1,6 @@import { Alert, Box, CircularProgress, Snackbar, Stack, Typography } from "@mui/material";-import { useState } from "react";-import { CONNECTORS_NOT_ENABLED } from "../../data/api";+import { type ReactNode, useState } from "react";+import { CONNECTORS_NOT_ENABLED, type ConnectorAppScope } from "../../data/api";import { useAuth } from "../../data/AuthContext";import { useConnectorApps } from "../../data/hooks";import ConnectorAppCard from "./ConnectorAppCard";@@ -11,6 +11,7 @@ import {PUBLIC_URL_BANNER,sentBackTo,} from "./connectorApps";+import { ConnectorAppScopeContext } from "./scope";function Heading({ publicUrl }: { publicUrl: string | null }) {return (@@ -25,12 +26,27 @@ function Heading({ publicUrl }: { publicUrl: string | null }) {);}-function ConnectorAppsList() {- const { data, loading, error, refetch } = useConnectorApps();+const NOT_MOUNTED = "not mounted";++/** Every app of `scope`, a card each, under `heading`. A 404 means the+ * routes are not mounted, and shows `notEnabled`, or nothing when it is null. */+export function ConnectorAppsList({+ scope,+ notEnabled,+ heading: headingOf,+}: {+ scope: ConnectorAppScope;+ notEnabled: string | null;+ heading: (publicUrl: string | null) => ReactNode;+}) {+ const { data, loading, error, refetch } = useConnectorApps(+ scope,+ notEnabled ?? NOT_MOUNTED,+ );const [checkFailures, setCheckFailures] = useState<Record<string, string>>({});const [toast, setToast] = useState<string | null>(null);- const heading = <Heading publicUrl={data?.public_url ?? null} />;+ const heading = headingOf(data?.public_url ?? null);if (loading && data === null)return (<>@@ -38,18 +54,19 @@ function ConnectorAppsList() {<CircularProgress /></>);+ if (error === NOT_MOUNTED) return null;if (error !== null)return (<>{heading}- <Alert severity={error === CONNECTORS_NOT_ENABLED ? "info" : "error"}>{error}</Alert>+ <Alert severity={error === notEnabled ? "info" : "error"}>{error}</Alert></>);if (data === null) return heading;const missingUrl = missingPublicUrl(data.apps, data.public_url);return (- <>+ <ConnectorAppScopeContext.Provider value={scope}>{heading}<Stack spacing={2}>{missingUrl && <Alert severity="warning">{PUBLIC_URL_BANNER}</Alert>}@@ -80,7 +97,7 @@ function ConnectorAppsList() {message={toast}/></Stack>- </>+ </ConnectorAppScopeContext.Provider>);}@@ -90,7 +107,11 @@ export default function ConnectorAppsPage() {return (<Box>{isOperator ? (- <ConnectorAppsList />+ <ConnectorAppsList+ scope="server"+ notEnabled={CONNECTORS_NOT_ENABLED}+ heading={(publicUrl) => <Heading publicUrl={publicUrl} />}+ />) : (<><Heading publicUrl={null} />diff --git a/gateway/src/pages/connector-apps/RemoveDialog.tsx b/gateway/src/pages/connector-apps/RemoveDialog.tsxindex f5e7f61f2..f659b8ad4 100644--- a/gateway/src/pages/connector-apps/RemoveDialog.tsx+++ b/gateway/src/pages/connector-apps/RemoveDialog.tsx@@ -11,6 +11,7 @@ import {import { useState } from "react";import { type ConnectorApp, removeConnectorApp } from "../../data/api";import { removeWarning } from "./connectorApps";+import { useConnectorAppScope } from "./scope";export default function RemoveDialog({app,@@ -23,6 +24,7 @@ export default function RemoveDialog({onClose: () => void;onRemoved: () => void;}) {+ const scope = useConnectorAppScope();const [error, setError] = useState<string | null>(null);const [busy, setBusy] = useState(false);@@ -30,7 +32,7 @@ export default function RemoveDialog({setBusy(true);setError(null);try {- await removeConnectorApp(app.slug);+ await removeConnectorApp(scope, app.slug);onRemoved();} catch (err) {setError(err instanceof Error ? err.message : String(err));diff --git a/gateway/src/pages/connector-apps/SetupDialog.tsx b/gateway/src/pages/connector-apps/SetupDialog.tsxindex 95cd4f630..373f492c7 100644--- a/gateway/src/pages/connector-apps/SetupDialog.tsx+++ b/gateway/src/pages/connector-apps/SetupDialog.tsx@@ -40,6 +40,7 @@ import {switchWarning,vendorName,} from "./connectorApps";+import { useConnectorAppScope } from "./scope";export type SetupMode = "set_up" | "switch" | "enter_again";@@ -147,6 +148,7 @@ export default function SetupDialog({onClose: () => void;onSaved: (saved: SavedConnectorApp) => void;}) {+ const scope = useConnectorAppScope();const first = mode === "switch" ? 0 : 1;const [step, setStep] = useState(first);const [audience, setAudience] = useState<Audience>("internal");@@ -176,18 +178,21 @@ export default function SetupDialog({fields.every((f) => (secrets[f.name] ?? "") !== "") &&(confirmation === null || confirmed);const replacing = app.saved_client_id !== null && clientId.trim() !== app.saved_client_id;+ // An organization taking its own app over from the server's moves everyone+ // connected through that, as switching does.+ const movesPeople = mode === "switch" || (mode === "set_up" && app.server_app === true);const save = async () => {setBusy(true);setError(null);setField(null);try {- if (mode === "switch" && impact === null) {- setImpact(await fetchConnectorAppImpact(app.slug, clientId.trim()));+ if (movesPeople && impact === null) {+ setImpact(await fetchConnectorAppImpact(scope, app.slug, clientId.trim()));setBusy(false);return;}- const saved = await saveConnectorApp(app.slug, {+ const saved = await saveConnectorApp(scope, app.slug, {client_id: clientId.trim(),...secrets,replace: mode === "switch",@@ -375,9 +380,11 @@ export default function SetupDialog({>{busy? "Checking…"- : mode === "switch"+ : movesPeople? impact- ? "Switch app"+ ? mode === "switch"+ ? "Switch app"+ : "Check and save": "Check who reconnects": "Check and save"}</Button>diff --git a/gateway/src/pages/connector-apps/UpdateSecretDialog.tsx b/gateway/src/pages/connector-apps/UpdateSecretDialog.tsxindex f2aa86329..115ad823d 100644--- a/gateway/src/pages/connector-apps/UpdateSecretDialog.tsx+++ b/gateway/src/pages/connector-apps/UpdateSecretDialog.tsx@@ -18,6 +18,7 @@ import {saveConnectorApp,} from "../../data/api";import { menuLabel, secretFields, UPDATE_SECRET_NOTE } from "./connectorApps";+import { useConnectorAppScope } from "./scope";import { SecretInputs } from "./SetupDialog";/**@@ -35,6 +36,7 @@ export default function UpdateSecretDialog({onClose: () => void;onSaved: (saved: SavedConnectorApp) => void;}) {+ const scope = useConnectorAppScope();const [secrets, setSecrets] = useState<Record<string, string>>({});const [error, setError] = useState<string | null>(null);const [field, setField] = useState<ConnectorAppField | null>(null);@@ -56,7 +58,7 @@ export default function UpdateSecretDialog({setField(null);try {onSaved(- await saveConnectorApp(app.slug, { client_id: app.client_id, ...given, replace: false }),+ await saveConnectorApp(scope, app.slug, { client_id: app.client_id, ...given, replace: false }),);} catch (err) {setError(err instanceof Error ? err.message : String(err));diff --git a/gateway/src/pages/connector-apps/connectorApps.test.ts b/gateway/src/pages/connector-apps/connectorApps.test.tsindex 823cc6163..190aa4629 100644--- a/gateway/src/pages/connector-apps/connectorApps.test.ts+++ b/gateway/src/pages/connector-apps/connectorApps.test.ts@@ -14,6 +14,7 @@ import {moveChecklist,peopleIn,primaryAction,+ notSetUpSentence,removeWarning,secretSummary,sentBackTo,@@ -370,3 +371,25 @@ describe("moving off configuration", () => {expect(after.map((item) => item.done)).toEqual([true, false, false]);});});++describe("an organization's apps", () => {+ const none = { source: "none" as const, client_id: null, saved_client_id: null };++ it("says whether its workspaces fall back to the server's app", () => {+ expect(notSetUpSentence(app({ ...none, server_app: true }))).toBe(+ "Your workspaces use the server's Google client. Add your organization's own to use that instead.",+ );+ expect(notSetUpSentence(app({ ...none, server_app: false }))).toBe(+ "People in your organization can't connect Google Workspace until you add your organization's Google client.",+ );+ });++ it("warns that removing one sends its workspaces back to the server's", () => {+ expect(removeWarning(app({ server_app: true, connected_members: 1 }))).toBe(+ "Your workspaces go back to the server's Google Workspace app. The 1 person connected now must reconnect.",+ );+ expect(removeWarning(app({ server_app: false, connected_members: 0 }))).toBe(+ "Nobody will be able to connect Google Workspace.",+ );+ });+});diff --git a/gateway/src/pages/connector-apps/connectorApps.ts b/gateway/src/pages/connector-apps/connectorApps.tsindex 625c11d61..c234a070f 100644--- a/gateway/src/pages/connector-apps/connectorApps.ts+++ b/gateway/src/pages/connector-apps/connectorApps.ts@@ -150,6 +150,12 @@ export function cardOrder(}export function notSetUpSentence(app: ConnectorApp): string {+ const what = app.kind === "github_app" ? "GitHub App" : `${vendorName(app)} client`;+ // An organization's page: its workspaces may use the server's app meanwhile.+ if (app.server_app === true)+ return `Your workspaces use the server's ${what}. Add your organization's own to use that instead.`;+ if (app.server_app === false)+ return `People in your organization can't connect ${app.name} until you add your organization's ${what}.`;return app.kind === "github_app"? "People can't connect GitHub until you add Switch's GitHub App.": `People can't connect ${app.name} until you add Switch's ${vendorName(app)} client.`;@@ -408,6 +414,13 @@ export function switchWarning(app: ConnectorApp, impact: ConnectorAppImpact): stexport function removeWarning(app: ConnectorApp): string {const name = app.name;+ if (app.server_app === true) {+ const back = `Your workspaces go back to the server's ${name} app.`;+ if (app.connected_members === 0) return back;+ const people =+ app.connected_members === 1 ? "The 1 person" : `The ${app.connected_members} people`;+ return `${back} ${people} connected now must reconnect.`;+ }if (app.connected_members === 0) return `Nobody will be able to connect ${name}.`;const people =app.connected_members === 1 ? "the 1 person" : `the ${app.connected_members} people`;diff --git a/gateway/src/pages/connector-apps/scope.ts b/gateway/src/pages/connector-apps/scope.tsnew file mode 100644index 000000000..b0d120594--- /dev/null+++ b/gateway/src/pages/connector-apps/scope.ts@@ -0,0 +1,10 @@+import { createContext, useContext } from "react";+import type { ConnectorAppScope } from "../../data/api";++/** Whose apps the cards under it change: the server's, unless an+ * organization's page says otherwise. */+export const ConnectorAppScopeContext = createContext<ConnectorAppScope>("server");++export function useConnectorAppScope(): ConnectorAppScope {+ return useContext(ConnectorAppScopeContext);+}diff --git a/gateway/src/pages/organization/OrganizationAuditSection.tsx b/gateway/src/pages/organization/OrganizationAuditSection.tsxindex 319e73649..56deb1ae0 100644--- a/gateway/src/pages/organization/OrganizationAuditSection.tsx+++ b/gateway/src/pages/organization/OrganizationAuditSection.tsx@@ -14,6 +14,8 @@ const ACTION_LABELS: Record<string, string> = {"organization.workspace_created": "Workspace added","organization.role_changed": "Organization role changed","organization.member_removed": "Member removed",+ "organization.connector_app_saved": "Connector app saved",+ "organization.connector_app_removed": "Connector app removed",};const COLUMNS: GridColDef<OrganizationAuditEvent>[] = [diff --git a/gateway/src/pages/organization/OrganizationConnectorsSection.tsx b/gateway/src/pages/organization/OrganizationConnectorsSection.tsxnew file mode 100644index 000000000..c58c0cd7e--- /dev/null+++ b/gateway/src/pages/organization/OrganizationConnectorsSection.tsx@@ -0,0 +1,28 @@+import { Box, Typography } from "@mui/material";+import { ConnectorAppsList } from "../connector-apps/ConnectorAppsPage";+import { sentBackTo } from "../connector-apps/connectorApps";++function Heading({ publicUrl }: { publicUrl: string | null }) {+ return (+ <Box mb={2}>+ <Typography variant="h6">Connectors</Typography>+ <Typography variant="body2" color="text.secondary">+ Your organization can register its own app at a vendor, and every workspace in it signs+ in through that one instead of the server's.+ {publicUrl !== null && ` ${sentBackTo(publicUrl)}`}+ </Typography>+ </Box>+ );+}++/** The apps the organization's workspaces sign in through, for its admins.+ * Shown only where the server lets organizations save their own. */+export default function OrganizationConnectorsSection() {+ return (+ <ConnectorAppsList+ scope="organization"+ notEnabled={null}+ heading={(publicUrl) => <Heading publicUrl={publicUrl} />}+ />+ );+}diff --git a/gateway/src/pages/organization/OrganizationPage.test.tsx b/gateway/src/pages/organization/OrganizationPage.test.tsxindex adb93c833..5c76aee0e 100644--- a/gateway/src/pages/organization/OrganizationPage.test.tsx+++ b/gateway/src/pages/organization/OrganizationPage.test.tsx@@ -2,6 +2,7 @@ import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-liimport { afterEach, describe, expect, it, vi } from "vitest";import type { Session } from "../../data/api";import { useAuth } from "../../data/AuthContext";+import { app } from "../connector-apps/testFixtures";import OrganizationPage from "./OrganizationPage";vi.mock("../../data/AuthContext", () => ({ useAuth: vi.fn() }));@@ -117,6 +118,74 @@ describe("OrganizationPage", () => {expect(screen.getByText("Olga (platform operator)")).toBeTruthy();});+ it("shows an organization admin its connector apps, and changes them as its own", async () => {+ signedInAs(session("org_admin", true));+ const fetchMock = answer({+ "GET /organizations/current": { id: "o1", slug: "acme", name: "Acme Inc", role: "org_admin" },+ "GET /organizations/current/workspaces": [workspace("t1", "Acme")],+ "GET /organizations/current/members": [],+ "GET /organizations/current/audit-events": [],+ "GET /organizations/current/connector-apps": {+ public_url: "https://switch.example.test",+ apps: [+ app({ server_app: true }),+ app({+ slug: "airtable",+ name: "Airtable",+ source: "none",+ client_id: null,+ saved_client_id: null,+ secrets: { client_secret: { set: false, last4: null } },+ connected_members: 0,+ workspaces: 0,+ server_app: true,+ }),+ ],+ },+ "POST /organizations/current/connector-apps/google-workspace/check": { ok: true, checks: [] },+ });++ render(<OrganizationPage />);++ expect(await screen.findByRole("heading", { name: "Connectors" })).toBeTruthy();+ expect(+ screen.getByText(+ "Your workspaces use the server's Airtable client. Add your organization's own to use that instead.",+ ),+ ).toBeTruthy();+ const google = screen.getByTestId("connector-app-google-workspace");+ fireEvent.click(within(google).getByRole("button", { name: "Check it works" }));+ await waitFor(() =>+ expect(fetchMock).toHaveBeenCalledWith(+ "/gateway/organizations/current/connector-apps/google-workspace/check",+ expect.objectContaining({ method: "POST" }),+ ),+ );+ });++ it("shows no connectors where the server keeps them to itself", async () => {+ signedInAs(session("org_admin", true));+ const fetchMock = answer({+ "GET /organizations/current": { id: "o1", slug: "acme", name: "Acme Inc", role: "org_admin" },+ "GET /organizations/current/workspaces": [workspace("t1", "Acme")],+ "GET /organizations/current/members": [],+ "GET /organizations/current/audit-events": [],+ });++ render(<OrganizationPage />);++ expect(await screen.findByRole("heading", { name: "Members" })).toBeTruthy();+ await waitFor(() =>+ expect(fetchMock).toHaveBeenCalledWith(+ "/gateway/organizations/current/connector-apps",+ expect.anything(),+ ),+ );+ await waitFor(() => expect(screen.queryByRole("progressbar")).toBeNull());+ expect(screen.queryByRole("heading", { name: "Connectors" })).toBeNull();+ expect(screen.queryByText(/unmocked/)).toBeNull();+ });+it("shows what a demotion could not revoke at a vendor", async () => {signedInAs(session("org_admin", true));const bob = {diff --git a/gateway/src/pages/organization/OrganizationPage.tsx b/gateway/src/pages/organization/OrganizationPage.tsxindex 6a7fb35a2..a4ae872bb 100644--- a/gateway/src/pages/organization/OrganizationPage.tsx+++ b/gateway/src/pages/organization/OrganizationPage.tsx@@ -5,6 +5,7 @@ import { fetchCurrentOrganization } from "../../data/api";import { administersOrganization } from "../../data/sessionState";import { useLoad } from "../workspace/useLoad";import OrganizationAuditSection from "./OrganizationAuditSection";+import OrganizationConnectorsSection from "./OrganizationConnectorsSection";import OrganizationMembersSection from "./OrganizationMembersSection";import WorkspacesSection from "./WorkspacesSection";@@ -42,6 +43,7 @@ export default function OrganizationPage() {{(isAdmin || session.user.is_operator) && (<OrganizationMembersSection selfId={session.user.id} asOperator={!isAdmin} />)}+ {isAdmin && <OrganizationConnectorsSection />}{isAdmin && <OrganizationAuditSection />}</Stack></Box>