feat(app): open pipeline and template deep links and route search results
This commit is contained in:
@@ -27,6 +27,8 @@ class PipelinesScreen extends StatefulWidget {
|
||||
this.embedded = false,
|
||||
this.syncToken = 0,
|
||||
this.onRunStarted,
|
||||
this.initialPipelineId,
|
||||
this.initialVersion = 0,
|
||||
});
|
||||
|
||||
final ApiGateway gateway;
|
||||
@@ -42,6 +44,12 @@ class PipelinesScreen extends StatefulWidget {
|
||||
/// the existing run route. The feature never navigates on its own.
|
||||
final ValueChanged<int>? onRunStarted;
|
||||
|
||||
/// The pipeline a deep link names, opened after the list read starts.
|
||||
final int? initialPipelineId;
|
||||
|
||||
/// The pinned version for [initialPipelineId]; 0 means latest.
|
||||
final int initialVersion;
|
||||
|
||||
@override
|
||||
State<PipelinesScreen> createState() => _PipelinesScreenState();
|
||||
}
|
||||
@@ -54,6 +62,11 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
super.initState();
|
||||
_controller = PipelinesController(PipelinesRepository(widget.gateway))
|
||||
..load();
|
||||
final id = widget.initialPipelineId;
|
||||
if (id != null) {
|
||||
// The detail read owns its own failure state; the list read continues.
|
||||
_controller.openPipeline(id, version: widget.initialVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -67,6 +80,14 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
// The socket was replaced; re-read through the existing controller so the
|
||||
// selected pipeline and requested version survive the reconnect.
|
||||
_controller.load();
|
||||
} else if (oldWidget.initialPipelineId != widget.initialPipelineId ||
|
||||
oldWidget.initialVersion != widget.initialVersion) {
|
||||
final id = widget.initialPipelineId;
|
||||
if (id != null) {
|
||||
_controller.openPipeline(id, version: widget.initialVersion);
|
||||
} else {
|
||||
_controller.clearSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,16 @@ class TemplatesScreen extends StatefulWidget {
|
||||
required this.gateway,
|
||||
this.embedded = false,
|
||||
this.onCreated,
|
||||
this.initialKey,
|
||||
});
|
||||
|
||||
final ApiGateway gateway;
|
||||
final bool embedded;
|
||||
final ValueChanged<JsonMap>? onCreated;
|
||||
|
||||
/// The template detail a deep link names, or null for the gallery.
|
||||
final String? initialKey;
|
||||
|
||||
@override
|
||||
State<TemplatesScreen> createState() => _TemplatesScreenState();
|
||||
}
|
||||
@@ -72,12 +76,16 @@ class _TemplatesScreenState extends State<TemplatesScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedKey = widget.initialKey;
|
||||
unawaited(_load());
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(TemplatesScreen oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.initialKey != widget.initialKey) {
|
||||
_selectedKey = widget.initialKey;
|
||||
}
|
||||
if (oldWidget.gateway == widget.gateway) return;
|
||||
// A different gateway is a different server: never keep this one's rows or
|
||||
// selection while the replacement is read.
|
||||
|
||||
Reference in New Issue
Block a user