make the count of connectors consistent with number of servers

This commit is contained in:
Manoj Aggarwal 2026-01-16 12:05:13 -08:00
parent be0e840333
commit ab9565dcec
3 changed files with 27 additions and 3 deletions

View file

@ -156,7 +156,15 @@ export const ConnectorIndicator: FC = () => {
const hasConnectors = connectors.length > 0; const hasConnectors = connectors.length > 0;
const hasSources = hasConnectors || activeDocumentTypes.length > 0; const hasSources = hasConnectors || activeDocumentTypes.length > 0;
const totalSourceCount = connectors.length + activeDocumentTypes.length; const totalSourceCount = connectors.length + activeDocumentTypes.length;
const activeConnectorsCount = connectors.length; // Only actual connectors, not document types
// Count connectors properly: for MCP, count each server; for others, count connectors
const activeConnectorsCount = connectors.reduce((total, c: SearchSourceConnector) => {
if (c.connector_type === "MCP_CONNECTOR") {
const serverConfigs = c.config?.server_configs;
return total + (Array.isArray(serverConfigs) ? serverConfigs.length : 0);
}
return total + 1;
}, 0);
// Check which connectors are already connected // Check which connectors are already connected
const connectedTypes = new Set( const connectedTypes = new Set(

View file

@ -218,7 +218,14 @@ export const ActiveConnectorsTab: FC<ActiveConnectorsTabProps> = ({
connectorType, connectorType,
documentTypeCounts documentTypeCounts
); );
const accountCount = typeConnectors.length; // Calculate account count - for MCP, count servers; for others, count connectors
const accountCount =
connectorType === "MCP_CONNECTOR"
? typeConnectors.reduce((total, c) => {
const serverConfigs = c.config?.server_configs;
return total + (Array.isArray(serverConfigs) ? serverConfigs.length : 0);
}, 0)
: typeConnectors.length;
const mostRecentLastIndexed = getMostRecentLastIndexed(typeConnectors); const mostRecentLastIndexed = getMostRecentLastIndexed(typeConnectors);
const handleManageClick = () => { const handleManageClick = () => {

View file

@ -103,6 +103,15 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
) )
: []; : [];
// Calculate account count - for MCP, count servers; for others, count connectors
const accountCount =
connector.connectorType === "MCP_CONNECTOR"
? typeConnectors.reduce((total, c) => {
const serverConfigs = c.config?.server_configs;
return total + (Array.isArray(serverConfigs) ? serverConfigs.length : 0);
}, 0)
: typeConnectors.length;
// Get the most recent last_indexed_at across all accounts // Get the most recent last_indexed_at across all accounts
const mostRecentLastIndexed = typeConnectors.reduce<string | undefined>( const mostRecentLastIndexed = typeConnectors.reduce<string | undefined>(
(latest, c) => { (latest, c) => {
@ -138,7 +147,7 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
isConnected={isConnected} isConnected={isConnected}
isConnecting={isConnecting} isConnecting={isConnecting}
documentCount={documentCount} documentCount={documentCount}
accountCount={typeConnectors.length} accountCount={accountCount}
lastIndexedAt={mostRecentLastIndexed} lastIndexedAt={mostRecentLastIndexed}
isIndexing={isIndexing} isIndexing={isIndexing}
activeTask={activeTask} activeTask={activeTask}