mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-22 21:28:12 +02:00
fix: now document processing UI banner does not show for periodic reindexing documents
This commit is contained in:
parent
0e1ea9c30f
commit
446abc239b
2 changed files with 16 additions and 5 deletions
|
|
@ -6,13 +6,16 @@ import { useTranslations } from "next-intl";
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||||
|
|
||||||
interface ProcessingIndicatorProps {
|
interface ProcessingIndicatorProps {
|
||||||
activeTasksCount: number;
|
documentProcessorTasksCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ProcessingIndicator({ activeTasksCount }: ProcessingIndicatorProps) {
|
export function ProcessingIndicator({
|
||||||
|
documentProcessorTasksCount
|
||||||
|
}: ProcessingIndicatorProps) {
|
||||||
const t = useTranslations("documents");
|
const t = useTranslations("documents");
|
||||||
|
|
||||||
if (activeTasksCount === 0) return null;
|
// Only show when there are document_processor tasks (uploads), not connector_indexing_task (periodic reindexing)
|
||||||
|
if (documentProcessorTasksCount === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
|
|
@ -32,7 +35,7 @@ export function ProcessingIndicator({ activeTasksCount }: ProcessingIndicatorPro
|
||||||
{t("processing_documents")}
|
{t("processing_documents")}
|
||||||
</AlertTitle>
|
</AlertTitle>
|
||||||
<AlertDescription className="text-muted-foreground">
|
<AlertDescription className="text-muted-foreground">
|
||||||
{t("active_tasks_count", { count: activeTasksCount })}
|
{t("active_tasks_count", { count: documentProcessorTasksCount })}
|
||||||
</AlertDescription>
|
</AlertDescription>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,14 @@ export default function DocumentsTable() {
|
||||||
|
|
||||||
// Set up polling for active tasks
|
// Set up polling for active tasks
|
||||||
const { summary } = useLogsSummary(searchSpaceId, 24, { refetchInterval: 5000 });
|
const { summary } = useLogsSummary(searchSpaceId, 24, { refetchInterval: 5000 });
|
||||||
|
|
||||||
|
// Filter active tasks to only include document_processor tasks (uploads via "add sources")
|
||||||
|
// Exclude connector_indexing_task tasks (periodic reindexing)
|
||||||
|
const documentProcessorTasks = summary?.active_tasks.filter(
|
||||||
|
task => task.source === "document_processor"
|
||||||
|
) || [];
|
||||||
|
const documentProcessorTasksCount = documentProcessorTasks.length;
|
||||||
|
|
||||||
const activeTasksCount = summary?.active_tasks.length || 0;
|
const activeTasksCount = summary?.active_tasks.length || 0;
|
||||||
const prevActiveTasksCount = useRef(activeTasksCount);
|
const prevActiveTasksCount = useRef(activeTasksCount);
|
||||||
|
|
||||||
|
|
@ -226,7 +234,7 @@ export default function DocumentsTable() {
|
||||||
</Button>
|
</Button>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
<ProcessingIndicator activeTasksCount={activeTasksCount} />
|
<ProcessingIndicator documentProcessorTasksCount={documentProcessorTasksCount} />
|
||||||
|
|
||||||
<DocumentsFilters
|
<DocumentsFilters
|
||||||
typeCounts={typeCounts ?? {}}
|
typeCounts={typeCounts ?? {}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue