OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
fix: knowledge delete dialog cleanup
Phil Nasha87ec6441599
diff --git a/frontend/app/knowledge/page.tsx b/frontend/app/knowledge/page.tsxindex 85189a85f..5438438d8 100644--- a/frontend/app/knowledge/page.tsx+++ b/frontend/app/knowledge/page.tsx@@ -438,18 +438,17 @@ function SearchPage() {open={showBulkDeleteDialog}onOpenChange={setShowBulkDeleteDialog}title={selectedRows.length > 1 ? "Delete Documents" : "Delete Document"}- description={`Are you sure you want to delete ${- selectedRows.length- } document${- selectedRows.length > 1 ? "s" : ""- }? This will remove all chunks and data associated with these documents. This action cannot be undone.--Documents to be deleted:-${formatFilesToDelete(selectedRows)}`}+ description={`Are you sure you want to delete ${selectedRows.length} document${selectedRows.length > 1 ? "s" : ""}?`}confirmText={selectedRows.length > 1 ? "Delete All" : "Delete"}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>+ </DeleteConfirmationDialog></>);}diff --git a/frontend/components/delete-confirmation-dialog.tsx b/frontend/components/delete-confirmation-dialog.tsxindex 7971933d6..ad6a46cee 100644--- a/frontend/components/delete-confirmation-dialog.tsx+++ b/frontend/components/delete-confirmation-dialog.tsx@@ -1,6 +1,6 @@"use client";-import React from "react";+import React, { ReactElement } from "react";import {Dialog,DialogContent,@@ -21,27 +21,30 @@ import { AlertTriangle } from "lucide-react";export function formatFilesToDelete(files: Array<{ filename: string }>,maxVisible = 5,-): string {+): ReactElement {const visibleFiles = files.slice(0, maxVisible);const remainingCount = files.length - maxVisible;- const fileList = visibleFiles.map((file) => `• ${file.filename}`).join("\n");- return remainingCount > 0- ? `${fileList}\n• ... and ${remainingCount} more document${+ return (+ <ul className="list-disc list-inside max-w-[29rem] sm:max-w-[calc(425px-3rem)]">+ {visibleFiles.map((file) => <li className="my-2 truncate">{file.filename}</li>)}+ {remainingCount > 0 ? <li>… and {remainingCount} more document{remainingCount > 1 ? "s" : ""- }`- : fileList;+ }</li> : "" }+ </ul>+ );}interface DeleteConfirmationDialogProps {open: boolean;onOpenChange: (open: boolean) => void;title?: string;- description?: string;+ description?: string | ReactElement;confirmText?: string;cancelText?: string;onConfirm: () => void | Promise<void>;isLoading?: boolean;variant?: "destructive" | "default";+ children?: ReactElement;}export const DeleteConfirmationDialog: React.FC<@@ -56,6 +59,7 @@ export const DeleteConfirmationDialog: React.FC<onConfirm,isLoading = false,variant = "destructive",+ children,}) => {const handleConfirm = async () => {try {@@ -80,7 +84,7 @@ export const DeleteConfirmationDialog: React.FC<</div><DialogDescription>{description}</DialogDescription></DialogHeader>-+ {children}<DialogFooter><Buttontype="button"