polish runs and pipelines lists
This commit is contained in:
@@ -139,6 +139,12 @@ class PipelineListPanel extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
useCupertinoControls(context)
|
||||
? CupertinoIcons.flowchart
|
||||
: Icons.account_tree_outlined,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const PipelineProgress(label: 'Loading pipelines'),
|
||||
for (final message in messages)
|
||||
Padding(
|
||||
@@ -158,6 +164,12 @@ class PipelineListPanel extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
useCupertinoControls(context)
|
||||
? CupertinoIcons.tray
|
||||
: Icons.inbox_outlined,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
empty.message,
|
||||
textAlign: TextAlign.center,
|
||||
@@ -193,6 +205,7 @@ class PipelineListPanel extends StatelessWidget {
|
||||
horizontal: kPipelineListInset,
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
leading: _pipelineIdentityIcon(context),
|
||||
title: _rowTitle(context, pipeline),
|
||||
subtitle: _rowMetadata(context, pipeline, now),
|
||||
);
|
||||
@@ -216,6 +229,7 @@ class PipelineListPanel extends StatelessWidget {
|
||||
backgroundColor: controller.selectedId == pipeline.id
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: null,
|
||||
leading: _pipelineIdentityIcon(context),
|
||||
title: _rowTitle(context, pipeline),
|
||||
subtitle: _rowMetadata(context, pipeline, now),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
@@ -372,6 +386,15 @@ class PipelineListPanel extends StatelessWidget {
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
);
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
@@ -38,6 +38,7 @@ class RunMoreMenu extends StatefulWidget {
|
||||
required this.onRunChanged,
|
||||
required this.cupertino,
|
||||
this.onRunOpened,
|
||||
this.menuKey = runMoreMenuKey,
|
||||
});
|
||||
|
||||
final JsonMap run;
|
||||
@@ -48,6 +49,9 @@ class RunMoreMenu extends StatefulWidget {
|
||||
/// Opens the new run an accepted retry names.
|
||||
final ValueChanged<num>? onRunOpened;
|
||||
|
||||
/// Detail menus retain the shared key; list rows supply a per-run key.
|
||||
final Key menuKey;
|
||||
|
||||
@override
|
||||
State<RunMoreMenu> createState() => _RunMoreMenuState();
|
||||
}
|
||||
@@ -93,7 +97,7 @@ class _RunMoreMenuState extends State<RunMoreMenu> {
|
||||
if (items.isEmpty) return const SizedBox.shrink();
|
||||
if (!widget.cupertino) {
|
||||
return PopupMenuButton<_RunMoreItem>(
|
||||
key: runMoreMenuKey,
|
||||
key: widget.menuKey,
|
||||
icon: const Icon(Icons.more_vert),
|
||||
tooltip: 'More actions',
|
||||
onSelected: (item) => _pick(context, item),
|
||||
@@ -108,7 +112,7 @@ class _RunMoreMenuState extends State<RunMoreMenu> {
|
||||
label: 'More actions',
|
||||
excludeSemantics: true,
|
||||
child: CupertinoButton(
|
||||
key: runMoreMenuKey,
|
||||
key: widget.menuKey,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
|
||||
onPressed: () async {
|
||||
|
||||
@@ -13,6 +13,7 @@ import '../../attention/ui/needs_you_runs_heading.dart';
|
||||
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';
|
||||
import 'runs_filters.dart';
|
||||
@@ -100,10 +101,12 @@ class RunsList extends StatelessWidget {
|
||||
|
||||
Widget _list(BuildContext context) {
|
||||
if (controller.loading && controller.runs.isEmpty) {
|
||||
return Center(
|
||||
child: usesCupertinoHost(context)
|
||||
return _state(
|
||||
context,
|
||||
icon: usesCupertinoHost(context)
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
title: 'Loading runs…',
|
||||
);
|
||||
}
|
||||
if (controller.error != null && controller.runs.isEmpty) {
|
||||
@@ -116,7 +119,16 @@ class RunsList extends StatelessWidget {
|
||||
RunsFilters(controller: controller),
|
||||
Expanded(
|
||||
child: controller.visibleRuns.isEmpty
|
||||
? const Center(child: Text('No runs found.'))
|
||||
? _state(
|
||||
context,
|
||||
icon: Icon(
|
||||
usesCupertinoHost(context)
|
||||
? CupertinoIcons.tray
|
||||
: Icons.inbox_outlined,
|
||||
),
|
||||
title: 'No runs found.',
|
||||
subtitle: 'Try changing or clearing the filters.',
|
||||
)
|
||||
: _groupedRuns(context),
|
||||
),
|
||||
],
|
||||
@@ -164,6 +176,12 @@ class RunsList extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
usesCupertinoHost(context)
|
||||
? CupertinoIcons.exclamationmark_triangle
|
||||
: Icons.error_outline,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(controller.error!),
|
||||
const SizedBox(height: 8),
|
||||
usesCupertinoHost(context)
|
||||
@@ -179,6 +197,37 @@ class RunsList extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
|
||||
Widget _state(
|
||||
BuildContext context, {
|
||||
required Widget icon,
|
||||
required String title,
|
||||
String? subtitle,
|
||||
}) => Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
icon,
|
||||
const SizedBox(height: 12),
|
||||
Text(title, textAlign: TextAlign.center),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: usesCupertinoHost(context)
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _inlineError(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
@@ -202,6 +251,9 @@ class RunsList extends StatelessWidget {
|
||||
selected: id == controller.selectedRunId,
|
||||
now: DateTime.now(),
|
||||
onTap: id is num ? () => onSelected(id) : null,
|
||||
gateway: controller.repository.gateway,
|
||||
onRunChanged: controller.acceptRunDetail,
|
||||
onRunOpened: onSelected,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -216,12 +268,18 @@ class RunListRow extends StatelessWidget {
|
||||
required this.now,
|
||||
this.selected = false,
|
||||
this.onTap,
|
||||
this.gateway,
|
||||
this.onRunChanged,
|
||||
this.onRunOpened,
|
||||
});
|
||||
|
||||
final JsonMap run;
|
||||
final DateTime now;
|
||||
final bool selected;
|
||||
final VoidCallback? onTap;
|
||||
final ApiGateway? gateway;
|
||||
final ValueChanged<JsonMap>? onRunChanged;
|
||||
final ValueChanged<num>? onRunOpened;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -233,6 +291,14 @@ class RunListRow extends StatelessWidget {
|
||||
// A run without its own title is named by its pipeline, so the pipeline
|
||||
// line does not repeat it.
|
||||
final pipeline = identity.pipeline?.trim();
|
||||
// With no stored title, `name` is already the row title; repeating it as
|
||||
// a subtitle adds no identity. A titled run with an empty name genuinely
|
||||
// lacks its pipeline, so make that absence explicit.
|
||||
final pipelineLabel = pipeline == null
|
||||
? null
|
||||
: pipeline.isEmpty
|
||||
? 'Pipeline unavailable'
|
||||
: pipeline;
|
||||
final secondary = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
@@ -307,11 +373,7 @@ class RunListRow extends StatelessWidget {
|
||||
line(title, id == null ? null : '#$id', titleStyle),
|
||||
const SizedBox(height: 2),
|
||||
line(
|
||||
[
|
||||
if (pipeline != null)
|
||||
pipeline.isEmpty ? 'Pipeline unavailable' : pipeline,
|
||||
if (scheduled) 'Scheduled',
|
||||
].join(' · '),
|
||||
[?pipelineLabel, if (scheduled) 'Scheduled'].join(' · '),
|
||||
facts.duration,
|
||||
small,
|
||||
),
|
||||
@@ -327,6 +389,15 @@ class RunListRow extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (gateway != null && onRunChanged != null && showRunMoreMenu(run))
|
||||
RunMoreMenu(
|
||||
run: run,
|
||||
gateway: gateway!,
|
||||
onRunChanged: onRunChanged!,
|
||||
onRunOpened: onRunOpened,
|
||||
cupertino: cupertino,
|
||||
menuKey: ValueKey('run-list-more-menu-$id'),
|
||||
),
|
||||
],
|
||||
);
|
||||
final padded = Padding(
|
||||
|
||||
@@ -23,10 +23,18 @@ 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.text('Alpha review')).dx - listLeft,
|
||||
tester.getTopLeft(find.byIcon(Icons.account_tree_outlined).first).dx -
|
||||
listLeft,
|
||||
kPipelineListInset,
|
||||
);
|
||||
expect(
|
||||
tester.getTopLeft(find.text('Alpha review')).dx,
|
||||
greaterThan(listLeft),
|
||||
);
|
||||
|
||||
expect(
|
||||
find.descendant(of: list, matching: find.byType(Divider)),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/domain/run_models.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_list.dart';
|
||||
|
||||
final _finished = {
|
||||
@@ -14,6 +16,14 @@ final _finished = {
|
||||
'completed_steps': 3,
|
||||
};
|
||||
|
||||
class _FakeGateway implements ApiGateway {
|
||||
@override
|
||||
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async => {};
|
||||
|
||||
@override
|
||||
Stream<JsonMap> get frames => const Stream.empty();
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('row facts: when, how long and how far', () {
|
||||
final facts = runRowFacts(_finished, DateTime.utc(2026, 10, 22));
|
||||
@@ -59,4 +69,39 @@ void main() {
|
||||
expect(right.right, greaterThan(800 - 32));
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('uses a muted pipeline fallback only when it is absent', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: RunListRow(
|
||||
run: {..._finished, 'name': ''},
|
||||
now: DateTime.utc(2026, 10, 22),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Pipeline unavailable'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('gives a list action menu a per-run key', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: RunListRow(
|
||||
run: _finished,
|
||||
now: DateTime.utc(2026, 10, 22),
|
||||
gateway: _FakeGateway(),
|
||||
onRunChanged: (_) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsOneWidget);
|
||||
expect(find.byKey(runMoreMenuKey), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user