mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-11 08:42:39 +02:00
make the count of connectors consistent with number of servers
This commit is contained in:
parent
be0e840333
commit
ab9565dcec
3 changed files with 27 additions and 3 deletions
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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 = () => {
|
||||||
|
|
|
||||||
|
|
@ -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}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue