merge(app): land pipeline row corners
This commit is contained in:
@@ -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) {
|
Widget _rowTitle(BuildContext context, PipelineSummary pipeline) {
|
||||||
final muted = _mutedStyle(context);
|
final muted = _mutedStyle(context);
|
||||||
return Row(
|
return Row(
|
||||||
@@ -211,54 +211,41 @@ class PipelineListPanel extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
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.
|
/// 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
|
||||||
/// Everything printed comes from recorded values: the identity, the stage
|
/// it was updated. Everything comes from recorded values.
|
||||||
/// 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`).
|
|
||||||
Widget _rowMetadata(
|
Widget _rowMetadata(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
PipelineSummary pipeline,
|
PipelineSummary pipeline,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
) {
|
) {
|
||||||
final style = _mutedStyle(context);
|
final style = _mutedStyle(context);
|
||||||
final facts = <String>[
|
final what = [
|
||||||
'id ${pipeline.id}',
|
|
||||||
pipelineStageSummary(pipeline),
|
pipelineStageSummary(pipeline),
|
||||||
if (pipeline.scheduleLabel.isNotEmpty) pipeline.scheduleLabel,
|
if (pipeline.scheduleLabel.isNotEmpty) pipeline.scheduleLabel,
|
||||||
?pipelineUpdatedLine(pipeline),
|
|
||||||
].join(' · ');
|
].join(' · ');
|
||||||
|
final updated = pipelineUpdatedLine(pipeline);
|
||||||
final run = controller.runsLoaded
|
final run = controller.runsLoaded
|
||||||
? controller.latestRuns[pipeline.id]
|
? controller.latestRuns[pipeline.id]
|
||||||
: null;
|
: null;
|
||||||
final badge = run == null ? null : runBadge(run, now);
|
final badge = run == null ? null : runBadge(run, now);
|
||||||
final shape = pipeline.shape;
|
final shape = pipeline.shape;
|
||||||
return Column(
|
// As the web's `row-run`: the coloured status glyph (its tooltip and
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// accessible name are the state word), then `2d ago · 4m 12s · run 488`.
|
||||||
children: [
|
final lastRun = badge != null
|
||||||
// The web prints the miniature as its own right-aligned block below the
|
? Row(
|
||||||
// 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(
|
|
||||||
children: [
|
children: [
|
||||||
RunStatusIcon(
|
RunStatusIcon(
|
||||||
state: badge.state,
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void main() {
|
|||||||
|
|
||||||
expect(find.text('Alpha review'), findsOneWidget);
|
expect(find.text('Alpha review'), findsOneWidget);
|
||||||
expect(
|
expect(
|
||||||
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
|
find.text('2 stages · 1 schedule'),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
expect(find.text('Pipelines — Not implemented'), findsNothing);
|
expect(find.text('Pipelines — Not implemented'), findsNothing);
|
||||||
|
|||||||
@@ -35,11 +35,8 @@ void main() {
|
|||||||
|
|
||||||
// The version trails the title line; the recorded facts are one line and
|
// 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.
|
// the run line is the web's status glyph plus its fragments.
|
||||||
expect(find.text('v2'), findsOneWidget);
|
expect(find.textContaining('v2 · #'), findsOneWidget);
|
||||||
expect(
|
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||||
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
final glyphs = tester
|
final glyphs = tester
|
||||||
.widgetList<RunStatusIcon>(find.byType(RunStatusIcon))
|
.widgetList<RunStatusIcon>(find.byType(RunStatusIcon))
|
||||||
.map((icon) => icon.label);
|
.map((icon) => icon.label);
|
||||||
@@ -104,7 +101,7 @@ void main() {
|
|||||||
|
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
expect(find.text('Alpha review'), findsOneWidget);
|
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.
|
// The facts line wraps instead of truncating at large text.
|
||||||
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
|
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
|
||||||
});
|
});
|
||||||
@@ -125,11 +122,8 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.byType(CupertinoListTile), findsWidgets);
|
expect(find.byType(CupertinoListTile), findsWidgets);
|
||||||
expect(
|
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||||
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
|
expect(find.textContaining('v2 · #'), findsOneWidget);
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(find.text('v2'), findsOneWidget);
|
|
||||||
expect(
|
expect(
|
||||||
find.byWidgetPredicate(
|
find.byWidgetPredicate(
|
||||||
(widget) => widget is RunStatusIcon && widget.label == 'Succeeded',
|
(widget) => widget is RunStatusIcon && widget.label == 'Succeeded',
|
||||||
@@ -140,4 +134,21 @@ void main() {
|
|||||||
debugDefaultTargetPlatformOverride = null;
|
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));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,18 +114,16 @@ void main() {
|
|||||||
await pumpWide(tester, gateway);
|
await pumpWide(tester, gateway);
|
||||||
|
|
||||||
expect(find.text('Seven'), findsOneWidget);
|
expect(find.text('Seven'), findsOneWidget);
|
||||||
expect(
|
// Facts sit in the row's corners: what it is, and when it changed.
|
||||||
find.text('id 7 · 2 stages · updated 17 Oct 21:26'),
|
expect(find.text('2 stages'), findsWidgets);
|
||||||
findsOneWidget,
|
expect(find.text('updated 17 Oct 21:26'), findsOneWidget);
|
||||||
);
|
expect(find.text('v3 · #7'), findsOneWidget);
|
||||||
expect(find.text('v3'), findsOneWidget);
|
|
||||||
|
|
||||||
expect(find.text('pipeline 8'), findsOneWidget);
|
expect(find.text('pipeline 8'), findsOneWidget);
|
||||||
expect(find.text('id 8 · 2 stages'), findsOneWidget);
|
expect(find.text('v1 · #8'), findsOneWidget);
|
||||||
expect(find.text('v1'), findsOneWidget);
|
|
||||||
|
|
||||||
expect(find.text('id 9 · 0 stages'), findsOneWidget);
|
expect(find.text('0 stages'), findsOneWidget);
|
||||||
expect(find.text('v4'), findsOneWidget);
|
expect(find.text('v4 · #9'), findsOneWidget);
|
||||||
expect(find.textContaining('updated '), findsOneWidget);
|
expect(find.textContaining('updated '), findsOneWidget);
|
||||||
expect(find.text('no runs recorded'), findsNWidgets(3));
|
expect(find.text('no runs recorded'), findsNWidgets(3));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ void main() {
|
|||||||
|
|
||||||
expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget);
|
expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget);
|
||||||
// The cue is additive: the recorded facts line is unchanged.
|
// 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 {
|
testWidgets('a summary without a shape draws no miniature', (tester) async {
|
||||||
@@ -37,7 +38,8 @@ void main() {
|
|||||||
|
|
||||||
expect(find.byType(PipelineMiniGraph), findsNothing);
|
expect(find.byType(PipelineMiniGraph), findsNothing);
|
||||||
expect(find.byKey(const Key('pipeline-mini-8')), 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', (
|
testWidgets('a miniature never fetches another origin or pipeline detail', (
|
||||||
@@ -66,7 +68,7 @@ void main() {
|
|||||||
gateway.calls.map((call) => call.type),
|
gateway.calls.map((call) => call.type),
|
||||||
everyElement(isIn(<String>['list_pipelines', 'list_runs'])),
|
everyElement(isIn(<String>['list_pipelines', 'list_runs'])),
|
||||||
);
|
);
|
||||||
expect(find.textContaining('id 9 · 2 stages'), findsOneWidget);
|
expect(find.textContaining('#9'), findsOneWidget);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void main() {
|
|||||||
expect(find.text('Pipelines'), findsOneWidget);
|
expect(find.text('Pipelines'), findsOneWidget);
|
||||||
expect(find.text('Alpha review'), findsOneWidget);
|
expect(find.text('Alpha review'), findsOneWidget);
|
||||||
expect(
|
expect(
|
||||||
find.text('id 1 · 2 stages · 1 schedule · updated 17 Oct 21:26'),
|
find.text('2 stages · 1 schedule'),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
expect(find.textContaining('run 42'), findsOneWidget);
|
expect(find.textContaining('run 42'), findsOneWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user