Files
pipelines/app/lib/features/runs/ui/run_detail_material.dart
T
alan f57d8eeb76 feat(app): open a recorded run visit from its URL
`/runs/:id/stage/:key?visit=N` now selects that stage's N-th recorded
visit in the run detail Timeline, matching the web client's stage-local
visit ordering. A stage key without a visit opens the latest recorded
visit, an out-of-range index clamps to the last one, and a stage with no
recorded visit selects only its Graph node instead of inventing a visit.

Route plumbing carries the query end to end: boot seeds the router from
path and query, the parser reads path plus query, and restore keeps `?`
a query separator instead of percent-encoding it. That also repairs the
existing `?action=decide` and `/runs?pipeline=` URLs.

The Graph node click and the stage route share one sequence-ordered
resolver, so both open the same latest visit.
2026-10-22 10:48:36 +01:00

91 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../domain/run_models.dart';
import 'run_changes_action.dart';
import 'run_detail_content.dart';
import 'run_detail_tabs.dart';
/// The runs detail with standard Material controls.
///
/// The host header keeps the run identity, status and every action; the shared
/// tab body supplies Summary, Graph, Input, Output and Timeline.
Widget buildMaterialRunDetail({
required BuildContext context,
required JsonMap run,
required Widget headerActions,
required bool detailLoading,
required String? error,
required bool copying,
required String? copyStatus,
required VoidCallback onBack,
required VoidCallback onCopy,
required String configuredEndpoint,
String? initialStageKey,
int? initialVisit,
}) {
final theme = Theme.of(context);
return RunDetailTabs(
run: run,
cupertino: false,
copying: copying,
copyStatus: copyStatus,
onCopy: onCopy,
configuredEndpoint: configuredEndpoint,
initialStageKey: initialStageKey,
initialVisit: initialVisit,
header: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
TextButton.icon(
onPressed: onBack,
icon: const Icon(Icons.arrow_back),
label: const Text('Back to list'),
),
if (showRunChangesAction(run)) RunChangesButton(run: run),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Text(detailTitle(run), style: theme.textTheme.headlineSmall),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Chip(label: Text(runStatusLabel(run))),
Text('Run ${run['id']}'),
Text('Pipeline ${detailPipeline(run)}'),
headerActions,
],
),
),
if (detailLoading) const _Notice('Refreshing run details…'),
if (error != null) _Notice(error),
],
),
);
}
class _Notice extends StatelessWidget {
const _Notice(this.text);
final String text;
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Semantics(liveRegion: true, child: Text(text)),
);
}