The open-source agent harness - the runtime layer that turns an LLM into a working agent.
chore: update connectors settings page logic to have 'configured' and 'available' sections (#182)
sayan-truefoundrye0812d93f9f6
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsxindex 1c7a8072e..ae06c4495 100644--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx@@ -2,7 +2,6 @@import { useCallback, useEffect, useMemo, useState, type FormEvent } from 'react';-import { cn } from '@/atoms/lib/cn.js';import { Button } from '@/atoms/primitives/Button.js';import { CatalogLogo } from '@/atoms/primitives/CatalogLogo.js';import { CenteredModal } from '@/atoms/primitives/CenteredModal.js';@@ -106,22 +105,21 @@ const ConnectorSettings = () => {for (const item of matchingConnectors) {if (item.isConfigured) {const authenticated = connectors.authStatusById.get(item.connector.id) ?? item.connector.authenticated;- if (authenticated || !item.connector.requiresAuth) {- result.push(- authenticated === item.connector.authenticated ? item.connector : { ...item.connector, authenticated },- );- }+ result.push(+ authenticated === item.connector.authenticated ? item.connector : { ...item.connector, authenticated },+ );}}return result;}, [connectors.authStatusById, matchingConnectors]);const availableConnectors = useMemo(() => {- const connectedIds = new Set(matchingConnected.map(connector => connector.id));- return matchingConnectors- .filter(({ connector }) => !connectedIds.has(connector.id))- .map(({ connector }) => connector);- }, [matchingConnected, matchingConnectors]);+ const result: ConnectorCatalogEntry[] = [];+ for (const item of matchingConnectors) {+ if (!item.isConfigured) result.push(item.connector);+ }+ return result;+ }, [matchingConnectors]);const runMutation = async (fn: () => Promise<void>) => {setBusy(true);@@ -190,13 +188,7 @@ const ConnectorSettings = () => {}void runMutation(async () => {- const existing = connectors.ordered.find(({ connector }) => connector.id === entry.id);- const existingConnector = existing?.isConfigured ? existing.connector : undefined;- if (existingConnector) {- await authorizeOAuthConnector(existingConnector.id);- } else {- await createFromCatalog(entry);- }+ await createFromCatalog(entry);}).catch(() => {});};@@ -284,18 +276,12 @@ const ConnectorSettings = () => {<div className="flex items-center gap-2"><div className="flex items-center gap-2">- <span- className={cn(- 'flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs font-medium',- connector.authenticated ? 'text-success' : 'text-foreground',- )}- >- <span- className={cn('h-1.5 w-1.5 rounded-full', connector.authenticated ? 'bg-success' : 'bg-primary')}- ></span>- {connector.authenticated ? 'Connected' : 'Added'}- </span>- <Icon name="chevron-right" className="size-4" />+ {connector.auth.type !== 'dcr' ? (+ <span className="flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs font-medium text-success">+ <span className="h-1.5 w-1.5 rounded-full bg-success"></span>+ Connected+ </span>+ ) : null}</div>{connector.auth.type === 'header' ? (<Button@@ -313,6 +299,7 @@ const ConnectorSettings = () => {Replace Key</Button>) : null}+ <Icon name="chevron-right" className="size-4" /></div></article>);@@ -363,7 +350,7 @@ const ConnectorSettings = () => {handleConnect(entry);}}>- Connect+ {entry.auth.type === 'dcr' ? 'Add' : 'Connect'}</Button></div></article>@@ -434,7 +421,7 @@ const ConnectorSettings = () => {id="connected-connectors-heading"className="mb-2 text-[0.8125rem] font-semibold uppercase text-muted-foreground">- Connected · {matchingConnected.length}+ Configured · {matchingConnected.length}</h4><div className="overflow-hidden rounded-xl border border-border bg-card">{matchingConnected.map(connector => renderConnector(connector, true))}