feat(app): wire the native pipelines browser on the shared session
Register the landed PipelinesScreen at /pipelines through AppSession, with an honest first-connection gate, a native reconnect banner that retains the open list and detail, and an in-place refresh on reconnect. Move the shared connection chrome out of RunsDestination so both destinations use one implementation and one wording. Add destination, registration and reconnect coverage plus an isolated loopback Chrome probe that drives the real runPipelinesApp() composition.
This commit is contained in:
@@ -21,18 +21,31 @@ const double kPipelinesWideBreakpoint = 720;
|
||||
///
|
||||
/// [graphBuilder] is the optional integration hook for the later graph item.
|
||||
/// Without it the Graph tab states that graph rendering is pending.
|
||||
///
|
||||
/// Standalone use keeps the screen's own native scaffolding. The application
|
||||
/// shell sets [embedded] because it already owns the one navigation bar, and
|
||||
/// supplies [syncToken] so a reconnect refreshes in place.
|
||||
class PipelinesScreen extends StatefulWidget {
|
||||
const PipelinesScreen({
|
||||
super.key,
|
||||
required this.gateway,
|
||||
this.graphBuilder,
|
||||
this.onStageSelected,
|
||||
this.embedded = false,
|
||||
this.syncToken = 0,
|
||||
});
|
||||
|
||||
final ApiGateway gateway;
|
||||
final PipelineGraphBuilder? graphBuilder;
|
||||
final ValueChanged<PipelineStageRef>? onStageSelected;
|
||||
|
||||
/// True under the application shell, which owns the single navigation bar.
|
||||
final bool embedded;
|
||||
|
||||
/// Advances when the shared socket is replaced. The mounted controller
|
||||
/// reloads the list and the selected detail without losing the selection.
|
||||
final int syncToken;
|
||||
|
||||
@override
|
||||
State<PipelinesScreen> createState() => _PipelinesScreenState();
|
||||
}
|
||||
@@ -54,6 +67,10 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
_controller.dispose();
|
||||
_controller = PipelinesController(PipelinesRepository(widget.gateway))
|
||||
..load();
|
||||
} else if (oldWidget.syncToken != widget.syncToken) {
|
||||
// The socket was replaced; re-read through the existing controller so the
|
||||
// selected pipeline and requested version survive the reconnect.
|
||||
_controller.load();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +119,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
if (widget.embedded) return _embeddedBody(context, body);
|
||||
return useCupertinoControls(context)
|
||||
? _cupertinoShell(context, body)
|
||||
: _materialShell(context, body);
|
||||
@@ -109,6 +127,43 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
/// The shell owns the navigation bar here, so the content keeps a native
|
||||
/// Refresh action without adding a second bar.
|
||||
Widget _embeddedBody(BuildContext context, Widget body) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: _refreshButton(context),
|
||||
),
|
||||
),
|
||||
Expanded(child: body),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _refreshButton(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: 'Refresh',
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: _controller.load,
|
||||
child: const Icon(CupertinoIcons.refresh),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
tooltip: 'Refresh',
|
||||
onPressed: _controller.load,
|
||||
icon: const Icon(Icons.refresh),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _divider(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return Container(
|
||||
@@ -123,13 +178,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Pipelines'),
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: 'Refresh',
|
||||
onPressed: _controller.load,
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
],
|
||||
actions: [_refreshButton(context)],
|
||||
),
|
||||
body: SafeArea(child: body),
|
||||
);
|
||||
@@ -139,15 +188,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: const Text('Pipelines'),
|
||||
trailing: Semantics(
|
||||
button: true,
|
||||
label: 'Refresh',
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: _controller.load,
|
||||
child: const Icon(CupertinoIcons.refresh),
|
||||
),
|
||||
),
|
||||
trailing: _refreshButton(context),
|
||||
),
|
||||
child: SafeArea(top: false, child: body),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user