diff --git a/apps/webapp/app/components/graph/graph.tsx b/apps/webapp/app/components/graph/graph.tsx index cdda52d..3cd16a9 100644 --- a/apps/webapp/app/components/graph/graph.tsx +++ b/apps/webapp/app/components/graph/graph.tsx @@ -310,7 +310,7 @@ export const Graph = forwardRef( ...settings, barnesHutOptimize: true, strongGravityMode: false, - gravity: 0.1, + gravity: 1, scalingRatio: 10, slowDown: 5, }, diff --git a/apps/webapp/app/components/logs/log-text-collapse.tsx b/apps/webapp/app/components/logs/log-text-collapse.tsx index f5bdff4..7d7cd7f 100644 --- a/apps/webapp/app/components/logs/log-text-collapse.tsx +++ b/apps/webapp/app/components/logs/log-text-collapse.tsx @@ -20,6 +20,7 @@ interface LogTextCollapseProps { text?: string; error?: string; logData: any; + id: string; episodeUUID?: string; } @@ -27,6 +28,7 @@ export function LogTextCollapse({ episodeUUID, text, error, + id, logData, }: LogTextCollapseProps) { const [dialogOpen, setDialogOpen] = useState(false); @@ -34,17 +36,16 @@ export function LogTextCollapse({ const deleteFetcher = useFetcher(); const handleDelete = () => { - console.log(logData); if (!episodeUUID) { console.error("No episodeUuid found in log data"); return; } deleteFetcher.submit( - { episodeUuid: episodeUUID }, + { id }, { method: "DELETE", - action: "/api/v1/episode/delete", + action: "/api/v1/ingestion_queue/delete", encType: "application/json", }, ); diff --git a/apps/webapp/app/components/logs/virtual-logs-list.tsx b/apps/webapp/app/components/logs/virtual-logs-list.tsx index be9484a..3525287 100644 --- a/apps/webapp/app/components/logs/virtual-logs-list.tsx +++ b/apps/webapp/app/components/logs/virtual-logs-list.tsx @@ -100,6 +100,7 @@ function LogItemRenderer( text={log.ingestText} error={log.error} logData={log.data} + id={log.id} episodeUUID={log.episodeUUID} /> diff --git a/apps/webapp/app/routes/api.v1.episode.delete.tsx b/apps/webapp/app/routes/api.v1.ingestion_queue.delete.tsx similarity index 73% rename from apps/webapp/app/routes/api.v1.episode.delete.tsx rename to apps/webapp/app/routes/api.v1.ingestion_queue.delete.tsx index 94c5ef0..80bf33e 100644 --- a/apps/webapp/app/routes/api.v1.episode.delete.tsx +++ b/apps/webapp/app/routes/api.v1.ingestion_queue.delete.tsx @@ -2,9 +2,13 @@ import { z } from "zod"; import { json } from "@remix-run/node"; import { createHybridActionApiRoute } from "~/services/routeBuilders/apiBuilder.server"; import { deleteEpisodeWithRelatedNodes } from "~/services/graphModels/episode"; +import { + deleteIngestionQueue, + getIngestionQueue, +} from "~/services/ingestionLogs.server"; export const DeleteEpisodeBodyRequest = z.object({ - episodeUuid: z.string().uuid("Episode UUID must be a valid UUID"), + id: z.string(), }); const { action, loader } = createHybridActionApiRoute( @@ -19,8 +23,22 @@ const { action, loader } = createHybridActionApiRoute( }, async ({ body, authentication }) => { try { + const ingestionQueue = await getIngestionQueue(body.id); + + if (!ingestionQueue) { + return json( + { + error: "Episode not found or unauthorized", + code: "not_found", + }, + { status: 404 }, + ); + } + + const output = ingestionQueue.output as any; + const result = await deleteEpisodeWithRelatedNodes({ - episodeUuid: body.episodeUuid, + episodeUuid: output?.episodeUuid, userId: authentication.userId, }); @@ -34,6 +52,8 @@ const { action, loader } = createHybridActionApiRoute( ); } + await deleteIngestionQueue(ingestionQueue.id); + return json({ success: true, message: "Episode deleted successfully", diff --git a/apps/webapp/app/routes/api.v1.test-hybrid.tsx b/apps/webapp/app/routes/api.v1.test-hybrid.tsx deleted file mode 100644 index f402b77..0000000 --- a/apps/webapp/app/routes/api.v1.test-hybrid.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { json } from "@remix-run/node"; -import { z } from "zod"; -import { createHybridActionApiRoute } from "~/services/routeBuilders/apiBuilder.server"; - -const TestSchema = z.object({ - message: z.string(), -}); - -// This route can be called with either: -// 1. Personal access token: Authorization: Bearer -// 2. Cookie-based authentication (when logged in via browser) -const { action, loader } = createHybridActionApiRoute( - { - body: TestSchema, - method: "POST", - corsStrategy: "all", - }, - async ({ body, authentication }) => { - return json({ - success: true, - message: body.message, - authType: authentication.type, - userId: authentication.userId, - // Only include scopes if it's API key authentication - ...(authentication.type === "PRIVATE" && { scopes: authentication.scopes }), - }); - }, -); - -export { action, loader }; \ No newline at end of file diff --git a/apps/webapp/app/services/ingestionLogs.server.ts b/apps/webapp/app/services/ingestionLogs.server.ts index 40403f0..65baca5 100644 --- a/apps/webapp/app/services/ingestionLogs.server.ts +++ b/apps/webapp/app/services/ingestionLogs.server.ts @@ -44,3 +44,19 @@ export async function getIngestionLogs( }, }; } + +export const getIngestionQueue = async (id: string) => { + return await prisma.ingestionQueue.findUnique({ + where: { + id, + }, + }); +}; + +export const deleteIngestionQueue = async (id: string) => { + return await prisma.ingestionQueue.delete({ + where: { + id, + }, + }); +}; diff --git a/apps/webapp/app/trigger/integrations/integration-run.ts b/apps/webapp/app/trigger/integrations/integration-run.ts index c3f1bef..5893993 100644 --- a/apps/webapp/app/trigger/integrations/integration-run.ts +++ b/apps/webapp/app/trigger/integrations/integration-run.ts @@ -272,7 +272,7 @@ async function handleMessageResponse( // Handle "activity" messages if (grouped["activity"]) { - return await handleActivityMessage( + await handleActivityMessage( grouped["activity"], integrationAccountId as string, userId, @@ -281,7 +281,7 @@ async function handleMessageResponse( // Handle "state" messages if (grouped["state"]) { - return await handleStateMessage( + await handleStateMessage( grouped["state"], integrationAccountId as string, ); @@ -289,12 +289,12 @@ async function handleMessageResponse( // Handle "identifier" messages if (grouped["identifier"]) { - return await handleIdentifierMessage(grouped["identifier"][0]); + await handleIdentifierMessage(grouped["identifier"][0]); } // Handle "account" messages (these may involve Prisma writes) if (grouped["account"]) { - return await handleAccountMessage( + await handleAccountMessage( grouped["account"], integrationDefinition, workspaceId,