more stuff
This commit is contained in:
parent
c3cb36c8d6
commit
7dec0be3b4
26 changed files with 1394 additions and 275 deletions
|
|
@ -215,14 +215,16 @@ export function useBacktestV2(): UseBacktestV2Return {
|
|||
}, [currentRun]);
|
||||
|
||||
const cancelRun = useCallback(async () => {
|
||||
if (!currentRun || (currentRun.status !== 'running' && currentRun.status !== 'paused')) {
|
||||
if (!currentRun || !['pending', 'running', 'paused'].includes(currentRun.status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await backtestApiV2.cancelRun(currentRun.id);
|
||||
setCurrentRun(prev => (prev ? { ...prev, status: 'cancelled' } : null));
|
||||
stopMonitoringRun();
|
||||
// Acceptance is not completion: keep monitoring the owner's persisted acknowledgement.
|
||||
const updated = await backtestApiV2.getRun(currentRun.id);
|
||||
setCurrentRun(updated);
|
||||
setRuns(prev => prev.map(run => (run.id === updated.id ? updated : run)));
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to cancel run');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ export interface Run {
|
|||
completedAt?: string;
|
||||
pausedAt?: string;
|
||||
progress: number;
|
||||
cancelRequested?: boolean;
|
||||
attemptNumber?: number;
|
||||
currentSimulationDate?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue