Files
pipelines/app/lib/features/runs/ui/run_detail_visit.dart
T
alan 6b11b136db fix(app): meaning colours for common outcomes; detail pages fill the pane
Timeline outcomes: success-like words are green, failures red,
rejections orange, retries/advisories amber, skips/cancellations grey;
a second word of the same family takes the family's next shade and any
other word a distinct hue outside the families, so different outcomes
still never share a colour.
Run detail, stage page and pipeline Summary no longer cap their width
at 840: on an unfolded foldable the sections fill the pane. The unused
ReadingWidth helper is removed.
2026-10-31 14:36:15 +00:00

105 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import 'run_detail_content.dart';
import 'run_detail_visit_facts_view.dart';
import 'run_detail_visit_sections.dart';
/// The selected recorded visit's page body: its sections under floating
/// tabs. The page's bar carries the stage and its coordinates
/// ([runVisitSubtitle]); the Summary section leads with the visit's facts.
class RunVisitPane extends StatefulWidget {
const RunVisitPane({
super.key,
required this.run,
required this.visit,
required this.visitIndex,
required this.step,
required this.runSteps,
required this.gateway,
required this.onRunChanged,
required this.configuredEndpoint,
required this.cupertino,
required this.onClose,
});
final JsonMap run;
final DetailVisit visit;
/// The visit's index in [runSteps], so the artifacts section can open exactly
/// this visit's gallery group.
final int visitIndex;
final JsonMap step;
final List<JsonMap> runSteps;
/// The app's shared gateway and the accepted-detail fold for the session's
/// export-only repair. The visit never opens its own socket.
final ApiGateway gateway;
final ValueChanged<JsonMap> onRunChanged;
final String configuredEndpoint;
final bool cupertino;
final VoidCallback onClose;
@override
State<RunVisitPane> createState() => _RunVisitPaneState();
}
class _RunVisitPaneState extends State<RunVisitPane> {
RunVisitSection _section = RunVisitSection.summary;
@override
void didUpdateWidget(covariant RunVisitPane oldWidget) {
super.didUpdateWidget(oldWidget);
// A different visit starts at its first section, like a newly opened pane.
if (oldWidget.visit.sequence != widget.visit.sequence ||
oldWidget.visit.stage != widget.visit.stage) {
_section = RunVisitSection.summary;
}
}
@override
Widget build(BuildContext context) {
// The section fills the page and scrolls behind the page's top bar (which
// names the stage and its visit) and the floating tabs, padding its
// content clear of both at rest. Summary leads with the visit's facts.
return KeyedSubtree(
key: const Key('run-visit-pane'),
child: FloatingBarOverlay(
bar: RunVisitSectionStrip(
selected: _section,
onSelected: (section) => setState(() => _section = section),
),
// Every section fills the page, on a phone and an unfolded foldable.
child: runVisitSectionBody(
section: _section,
run: widget.run,
step: widget.step,
visitIndex: widget.visitIndex,
stageKey: widget.visit.stage,
runSteps: widget.runSteps,
gateway: widget.gateway,
onRunChanged: widget.onRunChanged,
configuredEndpoint: widget.configuredEndpoint,
cupertino: widget.cupertino,
facts: RunVisitFactsView(step: widget.step),
),
),
);
}
}
/// The page bar's subtitle for a recorded visit: its per-stage visit, then the run
/// it belongs to (`Visit 2 · Run 7 · Nightly report`).
String runVisitSubtitle(JsonMap run, DetailVisit visit) {
final runId = '${run['id'] ?? ''}'.trim();
final title = detailTitle(run);
return [
'Visit ${visit.visit}',
if (runId.isNotEmpty) 'Run $runId',
if (title.isNotEmpty && title != 'Run $runId') title,
].join(' · ');
}