WIP: pipeline page Runs/Run icon actions (run #230)
This commit is contained in:
@@ -497,6 +497,7 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
AppDestination.pipelines: (_) => PipelinesDestination(
|
AppDestination.pipelines: (_) => PipelinesDestination(
|
||||||
session: _session,
|
session: _session,
|
||||||
server: widget.server,
|
server: widget.server,
|
||||||
|
active: _destinationOf(route.kind) == AppDestination.pipelines,
|
||||||
legacyPendingEndpoints: widget.legacyPendingEndpoints,
|
legacyPendingEndpoints: widget.legacyPendingEndpoints,
|
||||||
refreshToken: _pipelinesRefresh,
|
refreshToken: _pipelinesRefresh,
|
||||||
onRunStarted: _runStarted,
|
onRunStarted: _runStarted,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
required this.session,
|
required this.session,
|
||||||
required this.server,
|
required this.server,
|
||||||
this.refreshToken = 0,
|
this.refreshToken = 0,
|
||||||
|
this.active = true,
|
||||||
this.onRunStarted,
|
this.onRunStarted,
|
||||||
this.onViewPipelineRuns,
|
this.onViewPipelineRuns,
|
||||||
this.onOpenSchedules,
|
this.onOpenSchedules,
|
||||||
@@ -39,6 +40,9 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
/// accepted; the rows still come only from the server's next reply.
|
/// accepted; the rows still come only from the server's next reply.
|
||||||
final int refreshToken;
|
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.
|
/// 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;
|
||||||
@@ -96,6 +100,7 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
: 'profile:${serverIdentity(session.gateway)}',
|
: 'profile:${serverIdentity(session.gateway)}',
|
||||||
legacyEndpoints: legacyPendingEndpoints,
|
legacyEndpoints: legacyPendingEndpoints,
|
||||||
embedded: true,
|
embedded: true,
|
||||||
|
active: active,
|
||||||
onRunStarted: onRunStarted,
|
onRunStarted: onRunStarted,
|
||||||
onViewPipelineRuns: onViewPipelineRuns,
|
onViewPipelineRuns: onViewPipelineRuns,
|
||||||
onOpenSchedules: onOpenSchedules,
|
onOpenSchedules: onOpenSchedules,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class PipelinesScreen extends StatefulWidget {
|
|||||||
this.endpoint = '',
|
this.endpoint = '',
|
||||||
this.legacyEndpoints = const [],
|
this.legacyEndpoints = const [],
|
||||||
this.embedded = false,
|
this.embedded = false,
|
||||||
|
this.active = true,
|
||||||
this.syncToken = 0,
|
this.syncToken = 0,
|
||||||
this.onRunStarted,
|
this.onRunStarted,
|
||||||
this.onViewPipelineRuns,
|
this.onViewPipelineRuns,
|
||||||
@@ -52,6 +53,10 @@ class PipelinesScreen extends StatefulWidget {
|
|||||||
/// True under the application shell, which owns the single navigation bar.
|
/// True under the application shell, which owns the single navigation bar.
|
||||||
final bool embedded;
|
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
|
/// Advances when the shared socket is replaced. The mounted controller
|
||||||
/// reloads the list and the selected detail without losing the selection.
|
/// reloads the list and the selected detail without losing the selection.
|
||||||
final int syncToken;
|
final int syncToken;
|
||||||
@@ -238,7 +243,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
|||||||
);
|
);
|
||||||
_page.sync(
|
_page.sync(
|
||||||
context,
|
context,
|
||||||
selected: _controller.hasSelection && !wide,
|
selected: widget.active && _controller.hasSelection && !wide,
|
||||||
destination: AppDestination.pipelines,
|
destination: AppDestination.pipelines,
|
||||||
onClosed: _controller.clearSelection,
|
onClosed: _controller.clearSelection,
|
||||||
builder: (context) => AnimatedBuilder(
|
builder: (context) => AnimatedBuilder(
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import '../../runs/data/runs_repository.dart';
|
|||||||
import '../pipeline_models.dart';
|
import '../pipeline_models.dart';
|
||||||
import '../pipelines_controller.dart';
|
import '../pipelines_controller.dart';
|
||||||
import '../run_pipeline_intent.dart';
|
import '../run_pipeline_intent.dart';
|
||||||
|
import '../widgets/pipeline_bar_buttons.dart';
|
||||||
import '../widgets/pipeline_controls.dart';
|
import '../widgets/pipeline_controls.dart';
|
||||||
import 'run_pipeline_dialog.dart';
|
import 'run_pipeline_dialog.dart';
|
||||||
import 'run_pipeline_wording.dart';
|
import 'run_pipeline_wording.dart';
|
||||||
@@ -171,13 +172,12 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final label = const Text(runPipelineActionLabel);
|
final label = const Text(runPipelineActionLabel);
|
||||||
if (widget.inBar) {
|
if (widget.inBar) {
|
||||||
return pipelineBarAction(
|
return pipelineBarIconButton(
|
||||||
context,
|
context,
|
||||||
key: runPipelineActionKey,
|
key: runPipelineActionKey,
|
||||||
primary: true,
|
label: 'Run ${widget.detail.displayName}',
|
||||||
materialIcon: Icons.play_arrow,
|
icon: Icons.play_arrow_rounded,
|
||||||
cupertinoIcon: CupertinoIcons.play_fill,
|
cupertinoIcon: CupertinoIcons.play_fill,
|
||||||
label: runPipelineActionLabel,
|
|
||||||
onPressed: _open,
|
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 IconData cupertinoIcon,
|
||||||
required VoidCallback? onPressed,
|
required VoidCallback? onPressed,
|
||||||
}) {
|
}) {
|
||||||
|
final Widget button;
|
||||||
if (useCupertinoControls(context)) {
|
if (useCupertinoControls(context)) {
|
||||||
return Semantics(
|
button = CupertinoButton(
|
||||||
button: true,
|
key: key,
|
||||||
label: label,
|
padding: EdgeInsets.zero,
|
||||||
child: CupertinoButton(
|
onPressed: onPressed,
|
||||||
key: key,
|
child: Icon(cupertinoIcon),
|
||||||
padding: EdgeInsets.zero,
|
);
|
||||||
onPressed: onPressed,
|
} else {
|
||||||
child: Icon(cupertinoIcon),
|
button = IconButton(
|
||||||
),
|
key: key,
|
||||||
|
tooltip: label,
|
||||||
|
onPressed: onPressed,
|
||||||
|
icon: Icon(icon),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return IconButton(
|
return Semantics(
|
||||||
key: key,
|
button: true,
|
||||||
tooltip: label,
|
label: label,
|
||||||
onPressed: onPressed,
|
child: ExcludeSemantics(child: button),
|
||||||
icon: Icon(icon),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import '../pipeline_query.dart';
|
|||||||
import '../pipelines_controller.dart';
|
import '../pipelines_controller.dart';
|
||||||
import '../ui/run_pipeline_action.dart';
|
import '../ui/run_pipeline_action.dart';
|
||||||
import 'pipeline_controls.dart';
|
import 'pipeline_controls.dart';
|
||||||
|
import 'pipeline_bar_buttons.dart';
|
||||||
import '../../../ui/text/markdown_source_view.dart';
|
import '../../../ui/text/markdown_source_view.dart';
|
||||||
import '../../../ui/motion/fade_through_stack.dart';
|
import '../../../ui/motion/fade_through_stack.dart';
|
||||||
import 'pipeline_detail_styles.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
|
/// Runs and the primary Run: the top bar's actions, never floating over
|
||||||
/// the content (where they used to cover the version history).
|
/// the content (where they used to cover the version history).
|
||||||
List<Widget> _actions(BuildContext context, PipelineDetail detail) => [
|
List<Widget> _actions(BuildContext context, PipelineDetail detail) => [
|
||||||
Semantics(
|
pipelineBarIconButton(
|
||||||
button: true,
|
context,
|
||||||
|
key: const Key('pipeline-view-runs'),
|
||||||
label: detail.name.trim().isEmpty
|
label: detail.name.trim().isEmpty
|
||||||
? 'View runs of this pipeline'
|
? 'View runs of this pipeline'
|
||||||
: 'View runs of ${detail.name}',
|
: 'View runs of ${detail.name}',
|
||||||
child: ExcludeSemantics(
|
icon: Icons.list_alt_outlined,
|
||||||
child: pipelineBarAction(
|
cupertinoIcon: CupertinoIcons.list_bullet,
|
||||||
context,
|
onPressed: widget.onViewPipelineRuns == null
|
||||||
key: const Key('pipeline-view-runs'),
|
? null
|
||||||
primary: false,
|
: () => widget.onViewPipelineRuns!(detail.id),
|
||||||
materialIcon: Icons.list_alt,
|
|
||||||
cupertinoIcon: CupertinoIcons.list_bullet,
|
|
||||||
label: 'Runs',
|
|
||||||
onPressed: widget.onViewPipelineRuns == null
|
|
||||||
? null
|
|
||||||
: () => widget.onViewPipelineRuns!(detail.id),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
RunPipelineAction(
|
RunPipelineAction(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
|
|||||||
Reference in New Issue
Block a user