mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-30 21:59:46 +02:00
refactor(web): consume runtime config in connectors and document uploads
This commit is contained in:
parent
c5dd55e964
commit
bc31b10ca6
5 changed files with 22 additions and 12 deletions
|
|
@ -43,11 +43,6 @@ export const CirclebackConfig: FC<CirclebackConfigProps> = ({ connector, onNameC
|
|||
if (!connector.search_space_id) return;
|
||||
|
||||
const baseUrl = BACKEND_URL;
|
||||
if (!baseUrl) {
|
||||
console.error("NEXT_PUBLIC_FASTAPI_BACKEND_URL is not configured");
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import type { FC } from "react";
|
|||
import { EnumConnectorName } from "@/contracts/enums/connector";
|
||||
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
|
||||
import { usePlatform } from "@/hooks/use-platform";
|
||||
import { isSelfHosted } from "@/lib/env-config";
|
||||
import { useIsSelfHosted } from "@/components/providers/runtime-config";
|
||||
import { ConnectorCard } from "../components/connector-card";
|
||||
import {
|
||||
COMPOSIO_CONNECTORS,
|
||||
|
|
@ -22,6 +22,11 @@ type OAuthConnector = (typeof OAUTH_CONNECTORS)[number];
|
|||
type ComposioConnector = (typeof COMPOSIO_CONNECTORS)[number];
|
||||
type OtherConnector = (typeof OTHER_CONNECTORS)[number];
|
||||
type CrawlerConnector = (typeof CRAWLERS)[number];
|
||||
type DeploymentFilterableConnector = {
|
||||
readonly id: string;
|
||||
readonly selfHostedOnly?: boolean;
|
||||
readonly desktopOnly?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extract the display name from a full connector name.
|
||||
|
|
@ -66,14 +71,14 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
|
|||
onManage,
|
||||
onViewAccountsList,
|
||||
}) => {
|
||||
const selfHosted = isSelfHosted();
|
||||
const selfHosted = useIsSelfHosted();
|
||||
const { isDesktop } = usePlatform();
|
||||
|
||||
const matchesSearch = (title: string, description: string) =>
|
||||
title.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
description.toLowerCase().includes(searchQuery.toLowerCase());
|
||||
|
||||
const passesDeploymentFilter = (c: { selfHostedOnly?: boolean; desktopOnly?: boolean }) =>
|
||||
const passesDeploymentFilter = (c: DeploymentFilterableConnector) =>
|
||||
(!c.selfHostedOnly || selfHosted) && (!c.desktopOnly || isDesktop);
|
||||
|
||||
// Filter connectors based on search and deployment mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue