mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-14 22:52:15 +02:00
fix: removed revamped connectors
This commit is contained in:
parent
a3b22e61e5
commit
898b062bed
20 changed files with 55 additions and 131 deletions
|
|
@ -123,7 +123,7 @@ export default function AirtableConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ export default function BaiduSearchApiPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ export default function BookStackConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ export default function ClickUpConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export default function ConfluenceConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ export default function DiscordConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ export default function ElasticsearchConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ export default function GithubConnectorPage() {
|
||||||
// Reset form PAT field, keep name
|
// Reset form PAT field, keep name
|
||||||
form.reset({ name: connectorName, github_pat: "" });
|
form.reset({ name: connectorName, github_pat: "" });
|
||||||
} else {
|
} else {
|
||||||
router.back();
|
router.push(`/dashboard/${searchSpaceId}/connectors/add`);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ export default function GoogleCalendarConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ export default function GoogleGmailConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ export default function JiraConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export default function LinearConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ export default function LinkupApiPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ export default function LumaConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ export default function NotionConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ export default function SearxngConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ export default function SlackConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ export default function TavilyApiPage() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mb-6"
|
className="mb-6"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
||||||
Back to Connectors
|
Back to Connectors
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ export default function WebcrawlerConnectorPage() {
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.push(`/dashboard/${searchSpaceId}/connectors/add`)}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-quer
|
||||||
import { useSearchSourceConnectors } from "@/hooks/use-search-source-connectors";
|
import { useSearchSourceConnectors } from "@/hooks/use-search-source-connectors";
|
||||||
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||||
import { connectorCategories } from "@/components/sources/connector-data";
|
|
||||||
import {
|
import {
|
||||||
ComposerAddAttachment,
|
ComposerAddAttachment,
|
||||||
ComposerAttachments,
|
ComposerAttachments,
|
||||||
|
|
@ -326,57 +325,10 @@ const ConnectorIndicator: FC = () => {
|
||||||
const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
|
const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
|
||||||
const { connectors, isLoading } = useSearchSourceConnectors(false, searchSpaceId ? Number(searchSpaceId) : undefined);
|
const { connectors, isLoading } = useSearchSourceConnectors(false, searchSpaceId ? Number(searchSpaceId) : undefined);
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [searchQuery, setSearchQuery] = useState("");
|
|
||||||
const closeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
const closeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
const hasConnectors = connectors.length > 0;
|
const hasConnectors = connectors.length > 0;
|
||||||
|
|
||||||
// Get connected connector types for comparison
|
|
||||||
const connectedTypes = new Set(connectors.map(c => c.connector_type));
|
|
||||||
|
|
||||||
// Flatten all available connectors from categories
|
|
||||||
const allAvailableConnectors = connectorCategories.flatMap(category =>
|
|
||||||
category.connectors.filter(c => c.status === "available")
|
|
||||||
);
|
|
||||||
|
|
||||||
// Filter connectors based on search query
|
|
||||||
const filteredConnectors = allAvailableConnectors.filter(connector =>
|
|
||||||
connector.title.toLowerCase().includes(searchQuery.toLowerCase())
|
|
||||||
);
|
|
||||||
|
|
||||||
// Filter connected connectors based on search query
|
|
||||||
const filteredConnectedConnectors = connectors.filter(connector =>
|
|
||||||
connector.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
||||||
);
|
|
||||||
|
|
||||||
// Filter available (not connected) connectors
|
|
||||||
const filteredAvailableConnectors = filteredConnectors.filter(connector => {
|
|
||||||
// Map connector id to connector_type for comparison
|
|
||||||
const connectorTypeMap: Record<string, string> = {
|
|
||||||
"webcrawler-connector": "WEBCRAWLER_CONNECTOR",
|
|
||||||
"tavily-api": "TAVILY_API",
|
|
||||||
"searxng": "SEARXNG_API",
|
|
||||||
"linkup-api": "LINKUP_API",
|
|
||||||
"baidu-search-api": "BAIDU_SEARCH_API",
|
|
||||||
"slack-connector": "SLACK_CONNECTOR",
|
|
||||||
"discord-connector": "DISCORD_CONNECTOR",
|
|
||||||
"linear-connector": "LINEAR_CONNECTOR",
|
|
||||||
"jira-connector": "JIRA_CONNECTOR",
|
|
||||||
"clickup-connector": "CLICKUP_CONNECTOR",
|
|
||||||
"notion-connector": "NOTION_CONNECTOR",
|
|
||||||
"confluence-connector": "CONFLUENCE_CONNECTOR",
|
|
||||||
"bookstack-connector": "BOOKSTACK_CONNECTOR",
|
|
||||||
"github-connector": "GITHUB_CONNECTOR",
|
|
||||||
"elasticsearch-connector": "ELASTICSEARCH_CONNECTOR",
|
|
||||||
"airtable-connector": "AIRTABLE_CONNECTOR",
|
|
||||||
"google-calendar-connector": "GOOGLE_CALENDAR_CONNECTOR",
|
|
||||||
"google-gmail-connector": "GOOGLE_GMAIL_CONNECTOR",
|
|
||||||
"luma-connector": "LUMA_CONNECTOR",
|
|
||||||
};
|
|
||||||
const connectorType = connectorTypeMap[connector.id];
|
|
||||||
return !connectorType || !connectedTypes.has(connectorType);
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleMouseEnter = useCallback(() => {
|
const handleMouseEnter = useCallback(() => {
|
||||||
// Clear any pending close timeout
|
// Clear any pending close timeout
|
||||||
if (closeTimeoutRef.current) {
|
if (closeTimeoutRef.current) {
|
||||||
|
|
@ -390,7 +342,6 @@ const ConnectorIndicator: FC = () => {
|
||||||
// Delay closing by 150ms for better UX
|
// Delay closing by 150ms for better UX
|
||||||
closeTimeoutRef.current = setTimeout(() => {
|
closeTimeoutRef.current = setTimeout(() => {
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
setSearchQuery(""); // Reset search when closing
|
|
||||||
}, 150);
|
}, 150);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
@ -425,75 +376,48 @@ const ConnectorIndicator: FC = () => {
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
side="bottom"
|
side="bottom"
|
||||||
align="start"
|
align="start"
|
||||||
className="w-72 p-0"
|
className="w-64 p-3"
|
||||||
onMouseEnter={handleMouseEnter}
|
onMouseEnter={handleMouseEnter}
|
||||||
onMouseLeave={handleMouseLeave}
|
onMouseLeave={handleMouseLeave}
|
||||||
>
|
>
|
||||||
<div className="flex flex-col max-h-[250px] overflow-hidden rounded-md">
|
{hasConnectors ? (
|
||||||
{/* Search input - sticky at top */}
|
<div className="space-y-2">
|
||||||
<div className="p-2 border-b sticky top-0 bg-popover z-10 rounded-t-md">
|
<p className="text-xs font-medium text-muted-foreground mb-2">
|
||||||
<div className="relative">
|
Connected Sources ({connectors.length})
|
||||||
<Search className="absolute left-2.5 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground" />
|
</p>
|
||||||
<input
|
<div className="flex flex-wrap gap-2">
|
||||||
type="text"
|
{connectors.map((connector) => (
|
||||||
placeholder="Search connectors..."
|
<div
|
||||||
value={searchQuery}
|
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
|
||||||
className="w-full pl-8 pr-3 py-1.5 text-sm bg-transparent border-none outline-none focus:ring-0 placeholder:text-muted-foreground"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Connectors list - scrollable */}
|
|
||||||
<div className="overflow-y-auto flex-1 p-1">
|
|
||||||
{/* Connected connectors first */}
|
|
||||||
{filteredConnectedConnectors.length > 0 && (
|
|
||||||
<>
|
|
||||||
{filteredConnectedConnectors.map((connector) => (
|
|
||||||
<Link
|
|
||||||
key={connector.id}
|
|
||||||
href={`/dashboard/${searchSpaceId}/connectors/${connector.id}`}
|
|
||||||
className="flex items-center justify-between px-2 py-2 rounded-md hover:bg-muted transition-colors group"
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-2.5">
|
|
||||||
<div className="size-6 flex items-center justify-center text-muted-foreground">
|
|
||||||
{getConnectorIcon(connector.connector_type, "size-5")}
|
|
||||||
</div>
|
|
||||||
<span className="text-sm">{connector.name}</span>
|
|
||||||
</div>
|
|
||||||
<CheckCircle2 className="size-4 text-emerald-500" />
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
{filteredAvailableConnectors.length > 0 && (
|
|
||||||
<div className="border-t my-1" />
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Available connectors */}
|
|
||||||
{filteredAvailableConnectors.length > 0 ? (
|
|
||||||
filteredAvailableConnectors.map((connector) => (
|
|
||||||
<Link
|
|
||||||
key={connector.id}
|
key={connector.id}
|
||||||
href={`/dashboard/${searchSpaceId}/connectors/add/${connector.id}`}
|
className="flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs"
|
||||||
className="flex items-center justify-between px-2 py-2 rounded-md hover:bg-muted transition-colors group"
|
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2.5">
|
{getConnectorIcon(connector.connector_type, "size-3")}
|
||||||
<div className="size-6 flex items-center justify-center text-muted-foreground">
|
<span className="truncate max-w-[100px]">{connector.name}</span>
|
||||||
{connector.icon}
|
</div>
|
||||||
</div>
|
))}
|
||||||
<span className="text-sm">{connector.title}</span>
|
</div>
|
||||||
</div>
|
<Link
|
||||||
<Plus className="size-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" />
|
href={`/dashboard/${searchSpaceId}/connectors`}
|
||||||
</Link>
|
className="block text-xs text-primary hover:underline mt-2"
|
||||||
))
|
>
|
||||||
) : filteredConnectedConnectors.length === 0 ? (
|
Manage connectors →
|
||||||
<div className="px-2 py-4 text-center text-sm text-muted-foreground">
|
</Link>
|
||||||
No connectors found
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
) : (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<p className="text-sm font-medium">No connectors yet</p>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Connect your first data source to enhance search results.
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href={`/dashboard/${searchSpaceId}/connectors/add`}
|
||||||
|
className="inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors mt-1"
|
||||||
|
>
|
||||||
|
<Plus className="size-3" />
|
||||||
|
Add Connector
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue