mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-11 08:42:39 +02:00
feat: migrate updateconnector handler
This commit is contained in:
parent
6913a7b59f
commit
3c6f50fa8f
1 changed files with 13 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { useAtomValue, useSetAtom } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import {
|
import {
|
||||||
Calendar as CalendarIcon,
|
Calendar as CalendarIcon,
|
||||||
Clock,
|
Clock,
|
||||||
|
|
@ -16,9 +16,11 @@ import { useParams, useRouter } from "next/navigation";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { deleteConnectorMutationAtom } from "@/atoms/connectors/connector-mutation.atoms";
|
import {
|
||||||
|
deleteConnectorMutationAtom,
|
||||||
|
updateConnectorMutationAtom,
|
||||||
|
} from "@/atoms/connectors/connector-mutation.atoms";
|
||||||
import { connectorsAtom } from "@/atoms/connectors/connector-query.atoms";
|
import { connectorsAtom } from "@/atoms/connectors/connector-query.atoms";
|
||||||
import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
|
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
|
|
@ -91,12 +93,10 @@ export default function ConnectorsPage() {
|
||||||
const { data: connectors = [], isLoading, error } = useAtomValue(connectorsAtom);
|
const { data: connectors = [], isLoading, error } = useAtomValue(connectorsAtom);
|
||||||
|
|
||||||
const { mutateAsync: deleteConnector } = useAtomValue(deleteConnectorMutationAtom);
|
const { mutateAsync: deleteConnector } = useAtomValue(deleteConnectorMutationAtom);
|
||||||
|
const { mutateAsync: updateConnector } = useAtomValue(updateConnectorMutationAtom);
|
||||||
|
|
||||||
// Keep old hook for other mutations (will migrate later)
|
// Keep old hook for other mutations (will migrate later)
|
||||||
const { indexConnector, updateConnector } = useSearchSourceConnectors(
|
const { indexConnector } = useSearchSourceConnectors(true, parseInt(searchSpaceId));
|
||||||
true,
|
|
||||||
parseInt(searchSpaceId)
|
|
||||||
);
|
|
||||||
|
|
||||||
const [connectorToDelete, setConnectorToDelete] = useState<number | null>(null);
|
const [connectorToDelete, setConnectorToDelete] = useState<number | null>(null);
|
||||||
const [indexingConnectorId, setIndexingConnectorId] = useState<number | null>(null);
|
const [indexingConnectorId, setIndexingConnectorId] = useState<number | null>(null);
|
||||||
|
|
@ -231,9 +231,12 @@ export default function ConnectorsPage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await updateConnector(selectedConnectorForPeriodic, {
|
await updateConnector({
|
||||||
periodic_indexing_enabled: periodicEnabled,
|
id: selectedConnectorForPeriodic,
|
||||||
indexing_frequency_minutes: frequency,
|
data: {
|
||||||
|
periodic_indexing_enabled: periodicEnabled,
|
||||||
|
indexing_frequency_minutes: frequency,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
toast.success(
|
toast.success(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue