From 766be32748896770f06c3b9f194656cbf2495f56 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 23 Oct 2026 20:11:09 +0100 Subject: [PATCH] feat(app): the pipelines list switches between all and scheduled --- .../widgets/pipeline_list_panel.dart | 37 +++++++++++++++++++ .../pipelines_screen_filter_test.dart | 29 +++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart index a9d4335d..4dfe9f93 100644 --- a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart +++ b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart @@ -37,6 +37,7 @@ class PipelineListPanel extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ + _scope(context, filters), _toolbar(context, filters, hasUnclassified), if (controller.listError != null) PipelineErrorBanner( @@ -62,6 +63,42 @@ class PipelineListPanel extends StatelessWidget { /// The web's compact toolbar: filter (whose page carries the name search), /// sort and clear, on the list's 12px inset with a separator underneath. + /// All pipelines, or only those with a schedule. + Widget _scope(BuildContext context, PipelineFilters filters) { + final scheduled = filters.schedule == ScheduleFilter.scheduled; + void pick(bool value) => controller.setFilters( + filters.copyWith( + schedule: value ? ScheduleFilter.scheduled : ScheduleFilter.any, + ), + ); + final control = useCupertinoControls(context) + ? CupertinoSlidingSegmentedControl( + key: const Key('pipeline-scope'), + groupValue: scheduled, + onValueChanged: (value) => pick(value ?? false), + children: const {false: Text('All'), true: Text('Scheduled')}, + ) + : SegmentedButton( + key: const Key('pipeline-scope'), + showSelectedIcon: false, + segments: const [ + ButtonSegment(value: false, label: Text('All')), + ButtonSegment(value: true, label: Text('Scheduled')), + ], + selected: {scheduled}, + onSelectionChanged: (value) => pick(value.single), + ); + return Padding( + padding: const EdgeInsets.fromLTRB( + kPipelineListInset, + 6, + kPipelineListInset, + 4, + ), + child: SizedBox(width: double.infinity, child: control), + ); + } + /// Filter and sort are in the app bar; only an active filter keeps a /// one-tap way back here. Widget _toolbar( diff --git a/app/test/features/pipelines/pipelines_screen_filter_test.dart b/app/test/features/pipelines/pipelines_screen_filter_test.dart index ad8a79c6..ced73e54 100644 --- a/app/test/features/pipelines/pipelines_screen_filter_test.dart +++ b/app/test/features/pipelines/pipelines_screen_filter_test.dart @@ -117,4 +117,33 @@ void main() { expect(find.text('Retry'), findsOneWidget); expect(find.text('Select a pipeline.'), findsNothing); }); + + testWidgets('the list switches between all and scheduled pipelines', ( + tester, + ) async { + final fixture = PipelineFixture(); + await pumpWide(tester, gatewayFor(fixture)); + expect(find.text('Alpha review'), findsOneWidget); + expect(find.text('Gamma legacy'), findsOneWidget); + + await tester.tap( + find.descendant( + of: find.byKey(const Key('pipeline-scope')), + matching: find.text('Scheduled'), + ), + ); + await tester.pumpAndSettle(); + // Beta has no schedule in the fixture; Alpha has one. + expect(find.text('Alpha review'), findsOneWidget); + expect(find.text('Beta deploy'), findsNothing); + + await tester.tap( + find.descendant( + of: find.byKey(const Key('pipeline-scope')), + matching: find.text('All'), + ), + ); + await tester.pumpAndSettle(); + expect(find.text('Beta deploy'), findsOneWidget); + }); }