feat(ui): match the plugin model connect page to Connect account

The Plugins connect page for a model provider now uses the inline
sign-in panel of the agent configuration dialog. The provider card
fills the column, the sign-in environment select is gone from this
page, and the Back and Sign in footer is removed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
TonioandClaude Fable 5.2 committed 2026-12-03 14:04:25 -08:00
1 parent 23ca89e376
commit 16c9ccf721
4 files changed
+19 -12

No files matched your search

@@ -29,6 +29,8 @@ type Props = {
name: string;
hideName?: boolean;
defaultAccountDialog?: boolean;
/** The Plugins connect page: one column, sign-in inside the card, no sign-in environment choice. */
connectPage?: boolean;
providerDialog?: boolean;
onOtherModels?: () => void;
advancedProviders?: ReactNode;
@@ -50,7 +52,7 @@ export function AiConnectionCredentialStep(props: Props) {
return <SubscriptionConnectionStep {...props} />;
}
function SubscriptionConnectionStep({ defaultAccountDialog, providerDialog, onOtherModels, advancedProviders, companyId, provider, initialMethod, fixedMethod, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, loginAgentId, onComplete, onCancel, defaults, disabled }: Props) {
function SubscriptionConnectionStep({ defaultAccountDialog, connectPage, providerDialog, onOtherModels, advancedProviders, companyId, provider, initialMethod, fixedMethod, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, loginAgentId, onComplete, onCancel, defaults, disabled }: Props) {
const [name, setName] = useState(initialName);
const [draftMethod, setDraftMethod] = useState<"subscription" | "api">(initialMethod === "api_key" ? "api" : "subscription");
const [draftKey, setDraftKey] = useState("");
@@ -115,11 +117,11 @@ function SubscriptionConnectionStep({ defaultAccountDialog, providerDialog, onOt
const loading = [envs, caps, settings, experimental, general].some((query) => query.isPending) || (provider === "google" && health.isPending) || views.some((view) => view.kind === "reconnecting");
const loadError = views.find((view) => view.kind === "error");
const intent: AiConnectionLoginIntent = { provider: provider as AiConnectionLoginIntent["provider"], method: "subscription", name, ownership, agentIds, allAgents, connectionId };
const dialogFields = defaultAccountDialog && (provider === "anthropic" || provider === "openai");
const accountFields = <>{!hideName && <label className="grid gap-2 text-sm">Connection name<Input value={name} onChange={(event) => setName(event.target.value)} disabled={Boolean(connectionId)} /></label>}{!providerDialog && defaults}</>;
return <div className={dialogFields || providerDialog ? "w-full min-w-0 space-y-6" : "mx-auto w-full min-w-0 max-w-xl space-y-6"}>
const dialogFields = connectPage || (defaultAccountDialog && (provider === "anthropic" || provider === "openai"));
const accountFields = <>{!hideName && <label className="grid gap-2 text-sm">Connection name<Input className={connectPage ? "h-auto px-4 py-3 md:leading-5" : undefined} value={name} onChange={(event) => setName(event.target.value)} disabled={Boolean(connectionId)} /></label>}{!providerDialog && (connectPage && defaults ? <div className="*:mt-0">{defaults}</div> : defaults)}</>;
return <div className={connectPage ? "mx-auto w-full min-w-0 max-w-xl space-y-6" : dialogFields || providerDialog ? "w-full min-w-0 space-y-6" : "mx-auto w-full min-w-0 max-w-xl space-y-6"}>
{!dialogFields && accountFields}
{!suppliedEnvironmentId && !forced.forced && loginEnvironments.length > 1 && <Select value={environmentId ?? ""} onValueChange={setChosenEnvironment}>
{!connectPage && !suppliedEnvironmentId && !forced.forced && loginEnvironments.length > 1 && <Select value={environmentId ?? ""} onValueChange={setChosenEnvironment}>
<SelectTrigger className={ANALYTICS_MASK_CLASS} aria-label="Sign-in environment"><SelectValue placeholder="Sign-in environment" /></SelectTrigger>
<SelectContent className={ANALYTICS_MASK_CLASS}>{loginEnvironments.map((env) => <SelectItem key={env.id} value={env.id}>{env.name}</SelectItem>)}</SelectContent>
</Select>}
@@ -137,12 +139,12 @@ function SubscriptionConnectionStep({ defaultAccountDialog, providerDialog, onOt
onBack={onCancel}
onConnected={() => {}}
testConnection={async () => false}
managedAccount={{ draft: dialogFields ? { method: draftMethod, setMethod: setDraftMethod, apiKey: draftKey, setApiKey: setDraftKey } : undefined, preparingEnvironment: loading, providerDialog, accessSettings: providerDialog ? defaults : undefined, defaultAccountDialog, onOtherModels, accountFields: dialogFields ? accountFields : undefined, advancedProviders, intent, nameForMethod, initialMethod, fixedMethod: fixedMethod ?? Boolean(connectionId), disabled: disabled || loading || Boolean(environmentError) || Boolean(loadError) || !name.trim(), onComplete: (result) => { void client.invalidateQueries({ queryKey: ["ai-connections", companyId] }); void client.invalidateQueries({ queryKey: ["tools"] }); onComplete(result); } }}
managedAccount={{ draft: dialogFields ? { method: draftMethod, setMethod: setDraftMethod, apiKey: draftKey, setApiKey: setDraftKey } : undefined, preparingEnvironment: loading, providerDialog, accessSettings: providerDialog ? defaults : undefined, defaultAccountDialog, connectPage, onOtherModels, accountFields: dialogFields ? accountFields : undefined, advancedProviders, intent, nameForMethod, initialMethod, fixedMethod: fixedMethod ?? Boolean(connectionId), disabled: disabled || loading || Boolean(environmentError) || Boolean(loadError) || !name.trim(), onComplete: (result) => { void client.invalidateQueries({ queryKey: ["ai-connections", companyId] }); void client.invalidateQueries({ queryKey: ["tools"] }); onComplete(result); } }}
/>}
</div>;
}
function ApiKeyConnectionStep({ providerDialog, onOtherModels, advancedProviders, companyId, provider, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, defaults, disabled, onComplete, onCancel }: Props) {
function ApiKeyConnectionStep({ providerDialog, connectPage, onOtherModels, advancedProviders, companyId, provider, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, defaults, disabled, onComplete, onCancel }: Props) {
const [name, setName] = useState(initialName);
const [apiKey, setApiKey] = useState("");
const client = useQueryClient();
@@ -171,6 +173,6 @@ function ApiKeyConnectionStep({ providerDialog, onOtherModels, advancedProviders
<ProviderApiKeyCard providerName={copilot ? "GitHub Copilot" : provider === "google" ? "Antigravity" : "OpenRouter"} value={apiKey} onChange={setApiKey} onSubmit={() => { if (!preparing && !environmentError && name.trim() && apiKey.trim()) save.mutate(); }} disabled={disabled || save.isPending || preparing || Boolean(environmentError)} placeholder={copilot ? "github_pat_..." : "Enter API key here"} autoFocus />
{defaults}
{advancedProviders}
<div className="flex justify-between gap-2">{!onOtherModels && <Button variant="ghost" onClick={onCancel}>Cancel</Button>}<Button className="ml-auto" disabled={disabled || !name.trim() || !apiKey.trim() || save.isPending || preparing || Boolean(environmentError)} onClick={() => save.mutate()}>{save.isPending ? "Connecting…" : "Connect"}</Button></div>
<div className="flex justify-between gap-2">{!onOtherModels && !connectPage && <Button variant="ghost" onClick={onCancel}>Cancel</Button>}<Button className="ml-auto" disabled={disabled || !name.trim() || !apiKey.trim() || save.isPending || preparing || Boolean(environmentError)} onClick={() => save.mutate()}>{save.isPending ? "Connecting…" : "Connect"}</Button></div>
</div>;
}
@@ -66,7 +66,7 @@ afterEach(() => {
host.remove();
});
function renderConnection(adapterType: "antigravity_runtime" | "claude_local" | "codex_local", localEnvironment: boolean, presentation: boolean | "other-models" = false, onComplete = vi.fn()) {
function renderConnection(adapterType: "antigravity_runtime" | "claude_local" | "codex_local", localEnvironment: boolean, presentation: boolean | "other-models" | "connect-page" = false, onComplete = vi.fn()) {
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
const provider = adapterType === "antigravity_runtime" ? "google" : adapterType === "claude_local" ? "anthropic" : "openai";
flushSync(() => {
@@ -84,6 +84,7 @@ function renderConnection(adapterType: "antigravity_runtime" | "claude_local" |
managedAccount={{
defaultAccountDialog: presentation === true,
providerDialog: presentation === "other-models",
connectPage: presentation === "connect-page",
intent: {
provider,
method: "subscription",
@@ -105,6 +106,7 @@ describe("Connect account dialog", () => {
["claude_local", "Waiting for code…", true],
["codex_local", "Waiting…", true],
["codex_local", "Waiting…", "other-models"],
["claude_local", "Waiting for code…", "connect-page"],
] as const)("keeps %s sign-in in the panel", async (adapter, waiting, presentation) => {
mocks.healthGet.mockResolvedValue({ localAiLoginSupported: true });
mocks.checkLocalLogin.mockResolvedValue({
@@ -77,6 +77,8 @@ export function AgentProviderConnection({
/** Connections supplies its access intent; presentation and login controllers stay shared. */
managedAccount?: {
defaultAccountDialog?: boolean;
/** The Plugins connect page shares the dialog's inline sign-in card. */
connectPage?: boolean;
providerDialog?: boolean;
accessSettings?: ReactNode;
preparingEnvironment?: boolean;
@@ -306,7 +308,7 @@ export function AgentProviderConnection({
onBeforeRetry: () => setError(null),
});
const localLoginAction = localLoginPrimary.action;
const wizardCard = managedAccount?.defaultAccountDialog;
const wizardCard = managedAccount?.defaultAccountDialog || managedAccount?.connectPage;
const inlineLogin = Boolean((wizardCard || managedAccount?.providerDialog) && opened && method === "subscription");
const localReady = inlineLogin && !needsLogin && canUseLocalLogin && localLogin.status === "ready";
const autoSaved = useRef(false);
@@ -419,7 +421,7 @@ export function AgentProviderConnection({
revealTogether={wizardCard}
instruction={wizardCard ? <span className="grid gap-1">
<span>Provide your {provider} API key to connect.</span>
<span>This will be your default {provider} account.</span>
{managedAccount?.defaultAccountDialog && <span>This will be your default {provider} account.</span>}
</span> :
savedKeys.options.length
? "Choose a saved API key or enter a new one"
@@ -559,7 +561,7 @@ export function AgentProviderConnection({
{managedAccount?.accessSettings && <div className="mt-6">{managedAccount.accessSettings}</div>}
{managedAccount?.advancedProviders && <div className="pt-2">{managedAccount.advancedProviders}</div>}
{(!inlineLogin || (localReady && error)) && <FooterNav
onBack={managedAccount?.onOtherModels || managedAccount?.defaultAccountDialog || managedAccount?.providerDialog ? undefined : () => {
onBack={managedAccount?.onOtherModels || wizardCard || managedAccount?.providerDialog ? undefined : () => {
if (opened && !advancedConnection) {
localLoginPrimary.resetSubmitting();
cancel();
@@ -2731,6 +2731,7 @@ function StandardConnectionSetupFlow({
accessLevel: configValues.accessLevel === "full" || configValues.accessLevel === "read_only" ? configValues.accessLevel : undefined,
});
const credentialStep = awsRoleStep ?? (entry ? renderCredentialStep?.({ app: entry, name: galleryName || entry.name, grantKind: effectiveGrantKind, agentIds: [...installAgentIds], allAgents: installChoice === "all", onBack: () => backToGallery() }) ?? (aiMethod && selectedCompanyId ? <><AiConnectionCredentialStep
connectPage
defaults={reconnectConnection ? undefined : connectionDefaults}
companyId={selectedCompanyId} provider={aiMethod.provider} fixedMethod={Boolean(aiConnection && aiConnection.mode !== "responsible_user")} initialMethod={reconnectConnection?.connectionPurpose === "ai" ? (reconnectConnection.config?.ai as { method: "subscription" | "api_key" }).method : aiMethod.method}
connectionId={reconnectConnection?.connectionPurpose === "ai" ? reconnectConnection.id : undefined}