Fundamental_Analysis/frontend/archive/v1_report/TaskStatus.tsx
Lv, Qi 0cb31e363e Refactor E2E tests and improve error handling in Orchestrator
- Fix `simple_test_analysis` template in E2E test setup to align with Orchestrator's data fetch logic.
- Implement and verify additional E2E scenarios:
    - Scenario C: Partial Provider Failure (verified error propagation fix in Orchestrator).
    - Scenario D: Invalid Symbol input.
    - Scenario E: Analysis Module failure.
- Update `WorkflowStateMachine::handle_report_failed` to correctly scope error broadcasting to the specific task instead of failing effectively silently or broadly.
- Update testing strategy documentation to reflect completed Phase 4 testing.
- Skip Scenario B (Orchestrator Restart) as persistence is not yet implemented (decision made to defer persistence).
2025-11-21 20:44:32 +08:00

78 lines
2.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
import { Spinner } from '@/components/ui/spinner';
import { formatElapsedTime } from '../utils';
interface TaskStatusProps {
requestId: string | null;
taskProgress: any;
startTime: number | null;
elapsedSeconds: number;
completionProgress: number;
currentAnalysisTask: string | null;
analysisConfig: any;
}
export function TaskStatus({
requestId,
taskProgress,
startTime,
elapsedSeconds,
completionProgress,
currentAnalysisTask,
analysisConfig,
}: TaskStatusProps) {
return (
<>
<Card className="w-80">
<CardHeader>
<CardTitle className="text-lg"></CardTitle>
</CardHeader>
<CardContent className="text-xs text-muted-foreground">
{requestId ? (
<pre>{JSON.stringify(taskProgress || {}, null, 2)}</pre>
) : (
<div></div>
)}
</CardContent>
</Card>
<Card className="w-80">
<CardHeader className="flex flex-col space-y-2 pb-2">
<div className="flex flex-row items-center justify-between w-full">
<CardTitle className="text-xl"></CardTitle>
{startTime && (
<div className="text-sm font-medium text-muted-foreground ml-auto">
: {formatElapsedTime(elapsedSeconds)}
</div>
)}
</div>
<div className="w-full bg-muted rounded-full h-2 mt-1">
<div
className="bg-primary h-2 rounded-full transition-all duration-300"
style={{ width: `${completionProgress}%` }}
/>
</div>
</CardHeader>
<CardContent className="space-y-2">
{currentAnalysisTask && analysisConfig && (
(() => {
const analysisName = analysisConfig.analysis_modules?.[currentAnalysisTask]?.name || currentAnalysisTask;
const modelName = analysisConfig.analysis_modules?.[currentAnalysisTask]?.model || 'AI';
return (
<div className="flex items-center gap-2 text-sm">
<Spinner className="size-4" />
<div>
<div className="font-medium">{analysisName} {modelName}</div>
<div className="text-xs text-muted-foreground">{analysisName}...</div>
</div>
</div>
);
})()
)}
</CardContent>
</Card>
</>
);
}