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, onRunStarted: _runStarted,
onViewPipelineRuns: (id) => onViewPipelineRuns: (id) =>
_delegate.goTo(AppRoute.runsForPipeline(id)), _delegate.goTo(AppRoute.runsForPipeline(id)),
onOpenSchedules: _delegate.openSchedules,
initialPipelineId: pipelinesRoute.pipelineId, initialPipelineId: pipelinesRoute.pipelineId,
initialVersion: pipelinesRoute.version, initialVersion: pipelinesRoute.version,
initialStageKey: pipelinesRoute.stageKey, initialStageKey: pipelinesRoute.stageKey,
@@ -473,7 +474,6 @@ class _PipelinesAppState extends State<PipelinesApp>
initialEndpoint: _session.endpoint, initialEndpoint: _session.endpoint,
embedded: true, embedded: true,
onOpenTemplates: _delegate.openTemplates, onOpenTemplates: _delegate.openTemplates,
onOpenSchedules: _delegate.openSchedules,
notifications: _notifications, notifications: _notifications,
), ),
}, },
@@ -20,6 +20,7 @@ class PipelinesDestination extends StatelessWidget {
this.refreshToken = 0, this.refreshToken = 0,
this.onRunStarted, this.onRunStarted,
this.onViewPipelineRuns, this.onViewPipelineRuns,
this.onOpenSchedules,
this.initialPipelineId, this.initialPipelineId,
this.initialVersion = 0, this.initialVersion = 0,
this.initialStageKey, this.initialStageKey,
@@ -36,6 +37,7 @@ class PipelinesDestination extends StatelessWidget {
/// Receives the run id an accepted launch named; the shell opens that route. /// Receives the run id an accepted launch named; the shell opens that route.
final ValueChanged<int>? onRunStarted; final ValueChanged<int>? onRunStarted;
final ValueChanged<int>? onViewPipelineRuns; final ValueChanged<int>? onViewPipelineRuns;
final VoidCallback? onOpenSchedules;
/// The pipeline and pinned version a deep link names. /// The pipeline and pinned version a deep link names.
final int? initialPipelineId; final int? initialPipelineId;
@@ -81,6 +83,7 @@ class PipelinesDestination extends StatelessWidget {
embedded: true, embedded: true,
onRunStarted: onRunStarted, onRunStarted: onRunStarted,
onViewPipelineRuns: onViewPipelineRuns, onViewPipelineRuns: onViewPipelineRuns,
onOpenSchedules: onOpenSchedules,
initialPipelineId: initialPipelineId, initialPipelineId: initialPipelineId,
initialVersion: initialVersion, initialVersion: initialVersion,
initialStageKey: initialStageKey, initialStageKey: initialStageKey,
+30
View File
@@ -32,6 +32,7 @@ class PipelinesScreen extends StatefulWidget {
this.syncToken = 0, this.syncToken = 0,
this.onRunStarted, this.onRunStarted,
this.onViewPipelineRuns, this.onViewPipelineRuns,
this.onOpenSchedules,
this.initialPipelineId, this.initialPipelineId,
this.initialVersion = 0, this.initialVersion = 0,
this.initialStageKey, this.initialStageKey,
@@ -54,6 +55,9 @@ class PipelinesScreen extends StatefulWidget {
final ValueChanged<int>? onRunStarted; final ValueChanged<int>? onRunStarted;
final ValueChanged<int>? onViewPipelineRuns; 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. /// The pipeline a deep link names, opened after the list read starts.
final int? initialPipelineId; final int? initialPipelineId;
@@ -234,6 +238,8 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
return ShellBar( return ShellBar(
actions: [ actions: [
if (listShown) ...pipelineListActions(context, _controller), if (listShown) ...pipelineListActions(context, _controller),
if (listShown && widget.onOpenSchedules != null)
_schedulesButton(context),
_refreshButton(context), _refreshButton(context),
], ],
child: body, child: body,
@@ -250,6 +256,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
...pipelineListActions(context, _controller), ...pipelineListActions(context, _controller),
if (widget.onOpenSchedules != null) _schedulesButton(context),
_refreshButton(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) { Widget _refreshButton(BuildContext context) {
if (useCupertinoControls(context)) { if (useCupertinoControls(context)) {
return Semantics( return Semantics(
@@ -295,6 +323,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
title: const Text('Pipelines'), title: const Text('Pipelines'),
actions: [ actions: [
...pipelineListActions(context, _controller), ...pipelineListActions(context, _controller),
if (widget.onOpenSchedules != null) _schedulesButton(context),
_refreshButton(context), _refreshButton(context),
], ],
), ),
@@ -310,6 +339,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
...pipelineListActions(context, _controller), ...pipelineListActions(context, _controller),
if (widget.onOpenSchedules != null) _schedulesButton(context),
_refreshButton(context), _refreshButton(context),
], ],
), ),
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/screen.dart'; import 'package:pipelines_app/features/pipelines/screen.dart';
@@ -146,4 +147,22 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Beta deploy'), findsOneWidget); 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);
});
}
} }