WIP: pipeline page Runs/Run icon actions (run #230)

This commit is contained in:
2026-11-01 20:37:29 +00:00
parent 4503febb07
commit f8903e2f6d
6 changed files with 42 additions and 89 deletions
+1
View File
@@ -497,6 +497,7 @@ class _PipelinesAppState extends State<PipelinesApp>
AppDestination.pipelines: (_) => PipelinesDestination(
session: _session,
server: widget.server,
active: _destinationOf(route.kind) == AppDestination.pipelines,
legacyPendingEndpoints: widget.legacyPendingEndpoints,
refreshToken: _pipelinesRefresh,
onRunStarted: _runStarted,
@@ -20,6 +20,7 @@ class PipelinesDestination extends StatelessWidget {
required this.session,
required this.server,
this.refreshToken = 0,
this.active = true,
this.onRunStarted,
this.onViewPipelineRuns,
this.onOpenSchedules,
@@ -39,6 +40,9 @@ class PipelinesDestination extends StatelessWidget {
/// accepted; the rows still come only from the server's next reply.
final int refreshToken;
/// Keeps a pushed pipeline detail from covering another selected tab.
final bool active;
/// Receives the run id an accepted launch named; the shell opens that route.
final ValueChanged<int>? onRunStarted;
final ValueChanged<int>? onViewPipelineRuns;
@@ -96,6 +100,7 @@ class PipelinesDestination extends StatelessWidget {
: 'profile:${serverIdentity(session.gateway)}',
legacyEndpoints: legacyPendingEndpoints,
embedded: true,
active: active,
onRunStarted: onRunStarted,
onViewPipelineRuns: onViewPipelineRuns,
onOpenSchedules: onOpenSchedules,
+6 -1
View File
@@ -32,6 +32,7 @@ class PipelinesScreen extends StatefulWidget {
this.endpoint = '',
this.legacyEndpoints = const [],
this.embedded = false,
this.active = true,
this.syncToken = 0,
this.onRunStarted,
this.onViewPipelineRuns,
@@ -52,6 +53,10 @@ class PipelinesScreen extends StatefulWidget {
/// True under the application shell, which owns the single navigation bar.
final bool embedded;
/// Whether the Pipelines tab is currently visible. The screen stays mounted
/// to preserve tab state, but its pushed detail must not cover another tab.
final bool active;
/// Advances when the shared socket is replaced. The mounted controller
/// reloads the list and the selected detail without losing the selection.
final int syncToken;
@@ -238,7 +243,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
);
_page.sync(
context,
selected: _controller.hasSelection && !wide,
selected: widget.active && _controller.hasSelection && !wide,
destination: AppDestination.pipelines,
onClosed: _controller.clearSelection,
builder: (context) => AnimatedBuilder(
@@ -7,6 +7,7 @@ import '../../runs/data/runs_repository.dart';
import '../pipeline_models.dart';
import '../pipelines_controller.dart';
import '../run_pipeline_intent.dart';
import '../widgets/pipeline_bar_buttons.dart';
import '../widgets/pipeline_controls.dart';
import 'run_pipeline_dialog.dart';
import 'run_pipeline_wording.dart';
@@ -171,13 +172,12 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
Widget build(BuildContext context) {
final label = const Text(runPipelineActionLabel);
if (widget.inBar) {
return pipelineBarAction(
return pipelineBarIconButton(
context,
key: runPipelineActionKey,
primary: true,
materialIcon: Icons.play_arrow,
label: 'Run ${widget.detail.displayName}',
icon: Icons.play_arrow_rounded,
cupertinoIcon: CupertinoIcons.play_fill,
label: runPipelineActionLabel,
onPressed: _open,
);
}
@@ -195,58 +195,3 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
);
}
}
/// A pipeline action in its top bar's actions pill: the icon and word as one
/// compact button. The primary action (Run) is filled so it reads apart from
/// the plain ones around it.
Widget pipelineBarAction(
BuildContext context, {
required Key key,
required bool primary,
required IconData materialIcon,
required IconData cupertinoIcon,
required String label,
required VoidCallback? onPressed,
}) {
if (useCupertinoControls(context)) {
final content = Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(cupertinoIcon, size: 18),
const SizedBox(width: 6),
Flexible(child: Text(label, maxLines: 1, softWrap: false)),
],
);
const padding = EdgeInsets.symmetric(horizontal: 12, vertical: 6);
return primary
? CupertinoButton.filled(
key: key,
padding: padding,
minimumSize: Size.zero,
onPressed: onPressed,
child: content,
)
: CupertinoButton(
key: key,
padding: padding,
minimumSize: Size.zero,
onPressed: onPressed,
child: content,
);
}
final icon = Icon(materialIcon);
final text = Text(label, maxLines: 1, softWrap: false);
return primary
? FilledButton.icon(
key: key,
onPressed: onPressed,
icon: icon,
label: text,
)
: TextButton.icon(
key: key,
onPressed: onPressed,
icon: icon,
label: text,
);
}
@@ -14,23 +14,26 @@ Widget pipelineBarIconButton(
required IconData cupertinoIcon,
required VoidCallback? onPressed,
}) {
final Widget button;
if (useCupertinoControls(context)) {
return Semantics(
button: true,
label: label,
child: CupertinoButton(
key: key,
padding: EdgeInsets.zero,
onPressed: onPressed,
child: Icon(cupertinoIcon),
),
button = CupertinoButton(
key: key,
padding: EdgeInsets.zero,
onPressed: onPressed,
child: Icon(cupertinoIcon),
);
} else {
button = IconButton(
key: key,
tooltip: label,
onPressed: onPressed,
icon: Icon(icon),
);
}
return IconButton(
key: key,
tooltip: label,
onPressed: onPressed,
icon: Icon(icon),
return Semantics(
button: true,
label: label,
child: ExcludeSemantics(child: button),
);
}
@@ -15,6 +15,7 @@ import '../pipeline_query.dart';
import '../pipelines_controller.dart';
import '../ui/run_pipeline_action.dart';
import 'pipeline_controls.dart';
import 'pipeline_bar_buttons.dart';
import '../../../ui/text/markdown_source_view.dart';
import '../../../ui/motion/fade_through_stack.dart';
import 'pipeline_detail_styles.dart';
@@ -396,24 +397,17 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
/// Runs and the primary Run: the top bar's actions, never floating over
/// the content (where they used to cover the version history).
List<Widget> _actions(BuildContext context, PipelineDetail detail) => [
Semantics(
button: true,
pipelineBarIconButton(
context,
key: const Key('pipeline-view-runs'),
label: detail.name.trim().isEmpty
? 'View runs of this pipeline'
: 'View runs of ${detail.name}',
child: ExcludeSemantics(
child: pipelineBarAction(
context,
key: const Key('pipeline-view-runs'),
primary: false,
materialIcon: Icons.list_alt,
cupertinoIcon: CupertinoIcons.list_bullet,
label: 'Runs',
onPressed: widget.onViewPipelineRuns == null
? null
: () => widget.onViewPipelineRuns!(detail.id),
),
),
icon: Icons.list_alt_outlined,
cupertinoIcon: CupertinoIcons.list_bullet,
onPressed: widget.onViewPipelineRuns == null
? null
: () => widget.onViewPipelineRuns!(detail.id),
),
RunPipelineAction(
controller: _controller,