eb16a4caba
The route `/pipelines/:id[/:version]/stage/:key` now opens the pipeline detail's Graph tab with the named stage selected and its authored definition pane for the pinned version. A key the pinned definition does not declare opens the Graph tab with nothing selected and no pane; no key keeps the ordinary Summary tab. The request is scoped to the pipeline and version the URL names, consumed once the named pin's first reply is shown, and never replayed by a re-read, a later version switch or a different pipeline. A route change from a pin to latest re-reads latest, matching the web's requested-version rule.
88 lines
2.8 KiB
Dart
88 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../features/pipelines/screen.dart';
|
|
import '../ui/adaptive/host.dart';
|
|
import 'app_session.dart';
|
|
import 'connection_status.dart';
|
|
import 'server_endpoint.dart';
|
|
|
|
/// The Pipelines destination: the read-only browser plus honest status.
|
|
///
|
|
/// Before the shared socket accepts its first connection nothing is requested,
|
|
/// so an offline launch cannot look like an empty pipeline list. After that the
|
|
/// browser stays mounted through drops; a reconnect advances [syncToken] so the
|
|
/// list and the open detail refresh in place instead of losing the selection.
|
|
class PipelinesDestination extends StatelessWidget {
|
|
const PipelinesDestination({
|
|
super.key,
|
|
required this.session,
|
|
required this.server,
|
|
this.refreshToken = 0,
|
|
this.onRunStarted,
|
|
this.initialPipelineId,
|
|
this.initialVersion = 0,
|
|
this.initialStageKey,
|
|
});
|
|
|
|
final AppSession session;
|
|
final ServerEndpoint server;
|
|
|
|
/// Requests a fresh list/detail read without remounting the screen or losing
|
|
/// the open pipeline. The shell advances it when a template create was
|
|
/// accepted; the rows still come only from the server's next reply.
|
|
final int refreshToken;
|
|
|
|
/// Receives the run id an accepted launch named; the shell opens that route.
|
|
final ValueChanged<int>? onRunStarted;
|
|
|
|
/// The pipeline and pinned version a deep link names.
|
|
final int? initialPipelineId;
|
|
final int initialVersion;
|
|
|
|
/// The definition stage a deep link names, or null for no stage request.
|
|
final String? initialStageKey;
|
|
|
|
@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 _pipelinesScreen();
|
|
return ConnectionGate(
|
|
session: session,
|
|
server: server,
|
|
cupertino: cupertino,
|
|
);
|
|
}
|
|
return Column(
|
|
children: [
|
|
if (!session.connected)
|
|
ConnectionBanner(session: session, cupertino: cupertino),
|
|
Expanded(child: _pipelinesScreen()),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
|
|
Widget _pipelinesScreen() => PipelinesScreen(
|
|
gateway: session.gateway,
|
|
embedded: true,
|
|
onRunStarted: onRunStarted,
|
|
initialPipelineId: initialPipelineId,
|
|
initialVersion: initialVersion,
|
|
initialStageKey: initialStageKey,
|
|
// A reconnect or an accepted template create both advance this counter;
|
|
// either change re-reads through the mounted controller.
|
|
syncToken: session.connectionEpoch + refreshToken,
|
|
);
|
|
}
|