diff --git a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart index e24c33fc..5db43c02 100644 --- a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart +++ b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart @@ -196,7 +196,7 @@ class PipelineListPanel extends StatelessWidget { ); } - /// The row's title line: its name and its version at the trailing edge. + /// The row's title line: its name, and its version and id in the corner. Widget _rowTitle(BuildContext context, PipelineSummary pipeline) { final muted = _mutedStyle(context); return Row( @@ -211,54 +211,41 @@ class PipelineListPanel extends StatelessWidget { ), ), const SizedBox(width: 8), - Text(pipelineVersionLabel(pipeline), style: muted), + Flexible( + child: Text( + '${pipelineVersionLabel(pipeline)} · #${pipeline.id}', + style: muted, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), ], ); } - /// The row's one muted metadata line plus its last-run line. - /// - /// Everything printed comes from recorded values: the identity, the stage - /// count, the configured schedules and the parseable updated time. The run - /// line is the web's status glyph plus its `row-meta` fragments - /// (`2h ago · 1m 5s · run 42`). + /// 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. Widget _rowMetadata( BuildContext context, PipelineSummary pipeline, DateTime now, ) { final style = _mutedStyle(context); - final facts = [ - 'id ${pipeline.id}', + final what = [ pipelineStageSummary(pipeline), if (pipeline.scheduleLabel.isNotEmpty) pipeline.scheduleLabel, - ?pipelineUpdatedLine(pipeline), ].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; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // The web prints the miniature as its own right-aligned block below the - // title rather than inside the title line. - if (shape != null) - Align( - alignment: AlignmentDirectional.centerEnd, - child: PipelineMiniGraph( - key: Key('pipeline-mini-${pipeline.id}'), - shape: shape, - ), - ), - Text(facts, style: style), - // 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`. - if (controller.runsLoaded && badge == null) - Text('no runs recorded', style: style), - if (badge != null) - Row( + // 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, @@ -275,7 +262,50 @@ class PipelineListPanel extends StatelessWidget { ), ), ], - ), + ) + : controller.runsLoaded + ? Text('no runs recorded', style: style) + : const SizedBox.shrink(); + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded(child: Text(what, style: style)), + if (shape != null) ...[ + const SizedBox(width: 8), + // The miniature keeps to its corner and scales down when narrow. + Flexible( + 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), + Flexible( + child: Text( + updated, + style: style, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ], + ), ], ); } diff --git a/app/test/application/pipelines_registration_test.dart b/app/test/application/pipelines_registration_test.dart index edce4eb5..1fe7383d 100644 --- a/app/test/application/pipelines_registration_test.dart +++ b/app/test/application/pipelines_registration_test.dart @@ -57,7 +57,7 @@ void main() { expect(find.text('Alpha review'), findsOneWidget); expect( - find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'), + find.text('2 stages · 1 schedule'), findsOneWidget, ); expect(find.text('Pipelines — Not implemented'), findsNothing); diff --git a/app/test/features/pipelines/pipeline_list_composition_test.dart b/app/test/features/pipelines/pipeline_list_composition_test.dart index 63b082d1..e90e7063 100644 --- a/app/test/features/pipelines/pipeline_list_composition_test.dart +++ b/app/test/features/pipelines/pipeline_list_composition_test.dart @@ -35,11 +35,8 @@ void main() { // 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.text('v2'), findsOneWidget); - expect( - find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'), - findsOneWidget, - ); + expect(find.textContaining('v2 · #'), findsOneWidget); + expect(find.text('2 stages · 1 schedule'), findsOneWidget); final glyphs = tester .widgetList(find.byType(RunStatusIcon)) .map((icon) => icon.label); @@ -104,7 +101,7 @@ void main() { expect(tester.takeException(), isNull); expect(find.text('Alpha review'), findsOneWidget); - expect(find.text('v2'), 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); }); @@ -125,11 +122,8 @@ void main() { await tester.pumpAndSettle(); expect(find.byType(CupertinoListTile), findsWidgets); - expect( - find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'), - findsOneWidget, - ); - expect(find.text('v2'), findsOneWidget); + expect(find.text('2 stages · 1 schedule'), findsOneWidget); + expect(find.textContaining('v2 · #'), findsOneWidget); expect( find.byWidgetPredicate( (widget) => widget is RunStatusIcon && widget.label == 'Succeeded', @@ -140,4 +134,21 @@ void main() { 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)); + }); } diff --git a/app/test/features/pipelines/pipeline_row_metadata_test.dart b/app/test/features/pipelines/pipeline_row_metadata_test.dart index b6732fbc..1b07cd77 100644 --- a/app/test/features/pipelines/pipeline_row_metadata_test.dart +++ b/app/test/features/pipelines/pipeline_row_metadata_test.dart @@ -114,18 +114,16 @@ void main() { await pumpWide(tester, gateway); expect(find.text('Seven'), findsOneWidget); - expect( - find.text('id 7 · 2 stages · updated 17 Oct 21:26'), - findsOneWidget, - ); - expect(find.text('v3'), 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); expect(find.text('pipeline 8'), findsOneWidget); - expect(find.text('id 8 · 2 stages'), findsOneWidget); - expect(find.text('v1'), findsOneWidget); + expect(find.text('v1 · #8'), findsOneWidget); - expect(find.text('id 9 · 0 stages'), findsOneWidget); - expect(find.text('v4'), findsOneWidget); + 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)); }); diff --git a/app/test/features/pipelines/pipeline_row_miniature_test.dart b/app/test/features/pipelines/pipeline_row_miniature_test.dart index 12f81ce1..8fa18acd 100644 --- a/app/test/features/pipelines/pipeline_row_miniature_test.dart +++ b/app/test/features/pipelines/pipeline_row_miniature_test.dart @@ -23,7 +23,8 @@ void main() { expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget); // The cue is additive: the recorded facts line is unchanged. - expect(find.textContaining('id 7 · 2 stages'), findsOneWidget); + expect(find.textContaining('#7'), findsOneWidget); + expect(find.textContaining('2 stages'), findsOneWidget); }); testWidgets('a summary without a shape draws no miniature', (tester) async { @@ -37,7 +38,8 @@ void main() { expect(find.byType(PipelineMiniGraph), findsNothing); expect(find.byKey(const Key('pipeline-mini-8')), findsNothing); - expect(find.textContaining('id 8 · 1 stage'), findsOneWidget); + expect(find.textContaining('#8'), findsOneWidget); + expect(find.textContaining('1 stage'), findsOneWidget); }); testWidgets('a miniature never fetches another origin or pipeline detail', ( @@ -66,7 +68,7 @@ void main() { gateway.calls.map((call) => call.type), everyElement(isIn(['list_pipelines', 'list_runs'])), ); - expect(find.textContaining('id 9 · 2 stages'), findsOneWidget); + expect(find.textContaining('#9'), findsOneWidget); }); }); } diff --git a/app/test/features/pipelines/pipelines_screen_test.dart b/app/test/features/pipelines/pipelines_screen_test.dart index 9c12ec28..3164ad57 100644 --- a/app/test/features/pipelines/pipelines_screen_test.dart +++ b/app/test/features/pipelines/pipelines_screen_test.dart @@ -20,7 +20,7 @@ void main() { expect(find.text('Pipelines'), findsOneWidget); expect(find.text('Alpha review'), findsOneWidget); expect( - find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'), + find.text('2 stages · 1 schedule'), findsOneWidget, ); expect(find.textContaining('run 42'), findsOneWidget);