Files
pipelines/app/lib/application/runs_destination.dart
T
alan 8476cfd740 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.
2026-10-21 19:47:08 +01:00

71 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import '../features/runs/screen.dart';
import '../ui/adaptive/host.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
/// The Runs destination: the loaded screen plus an honest connection status.
///
/// Before the first successful connection there is nothing to show, so the
/// destination is a full connection screen. After that the screen stays
/// mounted through drops and reconnects: a status banner reports reconnecting
/// or not live, and the screen reloads in place without losing the open run.
class RunsDestination extends StatelessWidget {
const RunsDestination({
super.key,
required this.session,
required this.server,
this.initialRunId,
this.onRunSelected,
this.onBack,
});
final AppSession session;
final ServerEndpoint server;
final int? initialRunId;
final ValueChanged<int>? onRunSelected;
final VoidCallback? onBack;
@override
Widget build(BuildContext context) => AnimatedBuilder(
animation: session,
builder: (context, _) {
final cupertino = usesCupertinoHost(context);
if ((server.requiresConfiguration || server.error != null) &&
session.endpoint == null) {
return ConnectionGate(
session: session,
server: server,
cupertino: cupertino,
);
}
if (!session.everConnected) {
if (session.connected) return _runsScreen();
return ConnectionGate(
session: session,
server: server,
cupertino: cupertino,
);
}
return Column(
children: [
if (!session.connected ||
session.subscription == RunSubscriptionState.refused)
ConnectionBanner(session: session, cupertino: cupertino),
Expanded(child: _runsScreen()),
],
);
},
);
Widget _runsScreen() => RunsScreen(
gateway: session.gateway,
initialRunId: initialRunId,
syncToken: session.connectionEpoch,
onRunSelected: onRunSelected,
onBack: onBack,
);
}