details for counts for steps
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user