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
This commit is contained in:
1 parent
5ea1e38f25
commit
7d366e6368
6 files changed
+66
-11
No files matched your search
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
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
|
## 1.13.0 - 2026-09-30
|
||||||
|
|
||||||
Changes since 1.12.0:
|
Changes since 1.12.0:
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export type LogLevel = 'log' | 'warn' | 'error';
|
|||||||
export interface ScenarioRun {
|
export interface ScenarioRun {
|
||||||
id: string;
|
id: string;
|
||||||
scenarioId: string;
|
scenarioId: string;
|
||||||
environmentId: string;
|
environmentId: string | null;
|
||||||
sessionId?: string | null;
|
sessionId?: string | null;
|
||||||
saveSession: boolean;
|
saveSession: boolean;
|
||||||
scenario?: Pick<Scenario, 'id' | 'name'>;
|
scenario?: Pick<Scenario, 'id' | 'name'>;
|
||||||
|
|||||||
@@ -261,6 +261,8 @@
|
|||||||
"log_message": "Message",
|
"log_message": "Message",
|
||||||
"log_time": "Time",
|
"log_time": "Time",
|
||||||
"action_download_logs": "Download logs",
|
"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_modal_title": "Export logs",
|
||||||
"export_logs_format": "Format",
|
"export_logs_format": "Format",
|
||||||
"export_logs_format_md": "Markdown (.md)",
|
"export_logs_format_md": "Markdown (.md)",
|
||||||
|
|||||||
@@ -28,10 +28,18 @@ import {
|
|||||||
Table,
|
Table,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
UuidBadge,
|
UuidBadge,
|
||||||
|
useToast,
|
||||||
type TableColumn,
|
type TableColumn,
|
||||||
} from '../../ui';
|
} from '../../ui';
|
||||||
import type { BadgeVariant } 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';
|
import styles from '../Page.module.css';
|
||||||
|
|
||||||
const RUN_STATUS_VARIANT: Record<ScenarioRunStatus, BadgeVariant> = {
|
const RUN_STATUS_VARIANT: Record<ScenarioRunStatus, BadgeVariant> = {
|
||||||
@@ -66,9 +74,16 @@ const LOG_LEVEL_VARIANT: Record<LogLevel, BadgeVariant> = {
|
|||||||
const FINAL: ScenarioRunStatus[] = ['pass', 'fail'];
|
const FINAL: ScenarioRunStatus[] = ['pass', 'fail'];
|
||||||
|
|
||||||
export function RunDetailPage() {
|
export function RunDetailPage() {
|
||||||
|
const { runId } = useParams<{ runId: string }>();
|
||||||
|
// Remount per run so "Repeat run" navigation starts from a clean state
|
||||||
|
return <RunDetail key={runId} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function RunDetail() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { id, runId } = useParams<{ id: string; runId: string }>();
|
const { id, runId } = useParams<{ id: string; runId: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const toast = useToast();
|
||||||
|
|
||||||
const [scenario, setScenario] = useState<Scenario | null>(null);
|
const [scenario, setScenario] = useState<Scenario | null>(null);
|
||||||
const [run, setRun] = useState<ScenarioRunDetail | null>(null);
|
const [run, setRun] = useState<ScenarioRunDetail | null>(null);
|
||||||
@@ -88,6 +103,7 @@ export function RunDetailPage() {
|
|||||||
const [exportLogsOpen, setExportLogsOpen] = useState(false);
|
const [exportLogsOpen, setExportLogsOpen] = useState(false);
|
||||||
const [exportLogsFormat, setExportLogsFormat] = useState<LogExportFormat>('md');
|
const [exportLogsFormat, setExportLogsFormat] = useState<LogExportFormat>('md');
|
||||||
const [exportingLogs, setExportingLogs] = useState(false);
|
const [exportingLogs, setExportingLogs] = useState(false);
|
||||||
|
const [repeating, setRepeating] = useState(false);
|
||||||
const logSearchRef = useRef('');
|
const logSearchRef = useRef('');
|
||||||
const LOG_PAGE_SIZE = 25;
|
const LOG_PAGE_SIZE = 25;
|
||||||
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
const pollRef = useRef<ReturnType<typeof setInterval> | 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 = () => {
|
const manualRefresh = () => {
|
||||||
if (!id || !runId) return;
|
if (!id || !runId) return;
|
||||||
runs
|
runs
|
||||||
@@ -384,12 +414,27 @@ export function RunDetailPage() {
|
|||||||
{ label: `${runId}` },
|
{ label: `${runId}` },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<AutoRefreshIndicator
|
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
||||||
active={polling}
|
{run && (
|
||||||
pulseKey={pulseKey}
|
<span title={run.environmentId ? undefined : t('runs.repeat_no_environment')}>
|
||||||
error={!!error}
|
<Button
|
||||||
onClick={manualRefresh}
|
variant="secondary"
|
||||||
/>
|
size="sm"
|
||||||
|
onClick={handleRepeatRun}
|
||||||
|
disabled={!run.environmentId || repeating}
|
||||||
|
>
|
||||||
|
<RotateCcw size={14} />
|
||||||
|
{t('runs.action_repeat')}
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<AutoRefreshIndicator
|
||||||
|
active={polling}
|
||||||
|
pulseKey={pulseKey}
|
||||||
|
error={!!error}
|
||||||
|
onClick={manualRefresh}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{loading && <p className={styles.muted}>{t('runs.loading')}</p>}
|
{loading && <p className={styles.muted}>{t('runs.loading')}</p>}
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "liqa",
|
"name": "liqa",
|
||||||
"version": "1.13.0",
|
"version": "1.14.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "liqa",
|
"name": "liqa",
|
||||||
"version": "1.13.0",
|
"version": "1.14.0",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"server",
|
"server",
|
||||||
"client"
|
"client"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liqa",
|
"name": "liqa",
|
||||||
"version": "1.13.0",
|
"version": "1.14.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"server",
|
"server",
|
||||||
|
|||||||
Reference in new issue
Block a user