merge main into install-app

This commit is contained in:
2026-10-23 21:53:29 +01:00
4 changed files with 53 additions and 1 deletions
+1 -1
View File
@@ -421,6 +421,7 @@ class _PipelinesAppState extends State<PipelinesApp>
onRunStarted: _runStarted,
onViewPipelineRuns: (id) =>
_delegate.goTo(AppRoute.runsForPipeline(id)),
onOpenSchedules: _delegate.openSchedules,
initialPipelineId: pipelinesRoute.pipelineId,
initialVersion: pipelinesRoute.version,
initialStageKey: pipelinesRoute.stageKey,
@@ -473,7 +474,6 @@ class _PipelinesAppState extends State<PipelinesApp>
initialEndpoint: _session.endpoint,
embedded: true,
onOpenTemplates: _delegate.openTemplates,
onOpenSchedules: _delegate.openSchedules,
notifications: _notifications,
),
},
@@ -20,6 +20,7 @@ class PipelinesDestination extends StatelessWidget {
this.refreshToken = 0,
this.onRunStarted,
this.onViewPipelineRuns,
this.onOpenSchedules,
this.initialPipelineId,
this.initialVersion = 0,
this.initialStageKey,
@@ -36,6 +37,7 @@ class PipelinesDestination extends StatelessWidget {
/// Receives the run id an accepted launch named; the shell opens that route.
final ValueChanged<int>? onRunStarted;
final ValueChanged<int>? onViewPipelineRuns;
final VoidCallback? onOpenSchedules;
/// The pipeline and pinned version a deep link names.
final int? initialPipelineId;
@@ -81,6 +83,7 @@ class PipelinesDestination extends StatelessWidget {
embedded: true,
onRunStarted: onRunStarted,
onViewPipelineRuns: onViewPipelineRuns,
onOpenSchedules: onOpenSchedules,
initialPipelineId: initialPipelineId,
initialVersion: initialVersion,
initialStageKey: initialStageKey,
+30
View File
@@ -32,6 +32,7 @@ class PipelinesScreen extends StatefulWidget {
this.syncToken = 0,
this.onRunStarted,
this.onViewPipelineRuns,
this.onOpenSchedules,
this.initialPipelineId,
this.initialVersion = 0,
this.initialStageKey,
@@ -54,6 +55,9 @@ class PipelinesScreen extends StatefulWidget {
final ValueChanged<int>? onRunStarted;
final ValueChanged<int>? onViewPipelineRuns;
/// Opens every schedule; shown in the bar while the list is visible.
final VoidCallback? onOpenSchedules;
/// The pipeline a deep link names, opened after the list read starts.
final int? initialPipelineId;
@@ -234,6 +238,8 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
return ShellBar(
actions: [
if (listShown) ...pipelineListActions(context, _controller),
if (listShown && widget.onOpenSchedules != null)
_schedulesButton(context),
_refreshButton(context),
],
child: body,
@@ -250,6 +256,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
mainAxisSize: MainAxisSize.min,
children: [
...pipelineListActions(context, _controller),
if (widget.onOpenSchedules != null) _schedulesButton(context),
_refreshButton(context),
],
),
@@ -260,6 +267,27 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
);
}
Widget _schedulesButton(BuildContext context) {
if (useCupertinoControls(context)) {
return Semantics(
button: true,
label: 'Schedules',
child: CupertinoButton(
key: const Key('pipelines-open-schedules'),
padding: EdgeInsets.zero,
onPressed: widget.onOpenSchedules,
child: const Icon(CupertinoIcons.calendar),
),
);
}
return IconButton(
key: const Key('pipelines-open-schedules'),
tooltip: 'Schedules',
onPressed: widget.onOpenSchedules,
icon: const Icon(Icons.schedule),
);
}
Widget _refreshButton(BuildContext context) {
if (useCupertinoControls(context)) {
return Semantics(
@@ -295,6 +323,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
title: const Text('Pipelines'),
actions: [
...pipelineListActions(context, _controller),
if (widget.onOpenSchedules != null) _schedulesButton(context),
_refreshButton(context),
],
),
@@ -310,6 +339,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
mainAxisSize: MainAxisSize.min,
children: [
...pipelineListActions(context, _controller),
if (widget.onOpenSchedules != null) _schedulesButton(context),
_refreshButton(context),
],
),
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
@@ -146,4 +147,22 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Beta deploy'), findsOneWidget);
});
for (final cupertino in [false, true]) {
testWidgets('Schedules opens from the bar (cupertino: $cupertino)', (
tester,
) async {
var opened = 0;
final screen = PipelinesScreen(
gateway: gatewayFor(PipelineFixture()),
onOpenSchedules: () => opened++,
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('pipelines-open-schedules')));
expect(opened, 1);
});
}
}