From 7d366e6368f4e187cc0503ce37374e79f80caf6c Mon Sep 17 00:00:00 2001 From: Andrii Arsenin Date: Wed, 30 Sep 2026 14:35:31 +0300 Subject: [PATCH] feat(runs): add repeat run action to run detail page, bump to 1.14.0 - start a new run with the same environment and saveSession settings and navigate to it; disabled when the run's environment was deleted - remount the run detail page per run id so per-run state resets - type ScenarioRun.environmentId as nullable to match the backend --- CHANGELOG.md | 8 ++++ client/src/api/types.ts | 2 +- client/src/i18n/locales/en.json | 2 + client/src/pages/run/RunDetailPage.tsx | 59 +++++++++++++++++++++++--- package-lock.json | 4 +- package.json | 2 +- 6 files changed, 66 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc319eb..5d59904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## 1.14.0 - 2026-09-30 + +Changes since 1.13.0: + +### Added + +- Added a "Repeat run" button on the scenario run detail page that starts a new run of the same scenario with the same environment and "save session" setting, then navigates to it. The button is disabled when the run's environment has since been deleted. + ## 1.13.0 - 2026-09-30 Changes since 1.12.0: diff --git a/client/src/api/types.ts b/client/src/api/types.ts index 689a382..f240d82 100644 --- a/client/src/api/types.ts +++ b/client/src/api/types.ts @@ -105,7 +105,7 @@ export type LogLevel = 'log' | 'warn' | 'error'; export interface ScenarioRun { id: string; scenarioId: string; - environmentId: string; + environmentId: string | null; sessionId?: string | null; saveSession: boolean; scenario?: Pick; diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.json index f11faa6..5620072 100644 --- a/client/src/i18n/locales/en.json +++ b/client/src/i18n/locales/en.json @@ -261,6 +261,8 @@ "log_message": "Message", "log_time": "Time", "action_download_logs": "Download logs", + "action_repeat": "Repeat run", + "repeat_no_environment": "The environment used by this run no longer exists", "export_logs_modal_title": "Export logs", "export_logs_format": "Format", "export_logs_format_md": "Markdown (.md)", diff --git a/client/src/pages/run/RunDetailPage.tsx b/client/src/pages/run/RunDetailPage.tsx index 91ff9ad..4b2dc52 100644 --- a/client/src/pages/run/RunDetailPage.tsx +++ b/client/src/pages/run/RunDetailPage.tsx @@ -28,10 +28,18 @@ import { Table, Timestamp, UuidBadge, + useToast, type TableColumn, } from '../../ui'; import type { BadgeVariant } from '../../ui'; -import { ChevronDown, ChevronRight, ClipboardList, Activity, Download } from 'lucide-react'; +import { + ChevronDown, + ChevronRight, + ClipboardList, + Activity, + Download, + RotateCcw, +} from 'lucide-react'; import styles from '../Page.module.css'; const RUN_STATUS_VARIANT: Record = { @@ -66,9 +74,16 @@ const LOG_LEVEL_VARIANT: Record = { const FINAL: ScenarioRunStatus[] = ['pass', 'fail']; export function RunDetailPage() { + const { runId } = useParams<{ runId: string }>(); + // Remount per run so "Repeat run" navigation starts from a clean state + return ; +} + +function RunDetail() { const { t } = useTranslation(); const { id, runId } = useParams<{ id: string; runId: string }>(); const navigate = useNavigate(); + const toast = useToast(); const [scenario, setScenario] = useState(null); const [run, setRun] = useState(null); @@ -88,6 +103,7 @@ export function RunDetailPage() { const [exportLogsOpen, setExportLogsOpen] = useState(false); const [exportLogsFormat, setExportLogsFormat] = useState('md'); const [exportingLogs, setExportingLogs] = useState(false); + const [repeating, setRepeating] = useState(false); const logSearchRef = useRef(''); const LOG_PAGE_SIZE = 25; const pollRef = useRef | null>(null); @@ -131,6 +147,20 @@ export function RunDetailPage() { } }; + const handleRepeatRun = async () => { + if (!id || !run?.environmentId) return; + setRepeating(true); + try { + const newRun = await scenarios.run(id, run.environmentId, run.saveSession); + toast.success(t('scenarios.run_started')); + navigate(`/scenarios/${id}/runs/${newRun.id}`); + } catch (err) { + toast.error((err as Error).message); + } finally { + setRepeating(false); + } + }; + const manualRefresh = () => { if (!id || !runId) return; runs @@ -384,12 +414,27 @@ export function RunDetailPage() { { label: `${runId}` }, ]} /> - +
+ {run && ( + + + + )} + +
{loading &&

{t('runs.loading')}

} diff --git a/package-lock.json b/package-lock.json index e1df1dd..6cca854 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "liqa", - "version": "1.13.0", + "version": "1.14.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "liqa", - "version": "1.13.0", + "version": "1.14.0", "workspaces": [ "server", "client" diff --git a/package.json b/package.json index a6a417a..84eb432 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "liqa", - "version": "1.13.0", + "version": "1.14.0", "private": true, "workspaces": [ "server",