Make Settings a first-class destination
Keep Settings location, selection, history, and persistence separate from Pipelines so /settings restores and navigates independently. Update focused navigation coverage and defer notification loading to avoid a mid-build Runs-tab update.
This commit is contained in:
@@ -657,15 +657,15 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
setState(() => _pendingRunSearch = null);
|
||||
}
|
||||
|
||||
/// The last location within each tab, including Settings under Pipelines.
|
||||
/// Explicit Back is separate from tab selection and same-tab retaps.
|
||||
/// The last location within each destination, Settings included. Explicit
|
||||
/// Back is separate from destination selection and same-destination retaps.
|
||||
String get _navigationScope =>
|
||||
widget.serverId ?? widget.server.uri?.toString() ?? '';
|
||||
|
||||
late final TabLocations _tabLocations;
|
||||
Map<AppDestination, AppRoute> get _tabRoutes => _tabLocations.routes;
|
||||
// A Settings visit owns the Pipelines tab's return location, but must not
|
||||
// clear the still-mounted Pipelines body's selection or editor underneath.
|
||||
// The last route each destination's body showed. A Settings visit records
|
||||
// only Settings here, so the still-mounted Pipelines selection stays intact.
|
||||
final _bodyRoutes = <AppDestination, AppRoute>{};
|
||||
|
||||
void _rememberBodyRoute(AppRoute route) {
|
||||
@@ -741,7 +741,12 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
return;
|
||||
}
|
||||
}
|
||||
_tabLocations.record(shown);
|
||||
// Templates and Schedules are transient Settings sub-pages. Remember the
|
||||
// Settings route under them, so selecting Settings later opens /settings
|
||||
// rather than reopening the sub-page.
|
||||
final subPage = shown.kind == AppRouteKind.templates ||
|
||||
shown.kind == AppRouteKind.schedules;
|
||||
_tabLocations.record(subPage ? _delegate.shellRoute : shown);
|
||||
_rememberBodyRoute(_delegate.shellRoute);
|
||||
_rememberChatRoute(shown);
|
||||
final pending = _pendingRunSearch;
|
||||
@@ -857,9 +862,6 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
onDestinationSelected: _selectDestination,
|
||||
onDestinationReselected: _reselectDestination,
|
||||
onOpenChat: _focusOpenChatComposer,
|
||||
onClosePage: () => _delegate.goTo(
|
||||
_bodyRoutes[AppDestination.pipelines] ?? AppRoute.pipelines,
|
||||
),
|
||||
destinationBodies: {
|
||||
AppDestination.pipelines: (_) => FirstRunWalkthroughGate(
|
||||
store: _walkthroughStore,
|
||||
@@ -948,8 +950,8 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
onOpen: _openSearchResult,
|
||||
embedded: true,
|
||||
),
|
||||
// Settings is a page of the Pipelines tab (its bar's gear), not a
|
||||
// tab; the shell shows it with Back to Pipelines.
|
||||
// Settings is a destination of its own; the shell selects it alone and
|
||||
// its Back returns to the destination opened before it.
|
||||
AppDestination.settings: (context) => SettingsScreen(
|
||||
terminalLayout: _terminals.layout,
|
||||
client: _session.client,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import '../shell/destination.dart';
|
||||
import 'app_route.dart';
|
||||
|
||||
/// Settings and its pages occupy the Pipelines tab, not an independent tab.
|
||||
/// The destination that owns [route]. Settings and its sub-pages (Templates,
|
||||
/// Schedules) belong to Settings itself, never to Pipelines.
|
||||
AppDestination tabForRoute(AppRoute route) => switch (route.kind) {
|
||||
AppRouteKind.pipelines ||
|
||||
AppRouteKind.pipelines => AppDestination.pipelines,
|
||||
AppRouteKind.settings ||
|
||||
AppRouteKind.templates ||
|
||||
AppRouteKind.schedules => AppDestination.pipelines,
|
||||
AppRouteKind.schedules => AppDestination.settings,
|
||||
AppRouteKind.runs => AppDestination.runs,
|
||||
AppRouteKind.chat => AppDestination.chat,
|
||||
AppRouteKind.search => AppDestination.search,
|
||||
|
||||
@@ -32,17 +32,22 @@ class TabLocationsSnapshot {
|
||||
}
|
||||
final routes = <AppDestination, AppRoute>{};
|
||||
for (final entry in (data['routes'] as Map).entries) {
|
||||
final tab = shellTabDestinations
|
||||
final tab = AppDestination.values
|
||||
.where((tab) => tab.name == entry.key)
|
||||
.firstOrNull;
|
||||
final path = entry.value;
|
||||
if (tab == null || path is! String || !path.startsWith('/')) continue;
|
||||
final route = AppRoute.parse(path);
|
||||
if (route.path != path || tabForRoute(route) != tab) continue;
|
||||
// Templates and Schedules are transient sub-pages, never a saved place.
|
||||
if (route.kind == AppRouteKind.templates ||
|
||||
route.kind == AppRouteKind.schedules) {
|
||||
continue;
|
||||
}
|
||||
routes[tab] = durableTabRoute(route);
|
||||
}
|
||||
final active =
|
||||
shellTabDestinations
|
||||
AppDestination.values
|
||||
.where((tab) => tab.name == data['active'])
|
||||
.firstOrNull ??
|
||||
AppDestination.pipelines;
|
||||
|
||||
Reference in New Issue
Block a user