Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

refactor(knowledge): simplify delete dialog structure and type definitions

Phil Nashcf10622ebee8
diff --git a/frontend/app/knowledge/page.tsx b/frontend/app/knowledge/page.tsx
index 5438438d8..1fa5122a4 100644
--- a/frontend/app/knowledge/page.tsx
+++ b/frontend/app/knowledge/page.tsx
@@ -443,11 +443,9 @@ function SearchPage() {
onConfirm={handleBulkDelete}
isLoading={deleteDocumentMutation.isPending}
>
- <div className="text-sm text-muted-foreground">
- <p className="my-2">This will remove all chunks and data associated with these documents. This action cannot be undone.</p>
- <p className="my-2">Documents to be deleted:</p>
- {formatFilesToDelete(selectedRows)}
- </div>
+ <p className="my-2">This will remove all chunks and data associated with these documents. This action cannot be undone.</p>
+ <p className="my-2">Documents to be deleted:</p>
+ {formatFilesToDelete(selectedRows)}
</DeleteConfirmationDialog>
</>
);
diff --git a/frontend/components/delete-confirmation-dialog.tsx b/frontend/components/delete-confirmation-dialog.tsx
index ad6a46cee..688c31704 100644
--- a/frontend/components/delete-confirmation-dialog.tsx
+++ b/frontend/components/delete-confirmation-dialog.tsx
@@ -1,6 +1,6 @@
"use client";
-import React, { ReactElement } from "react";
+import React, { ReactNode } from "react";
import {
Dialog,
DialogContent,
@@ -21,7 +21,7 @@ import { AlertTriangle } from "lucide-react";
export function formatFilesToDelete(
files: Array<{ filename: string }>,
maxVisible = 5,
-): ReactElement {
+): ReactNode {
const visibleFiles = files.slice(0, maxVisible);
const remainingCount = files.length - maxVisible;
return (
@@ -38,13 +38,13 @@ interface DeleteConfirmationDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
title?: string;
- description?: string | ReactElement;
+ description?: string;
confirmText?: string;
cancelText?: string;
onConfirm: () => void | Promise<void>;
isLoading?: boolean;
variant?: "destructive" | "default";
- children?: ReactElement;
+ children?: ReactNode;
}
export const DeleteConfirmationDialog: React.FC<
@@ -84,7 +84,9 @@ export const DeleteConfirmationDialog: React.FC<
</div>
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
- {children}
+ <div className="text-sm text-muted-foreground">
+ {children}
+ </div>
<DialogFooter>
<Button
type="button"