refactor: add session and environment relationships to scenario run
- add sessionId optional column to ScenarioRunEntity - add ManyToOne relationship to EnvironmentEntity (with eager loading) - add ManyToOne relationship to SessionEntity (optional) - update ScenarioRun client types to include session and environment data - add environment name and session link to RunDetailPage - update UI to display save session, environment, and session info
This commit is contained in:
@@ -98,8 +98,11 @@ export interface ScenarioRun {
|
||||
id: string;
|
||||
scenarioId: string;
|
||||
environmentId: string;
|
||||
sessionId?: string | null;
|
||||
saveSession: boolean;
|
||||
scenario?: Pick<Scenario, 'id' | 'name'>;
|
||||
environment?: Pick<Environment, 'id' | 'name'>;
|
||||
session?: { id: string; sessionName: string };
|
||||
status: ScenarioRunStatus;
|
||||
stepRuns?: ScenarioRunStep[];
|
||||
createdAt: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useNavigate, useParams, Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { runs } from '../../api';
|
||||
import type {
|
||||
@@ -324,6 +324,14 @@ export function RunDetailPage() {
|
||||
},
|
||||
{ term: t('runs.field_created'), detail: <Timestamp value={run.createdAt} /> },
|
||||
{ term: t('runs.field_updated'), detail: <Timestamp value={run.updatedAt} /> },
|
||||
...(run.environment ? [{
|
||||
term: 'Environment',
|
||||
detail: <span style={{ color: 'var(--color-link)', cursor: 'pointer' }}>{run.environment.name}</span>,
|
||||
}] : []),
|
||||
...(run.session ? [{
|
||||
term: 'Session',
|
||||
detail: <Link to={`/sessions/${run.session.id}`} style={{ color: 'var(--color-link)' }}>{run.session.sessionName}</Link>,
|
||||
}] : []),
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
@@ -559,9 +559,9 @@ export function ScenarioDetailPage() {
|
||||
type="checkbox"
|
||||
checked={saveSessionFlag}
|
||||
onChange={(e) => setSaveSessionFlag(e.target.checked)}
|
||||
disabled={running}
|
||||
disabled
|
||||
/>
|
||||
<span>Save session for explore mode</span>
|
||||
<span>Save session</span>
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -222,9 +222,9 @@ export function ScenariosPage() {
|
||||
type="checkbox"
|
||||
checked={saveSessionFlag}
|
||||
onChange={(e) => setSaveSessionFlag(e.target.checked)}
|
||||
disabled={running}
|
||||
disabled
|
||||
/>
|
||||
<span>Save session for explore mode</span>
|
||||
<span>Save session</span>
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user