polish compact pipeline and run lists

This commit is contained in:
2026-10-31 02:11:24 +00:00
parent 24a9a61219
commit 6a7dfae2a1
9 changed files with 199 additions and 529 deletions
@@ -1,15 +1,7 @@
import '../../../ui/theme/app_theme.dart';
import 'dart:math' as math;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../graph/domain/graph_definition.dart';
import '../../graph/layout/graph_node_layout.dart';
import '../../graph/layout/layout_models.dart';
import '../../graph/routing/graph_edge_routing.dart';
import '../../graph/routing/route_models.dart';
import '../../graph/widgets/graph_canvas_style.dart';
import '../../../ui/status/run_status_icon.dart';
import '../pipeline_format.dart';
import '../pipeline_models.dart';
@@ -207,8 +199,8 @@ class PipelineListPanel extends StatelessWidget {
horizontal: kPipelineListInset,
),
visualDensity: VisualDensity.compact,
leading: compact ? null : _pipelineIdentityIcon(context),
title: _rowTitle(context, pipeline, compact: compact),
leading: compact ? null : _pipelineIdentityIcon(context, pipeline),
title: _rowTitle(context, pipeline, now: now, compact: compact),
subtitle: _rowMetadata(context, pipeline, now, compact: compact),
trailing: compact ? null : const Icon(Icons.chevron_right),
);
@@ -236,8 +228,15 @@ class PipelineListPanel extends StatelessWidget {
backgroundColor: controller.selectedId == pipeline.id
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
: null,
leading: compact ? null : _pipelineIdentityIcon(context),
title: _rowTitle(context, pipeline, compact: compact),
leading: compact
? null
: _pipelineIdentityIcon(context, pipeline),
title: _rowTitle(
context,
pipeline,
now: now,
compact: compact,
),
subtitle: _rowMetadata(
context,
pipeline,
@@ -257,11 +256,12 @@ class PipelineListPanel extends StatelessWidget {
);
}
/// The row's title line: its name, and its version and id in the corner.
/// The row's title line: its name and, when known, its latest run's age.
/// A narrow split pane keeps the name alone; the detail preserves identity.
Widget _rowTitle(
BuildContext context,
PipelineSummary pipeline, {
required DateTime now,
required bool compact,
}) {
final muted = _mutedStyle(context);
@@ -273,35 +273,30 @@ class PipelineListPanel extends StatelessWidget {
style: const TextStyle(fontWeight: FontWeight.w600),
);
}
return _measured(
Row(
children: [
Expanded(
child: Text(
pipeline.displayName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
// Weight only: the native tile owns size and the selected colour.
style: const TextStyle(fontWeight: FontWeight.w600),
),
final run = controller.runsLoaded
? controller.latestRuns[pipeline.id]
: null;
final ranAgo = run == null ? null : runBadge(run, now).ranAgo;
return Row(
children: [
Expanded(
child: Text(
pipeline.displayName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
// Weight only: the native tile owns size and the selected colour.
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
if (ranAgo != null) ...[
const SizedBox(width: 8),
_RightCorner(
child: Text(
'${pipelineVersionLabel(pipeline)} · #${pipeline.id}',
style: muted,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Text(ranAgo, style: muted, maxLines: 1),
],
),
],
);
}
/// The row below the title, its facts in the corners: what the pipeline is
/// (stages, schedule) beside its miniature, then how it last ran beside when
/// it was updated. Everything comes from recorded values.
/// The row's one muted subtitle: latest-run state, stage count, and schedules.
Widget _rowMetadata(
BuildContext context,
PipelineSummary pipeline,
@@ -309,52 +304,26 @@ class PipelineListPanel extends StatelessWidget {
required bool compact,
}) {
final style = _mutedStyle(context);
final schedules = switch (pipeline.scheduleState) {
PipelineScheduleState.scheduled => pipeline.scheduleLabel,
PipelineScheduleState.unscheduled => '0 schedules',
PipelineScheduleState.unclassified => '',
};
final what = [
pipelineStageSummary(pipeline),
if (pipeline.scheduleLabel.isNotEmpty) pipeline.scheduleLabel,
if (schedules.isNotEmpty) schedules,
].join(' · ');
final updated = pipelineUpdatedLine(pipeline);
final run = controller.runsLoaded
? controller.latestRuns[pipeline.id]
: null;
final badge = run == null ? null : runBadge(run, now);
final shape = pipeline.shape;
// As the web's `row-run`: the coloured status glyph (its tooltip and
// accessible name are the state word), then `2d ago · 4m 12s · run 488`.
final lastRun = badge != null
? Row(
children: [
RunStatusIcon(
state: badge.state,
label: runStateLabel(badge.state),
size: 14,
),
const SizedBox(width: 4),
Expanded(
child: Text(
badge.metaLine,
style: style,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
)
: controller.runsLoaded
? Text(
'no runs recorded',
style: style,
maxLines: 2,
overflow: TextOverflow.ellipsis,
)
: const SizedBox.shrink();
// A 640px window can leave this pane about 130px wide. At that size the
// latest state is the useful decision signal; stage counts, timestamps,
// graph cues and version live in the selected pipeline's detail instead.
if (compact) {
// Do not turn an in-flight or failed run-history read into a false
// no-runs claim. The normal row also stays blank until history is known.
if (badge == null) return lastRun;
if (badge == null) return const SizedBox.shrink();
return Semantics(
label: runStateLabel(badge.state),
child: Row(
@@ -377,56 +346,34 @@ class PipelineListPanel extends StatelessWidget {
),
);
}
return _measured(
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
what,
style: style,
maxLines: 2,
overflow: TextOverflow.ellipsis,
return Row(
children: [
if (badge != null) ...[
Semantics(
label: runStateLabel(badge.state),
child: ExcludeSemantics(
child: Container(
key: Key('pipeline-status-${pipeline.id}'),
width: 8,
height: 8,
decoration: BoxDecoration(
color: runStatusColor(badge.state).resolveFrom(context),
shape: BoxShape.circle,
),
),
if (shape != null) ...[
const SizedBox(width: 8),
// The miniature keeps to its corner and scales down when narrow.
_RightCorner(
child: FittedBox(
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.centerEnd,
child: PipelineMiniGraph(
key: Key('pipeline-mini-${pipeline.id}'),
shape: shape,
),
),
),
],
],
),
const SizedBox(height: 2),
Row(
children: [
Expanded(child: lastRun),
if (updated != null) ...[
const SizedBox(width: 8),
_RightCorner(
child: Text(
updated,
style: style,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
],
),
),
const SizedBox(width: 6),
],
),
Expanded(
child: Text(
what,
style: style,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
);
}
@@ -442,187 +389,31 @@ class PipelineListPanel extends StatelessWidget {
);
}
Widget _pipelineIdentityIcon(BuildContext context) => Semantics(
label: 'Pipeline',
child: Icon(
useCupertinoControls(context)
? CupertinoIcons.flowchart
: Icons.account_tree_outlined,
),
);
}
/// The row's recorded flow cue: label-free stage boxes and their routes.
///
/// Mirrors `web/src/miniGraph.js` and `.pipeline-mini`: stage nodes only (no
/// terminals, labels or placeholder), drawn from the shared graph layout and
/// routing. Nothing is fetched and no node is invented, so a summary without a
/// recorded `shape` draws no cue.
class PipelineMiniGraph extends StatelessWidget {
const PipelineMiniGraph({super.key, required this.shape});
/// The summary's recorded flow (`shape`), verbatim.
final PipelineJson shape;
// The cue's graph coordinates, matching the web miniature's own metrics.
// These are drawing coordinates for a graph, not row/control dimensions.
static const double _nodeWidth = 26;
static const double _nodeHeight = 12;
static const double _columnGap = 12;
static const double _rowGap = 8;
static const double _padding = 2;
static const double _maxWidth = 180;
static const double _maxHeight = 22;
@override
Widget build(BuildContext context) {
final flow = _miniatureFlow(shape);
if (flow == null) return const SizedBox.shrink();
final nodes = graphNodes(flow);
final edges = graphEdges(flow);
final layout = layoutGraphNodes(
nodes: nodes,
edges: edges,
extents: <String, NodeExtent>{
for (final node in nodes)
node.key: NodeExtent(width: _nodeWidth, height: _nodeHeight),
},
config: GraphLayoutConfig(
columnGap: _columnGap,
rowGap: _rowGap,
padding: _padding,
),
);
final routing = routeGraphEdges(
layout: layout,
edges: edges,
labelExtents: <int, LabelExtent>{
// The cue is deliberately label-free, like the web miniature.
for (final edge in edges) edge.id: LabelExtent(width: 0, height: 0),
},
config: RoutingConfig(
nodeClearance: 2,
laneSpacing: 6,
corridorSpacing: 4,
portSpacing: 3,
labelGap: 0,
boundsPadding: 2,
),
);
final style = GraphCanvasStyle.of(context);
final size = Size(math.max(routing.width, 1), math.max(routing.height, 1));
return ExcludeSemantics(
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 8),
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: _maxWidth,
maxHeight: _maxHeight,
),
child: FittedBox(
fit: BoxFit.contain,
alignment: AlignmentDirectional.centerEnd,
child: SizedBox(
width: size.width,
height: size.height,
child: CustomPaint(
painter: _MiniGraphPainter(
layout: layout,
routes: routing.routes,
color: style.edgeColor,
strokeWidth: style.edgeWidth,
),
),
),
Widget _pipelineIdentityIcon(BuildContext context, PipelineSummary pipeline) {
final scheme = Theme.of(context).colorScheme;
final colors = [scheme.primary, scheme.secondary, scheme.tertiary];
final color = colors[pipeline.id.abs() % colors.length];
final name = pipeline.displayName.trimLeft();
final initial = name.isEmpty
? '?'
: String.fromCharCode(name.runes.first).toUpperCase();
return Semantics(
label: 'Pipeline ${pipeline.displayName}',
child: ExcludeSemantics(
child: Container(
key: Key('pipeline-avatar-${pipeline.id}'),
width: 40,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
color: color.withValues(alpha: 0.14),
shape: BoxShape.circle,
),
child: Text(initial, style: TextStyle(color: color)),
),
),
);
}
/// The recorded stages with edges kept only between declared stage keys.
///
/// This is the web miniature's own filter: terminal routes (`#success`/
/// `#failure`) and unknown targets are not drawn as cue nodes, and a shape
/// with no declared stage key yields no cue.
Map<String, dynamic>? _miniatureFlow(PipelineJson raw) {
final stages = raw['stages'];
if (stages is! List) return null;
final recorded = <Map<String, dynamic>>[];
final keys = <String>{};
for (final entry in stages) {
if (entry is! Map) continue;
final stage = Map<String, dynamic>.from(entry);
final key = '${stage['key'] ?? ''}';
if (key.isEmpty) continue;
recorded.add(stage);
keys.add(key);
}
if (recorded.isEmpty) return null;
for (final stage in recorded) {
final edges = stage['edges'];
if (edges is! Map) continue;
stage['edges'] = <String, dynamic>{
for (final edge in edges.entries)
if (keys.contains('${edge.value}')) '${edge.key}': edge.value,
};
}
return <String, dynamic>{'stages': recorded};
}
}
/// Paints the miniature's routed edges and rounded stage boxes in graph space.
class _MiniGraphPainter extends CustomPainter {
_MiniGraphPainter({
required this.layout,
required this.routes,
required this.color,
required this.strokeWidth,
});
final GraphLayout layout;
final List<EdgeRoute> routes;
final Color color;
final double strokeWidth;
@override
void paint(Canvas canvas, Size size) {
canvas.save();
canvas.clipRect(Offset.zero & size);
final edgePaint = Paint()
..color = color.withValues(alpha: 0.5)
..strokeWidth = strokeWidth
..style = PaintingStyle.stroke
..strokeJoin = StrokeJoin.round;
for (final route in routes) {
if (route.points.length < 2) continue;
final path = Path()..moveTo(route.points.first.x, route.points.first.y);
for (var index = 1; index < route.points.length; index += 1) {
path.lineTo(route.points[index].x, route.points[index].y);
}
canvas.drawPath(path, edgePaint);
}
final nodePaint = Paint()
..color = color.withValues(alpha: 0.55)
..style = PaintingStyle.fill;
for (final box in layout.nodes) {
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromLTWH(box.x, box.y, box.width, box.height),
const Radius.circular(3),
),
nodePaint,
);
}
canvas.restore();
}
@override
bool shouldRepaint(covariant _MiniGraphPainter oldDelegate) =>
oldDelegate.color != color ||
oldDelegate.strokeWidth != strokeWidth ||
!identical(oldDelegate.layout, layout) ||
!identical(oldDelegate.routes, routes);
}
/// The Pipelines list's app-bar actions: filter (with its count) and sort.
@@ -678,44 +469,3 @@ List<Widget> pipelineListActions(
),
];
}
/// A row's right-hand item: its own width, flush against the trailing edge,
/// never more than about half the row, so the left side keeps the rest.
class _RightCorner extends StatelessWidget {
const _RightCorner({required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
final width = _RowWidth.of(context);
return ConstrainedBox(
constraints: BoxConstraints(maxWidth: width * 0.45),
child: child,
);
}
}
/// The width of the row a [_RightCorner] sits in.
class _RowWidth extends InheritedWidget {
const _RowWidth({required this.width, required super.child});
final double width;
static double of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<_RowWidth>()?.width ??
MediaQuery.sizeOf(context).width;
@override
bool updateShouldNotify(_RowWidth oldWidget) => width != oldWidget.width;
}
/// Gives the [_RightCorner]s inside [child] the row's own width.
Widget _measured(Widget child) => LayoutBuilder(
builder: (context, constraints) => _RowWidth(
width: constraints.hasBoundedWidth
? constraints.maxWidth
: MediaQuery.sizeOf(context).width,
child: child,
),
);
+55 -60
View File
@@ -10,9 +10,9 @@ import '../../attention/notify/notification_controller.dart';
import '../../attention/runtime/attention_controller.dart';
import '../../attention/runtime/attention_store.dart';
import '../../attention/ui/needs_you_runs_heading.dart';
import '../../pipelines/pipeline_format.dart' show formatRanAgo;
import '../domain/run_models.dart';
import '../../../shell/shell_bar.dart';
import 'run_path_mini.dart';
import 'run_more_menu.dart';
import 'runs_controller.dart';
import 'runs_stats_page.dart';
@@ -263,9 +263,8 @@ class RunsList extends StatelessWidget {
}
}
/// One run in the list with its facts in the row's corners: the run and its
/// number on top, the pipeline and duration below, then when it ran and how
/// far it got.
/// One run in the list, with a status avatar, title/time, and one muted fact
/// line. Its detail retains the full timestamp, path, and other diagnostics.
class RunListRow extends StatelessWidget {
/// The narrowest row that still shows its own actions menu.
static const double _menuMinRowWidth = 280;
@@ -323,53 +322,20 @@ class RunListRow extends StatelessWidget {
color: secondary,
fontSize: (base.fontSize ?? 14) - 1,
);
Widget line(String? start, String? end, TextStyle style, {Key? key}) =>
LayoutBuilder(
key: key,
builder: (context, constraints) {
Widget text(String value) => Text(
value,
style: style,
maxLines: 1,
overflow: TextOverflow.ellipsis,
);
if (end == null) return text(start ?? '');
final measure = TextPainter(
text: TextSpan(text: end, style: style),
textDirection: Directionality.of(context),
textScaler: MediaQuery.textScalerOf(context),
)..layout();
final fits = measure.width + 12 < constraints.maxWidth;
measure.dispose();
if (!fits) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
text(start ?? ''),
Align(
alignment: AlignmentDirectional.centerEnd,
child: text(end),
),
],
);
}
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: text(start ?? '')),
const SizedBox(width: 12),
text(end),
],
);
},
);
final scheduled = run['scheduled'] == true;
final subtitle = [
?pipelineLabel,
if (scheduled) 'Scheduled',
?facts.duration,
?facts.progress,
].join(' · ');
final relativeTime = formatRanAgo('${run['created_at'] ?? ''}', now);
Widget body(bool withMenu, bool compact) => Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 2, right: 12),
child: RunStatusIcon(
padding: const EdgeInsetsDirectional.only(end: 12),
child: _RunStatusAvatar(
state: runStateOf(run['status']),
label: runStatusLabel(run),
),
@@ -404,21 +370,28 @@ class RunListRow extends StatelessWidget {
),
]
: [
line(title, id == null ? null : '#$id', titleStyle),
const SizedBox(height: 2),
line(
[?pipelineLabel, if (scheduled) 'Scheduled'].join(' · '),
facts.duration,
small,
Row(
children: [
Expanded(
child: Text(
title,
style: titleStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
if (relativeTime != null) ...[
const SizedBox(width: 8),
Text(relativeTime, style: small, maxLines: 1),
],
],
),
line(facts.when, facts.progress, small),
// The run's path, each stage in its own result colour.
Padding(
padding: const EdgeInsets.only(top: 4),
child: Align(
alignment: AlignmentDirectional.centerEnd,
child: RunPathMini(run: run),
),
const SizedBox(height: 2),
Text(
subtitle,
style: small,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
@@ -478,3 +451,25 @@ class RunListRow extends StatelessWidget {
);
}
}
class _RunStatusAvatar extends StatelessWidget {
const _RunStatusAvatar({required this.state, required this.label});
final String state;
final String label;
@override
Widget build(BuildContext context) {
final color = runStatusColor(state).resolveFrom(context);
return Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: color.withValues(alpha: 0.14),
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: RunStatusIcon(state: state, label: label),
);
}
}
+6 -5
View File
@@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
import '../adaptive/host.dart';
/// The one status glyph a run row leads with, as the web's `statusIcon`: a
/// single coloured icon whose tooltip and accessible name say the state.
/// The shared status glyph whose tooltip and accessible name say the state.
///
/// [state] is the normalised run state (`succeeded`, `failed`, `running`,
/// `waiting`, `queued`, `canceled`, `interrupted`, anything else unknown);
@@ -47,7 +46,7 @@ CupertinoDynamicColor runStatusColor(String state) => switch (state) {
'succeeded' => CupertinoColors.systemGreen,
'failed' => CupertinoColors.systemRed,
'running' || 'active' => CupertinoColors.systemBlue,
'waiting' => CupertinoColors.systemTeal,
'waiting' => CupertinoColors.systemYellow,
'interrupted' => CupertinoColors.systemOrange,
_ => CupertinoColors.systemGrey,
};
@@ -58,7 +57,8 @@ IconData _materialIcon(String state) => switch (state) {
'running' || 'active' => Icons.autorenew,
'canceled' => Icons.block,
'interrupted' => Icons.pause_circle_outline,
'waiting' || 'queued' => Icons.schedule,
'waiting' => Icons.person_outline,
'queued' => Icons.schedule,
_ => Icons.help_outline,
};
@@ -68,7 +68,8 @@ IconData _cupertinoIcon(String state) => switch (state) {
'running' || 'active' => CupertinoIcons.arrow_2_circlepath,
'canceled' => CupertinoIcons.nosign,
'interrupted' => CupertinoIcons.pause_circle,
'waiting' || 'queued' => CupertinoIcons.clock,
'waiting' => CupertinoIcons.person_crop_circle,
'queued' => CupertinoIcons.clock,
_ => CupertinoIcons.question_circle,
};
@@ -27,5 +27,7 @@ void main() {
expect(graphStatusState('waiting'), 'waiting');
expect(graphStatusState('mystery'), 'unknown');
expect(runStatusColor('succeeded'), CupertinoColors.systemGreen);
expect(runStatusColor('waiting'), CupertinoColors.systemYellow);
expect(runStatusColor('canceled'), CupertinoColors.systemGrey);
});
}
@@ -4,17 +4,14 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/status/run_status_icon.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_list_panel.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
/// The list/detail composition follows the web list: one compact toolbar on a
/// 12px inset, rows with a title line, a muted facts line, the version and the
/// last run, separated from each other, and a one-line detail identity header
/// whose recorded facts live at the top of Summary.
/// 12px inset, rows with a stable avatar, title/time and one muted facts line,
/// while detailed identity remains in the selected pipeline.
void main() {
testWidgets('rows and separators share the web list inset', (tester) async {
final fixture = PipelineFixture();
@@ -25,14 +22,9 @@ void main() {
// Filter and sort are app-bar actions; no toolbar row without a filter.
expect(find.byKey(const Key('pipeline-toolbar')), findsNothing);
// A native leading flow icon gives each pipeline a durable identity while
// the title follows its normal ListTile spacing.
expect(find.byIcon(Icons.account_tree_outlined), findsNWidgets(3));
expect(
tester.getTopLeft(find.byIcon(Icons.account_tree_outlined).first).dx -
listLeft,
kPipelineListInset,
);
// Each pipeline has a deterministic tinted initial rather than one generic
// flow icon, while the title follows native ListTile spacing.
expect(find.byKey(const Key('pipeline-avatar-1')), findsOneWidget);
expect(
tester.getTopLeft(find.text('Alpha review')).dx,
greaterThan(listLeft),
@@ -43,16 +35,13 @@ void main() {
findsNWidgets(fixture.summaries.length - 1),
);
// The version trails the title line; the recorded facts are one line and
// the run line is the web's status glyph plus its fragments.
expect(find.textContaining('v2 · #'), findsOneWidget);
// The title's trailing time and the one muted facts line replace the old
// version/id, run metadata, and graph stack.
expect(find.textContaining('v2 · #'), findsNothing);
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
final glyphs = tester
.widgetList<RunStatusIcon>(find.byType(RunStatusIcon))
.map((icon) => icon.label);
expect(glyphs, unorderedEquals(['Succeeded', 'Failed']));
expect(find.textContaining('Succeeded'), findsNothing);
expect(find.text('no runs recorded'), findsOneWidget);
expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget);
expect(find.byKey(const Key('pipeline-status-2')), findsOneWidget);
expect(find.text('no runs recorded'), findsNothing);
});
testWidgets('the detail header is one identity line; Summary keeps facts', (
@@ -111,9 +100,8 @@ void main() {
expect(tester.takeException(), isNull);
expect(find.text('Alpha review'), findsOneWidget);
expect(find.textContaining('v2 · #'), findsOneWidget);
// The facts line wraps instead of truncating at large text.
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
expect(find.textContaining('v2 · #'), findsNothing);
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
});
testWidgets('compact split panes prioritise a pipeline name and state', (
@@ -153,7 +141,7 @@ void main() {
expect(
find.descendant(
of: firstRow,
matching: find.byIcon(Icons.account_tree_outlined),
matching: find.byKey(const Key('pipeline-avatar-1')),
),
findsNothing,
);
@@ -228,49 +216,11 @@ void main() {
expect(find.byType(CupertinoListTile), findsWidgets);
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
expect(find.textContaining('v2 · #'), findsOneWidget);
expect(
find.byWidgetPredicate(
(widget) => widget is RunStatusIcon && widget.label == 'Succeeded',
),
findsOneWidget,
);
expect(find.textContaining('v2 · #'), findsNothing);
expect(find.byKey(const Key('pipeline-avatar-1')), findsOneWidget);
expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget);
} finally {
debugDefaultTargetPlatformOverride = null;
}
});
testWidgets('a row puts its facts in the corners', (tester) async {
final fixture = PipelineFixture();
await pumpWide(tester, gatewayFor(fixture));
final row = tester.getRect(find.byKey(const Key('pipeline-row-1')));
final name = tester.getRect(find.text('Alpha review'));
final version = tester.getRect(find.textContaining('v2 · #1'));
final what = tester.getRect(find.text('2 stages · 1 schedule'));
final updated = tester.getRect(find.text('updated 17 Oct 21:26'));
// Top: name left, version and id right; below: what left, updated right.
expect(version.center.dy, moreOrLessEquals(name.center.dy, epsilon: 2));
expect(version.right, greaterThan(row.center.dx));
expect(name.left, lessThan(row.center.dx));
expect(what.top, greaterThanOrEqualTo(name.bottom));
expect(updated.right, greaterThan(row.center.dx));
expect(updated.top, greaterThan(what.top));
});
testWidgets('right-hand row items end flush with the same edge', (
tester,
) async {
final fixture = PipelineFixture();
await pumpWide(tester, gatewayFor(fixture));
final version = tester.getRect(find.textContaining('v2 · #1'));
final updated = tester.getRect(find.text('updated 17 Oct 21:26'));
expect(updated.right, moreOrLessEquals(version.right, epsilon: 1));
final mini = find.byKey(const Key('pipeline-mini-1'));
if (mini.evaluate().isNotEmpty) {
expect(
tester.getRect(mini).right,
moreOrLessEquals(version.right, epsilon: 1),
);
}
});
}
@@ -114,18 +114,19 @@ void main() {
await pumpWide(tester, gateway);
expect(find.text('Seven'), findsOneWidget);
// Facts sit in the row's corners: what it is, and when it changed.
expect(find.text('2 stages'), findsWidgets);
expect(find.text('updated 17 Oct 21:26'), findsOneWidget);
expect(find.text('v3 · #7'), findsOneWidget);
// The list keeps one factual subtitle; timestamps and identity are detail
// facts rather than a dense second/third row of metadata.
expect(find.textContaining('2 stages'), findsWidgets);
expect(find.text('updated 17 Oct 21:26'), findsNothing);
expect(find.text('v3 · #7'), findsNothing);
expect(find.text('pipeline 8'), findsOneWidget);
expect(find.text('v1 · #8'), findsOneWidget);
expect(find.text('v1 · #8'), findsNothing);
expect(find.text('0 stages'), findsOneWidget);
expect(find.text('v4 · #9'), findsOneWidget);
expect(find.textContaining('updated '), findsOneWidget);
expect(find.text('no runs recorded'), findsNWidgets(3));
expect(find.textContaining('0 stages'), findsOneWidget);
expect(find.text('v4 · #9'), findsNothing);
expect(find.textContaining('updated '), findsNothing);
expect(find.text('no runs recorded'), findsNothing);
});
});
}
@@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_list_panel.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
/// The list row's recorded flow cue: the reply's `shape` is drawn through the
/// shared graph layout, and nothing is invented or fetched when it is absent.
/// The list stays a concise index; graph cues belong in the selected detail.
void main() {
group('pipeline row miniature', () {
testWidgets('a recorded shape draws the row miniature', (tester) async {
group('pipeline list graph cues', () {
testWidgets('a recorded shape does not draw a list miniature', (
tester,
) async {
final fixture = PipelineFixture();
final gateway = gatewayFor(
fixture,
@@ -21,13 +21,14 @@ void main() {
await pumpWide(tester, gateway);
expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget);
// The cue is additive: the recorded facts line is unchanged.
expect(find.textContaining('#7'), findsOneWidget);
expect(find.byKey(const Key('pipeline-mini-7')), findsNothing);
expect(find.textContaining('#7'), findsNothing);
expect(find.textContaining('2 stages'), findsOneWidget);
});
testWidgets('a summary without a shape draws no miniature', (tester) async {
testWidgets('a summary without a shape retains its concise subtitle', (
tester,
) async {
final fixture = PipelineFixture();
final gateway = gatewayFor(
fixture,
@@ -36,39 +37,9 @@ void main() {
await pumpWide(tester, gateway);
expect(find.byType(PipelineMiniGraph), findsNothing);
expect(find.byKey(const Key('pipeline-mini-8')), findsNothing);
expect(find.textContaining('#8'), findsOneWidget);
expect(find.textContaining('#8'), findsNothing);
expect(find.textContaining('1 stage'), findsOneWidget);
});
testWidgets('a miniature never fetches another origin or pipeline detail', (
tester,
) async {
final fixture = PipelineFixture();
final shape = reviewGraph();
final stage = (shape['stages'] as List).first as Map<String, dynamic>;
// A recorded external preview must be ignored: the row draws only the
// recorded flow and never requests another origin.
stage['preview'] = 'https://images.example.test/mini.png';
stage['url'] = 'https://images.example.test/mini.png';
final gateway = gatewayFor(
fixture,
summaries: [
pipelineSummary(id: 9, name: 'Remote', stages: 2)..['shape'] = shape,
],
);
await pumpWide(tester, gateway);
expect(find.byKey(const Key('pipeline-mini-9')), findsOneWidget);
expect(find.byType(Image), findsNothing);
expect(gateway.callsOf('get_pipeline'), isEmpty);
expect(
gateway.calls.map((call) => call.type),
everyElement(isIn(<String>['list_pipelines', 'list_runs'])),
);
expect(find.textContaining('#9'), findsOneWidget);
});
});
}
@@ -43,7 +43,9 @@ void main() {
expect(running.progress, '1 step · at review');
});
testWidgets('a run row places its facts in the corners', (tester) async {
testWidgets('a normal row groups its title, age, and one subtitle', (
tester,
) async {
tester.view.physicalSize = const Size(800, 400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
@@ -56,21 +58,16 @@ void main() {
);
Rect at(String text) => tester.getRect(find.text(text));
final title = at('Ship the release notes');
final number = at('#42');
final pipeline = at('release');
final duration = at('2m 5s');
final steps = at('3 steps');
// Left column: run, pipeline, time; right column: number, duration, steps.
expect(number.center.dy, moreOrLessEquals(title.center.dy));
expect(duration.center.dy, moreOrLessEquals(pipeline.center.dy));
expect(pipeline.top, greaterThanOrEqualTo(title.bottom));
expect(steps.top, greaterThanOrEqualTo(duration.bottom));
for (final right in [number, duration, steps]) {
expect(right.right, greaterThan(800 - 32));
}
final age = at('12h ago');
final subtitle = at('release · 2m 5s · 3 steps');
expect(age.center.dy, moreOrLessEquals(title.center.dy));
expect(subtitle.top, greaterThanOrEqualTo(title.bottom));
expect(find.text('#42'), findsNothing);
expect(find.byIcon(Icons.check_circle_outline), findsOneWidget);
});
testWidgets('uses a muted pipeline fallback only when it is absent', (
testWidgets('includes a pipeline fallback in its single subtitle', (
tester,
) async {
await tester.pumpWidget(
@@ -84,7 +81,10 @@ void main() {
),
);
expect(find.text('Pipeline unavailable'), findsOneWidget);
expect(
find.text('Pipeline unavailable · 2m 5s · 3 steps'),
findsOneWidget,
);
});
testWidgets('gives a list action menu a per-run key', (tester) async {
+1 -1
View File
@@ -47,7 +47,7 @@ const RUNS = [
},
{
id: 4, title: 'Fixture cancel run', name: 'fixture-cancel',
status: 'running', executing: true,
status: 'canceled', executing: false,
created_at: '2026-10-21T09:00:00Z', pipeline_id: 10,
},
{