details for counts for steps

This commit is contained in:
2026-05-29 16:14:05 +05:30
parent acbfca94f2
commit 8c8808e18b
2 changed files with 38 additions and 1 deletions

View File

@@ -97,6 +97,33 @@ export default function FetchRequestDetail() {
const resolveMutation = useResolveAmbiguity();
const { data: ambiguities, refetch: refetchAmbiguities } = useFetchRequestAmbiguities(id!);
const stepMessages = React.useMemo(() => {
const msgs: Record<number, string> = {};
const source = (fetchRequest as any)?.source;
if (source?.raw_lines?.length)
msgs[0] = `${source.raw_lines.length} raw lines`;
const blocks = source?.txn_blocks ?? {};
const dicts = source?.txn_dicts ?? [];
const blockCount = typeof blocks === "object"
? Object.keys(blocks).length : Array.isArray(blocks) ? blocks.length : 0;
if (blockCount || dicts.length) {
const parts: string[] = [];
if (blockCount) parts.push(`${blockCount} blocks`);
if (dicts.length) parts.push(`${dicts.length} dicts`);
msgs[1] = parts.join(" · ");
}
if (["enriched_done", "completed"].includes((fetchRequest as any)?.status))
msgs[2] = "done";
if ((fetchRequest as any)?.status === "completed")
msgs[3] = (fetchRequest as any)?.completed_at
? new Date((fetchRequest as any).completed_at).toLocaleString() : "done";
return msgs;
}, [fetchRequest]);
const [sseEvents, setSseEvents] = React.useState<SSEEvent[]>([]);
const [sseConnected, setSseConnected] = React.useState(false);
const sseRef = React.useRef<EventSource | null>(null);
@@ -284,12 +311,19 @@ export default function FetchRequestDetail() {
icon = <Typography variant="caption" color="text.disabled">{index + 1}</Typography>;
}
const stepMsg = stepMessages[index];
return (
<Step key={label}>
<StepLabel
StepIconComponent={() => <Box sx={{ display: "flex", alignItems: "center" }}>{icon}</Box>}
>
{label}
<Typography variant="body2" fontWeight={600}>{label}</Typography>
{stepMsg && (
<Typography variant="caption" color="text.secondary" sx={{ display: "block", lineHeight: 1.2 }}>
{stepMsg}
</Typography>
)}
</StepLabel>
</Step>
);

View File

@@ -10,6 +10,9 @@ export type FetchRequestStatus =
export interface FileSource {
path: string;
format: string;
raw_lines?: string[];
txn_blocks?: Record<string, any>;
txn_dicts?: Record<string, any>[];
}
export interface EmailSource {