Skip to content

Commit 429be9b

Browse files
ranjeshjCopilotCopilotranjeshj
authored
Apply bkudiess tray UX PR stack (#780)
* feat(tray): consistent back-links across cross-page navigations Extended the existing 'Back to Connection' affordance (Sessions/Instances/ Permissions) to every cross-page link in the Hub so users always have a one-click return path. - Added Helpers/NavOriginLabels for nav-tag -> display-label mapping so destination pages can render 'Back to {origin}' dynamically. - Threaded originTag through 9 cross-page Navigate calls: About->Debug, Channels->Config (x2), Permissions->Voice, and Bindings/Cron/Usage/ Debug/Instances->Connection. - Added the inline back HyperlinkButton + Initialize-time wiring to ConfigPage, VoiceSettingsPage, DebugPage, and ConnectionPage matching the existing Sessions/Instances/Permissions pattern. - Updated AsyncListLoadingPageWiringTests to accept the originTag-bearing Navigate('connection', ...) signature. Co-authored-by: Copilot <[email protected]> * chore(tray): use catalog back icon Co-authored-by: Copilot <[email protected]> * fix(tray): resolve property resource labels Co-authored-by: Copilot <[email protected]> * refactor(tray): use native Frame back navigation instead of custom back links Replace the custom cross-page back affordances with a single native title-bar back button driven by the NavigationView ContentFrame's back stack. - Add a native back button in the Hub title bar wired to ContentFrame.GoBack(), enabled/disabled by CanGoBack (mirrors NavigationView's root behavior), plus an Alt+Left accelerator. The rail re-syncs its selection on Back/Forward. - Remove all custom origin-tracking infrastructure: NavOriginLabels helper, the 2-arg IAppCommands.Navigate/NavigateTo overloads, LastNavigationOrigin and pending-origin state on HubWindow, and the LocalizationHelper origin additions. - Remove the per-page "Back to {origin}" links (Config/Connection/Debug/Voice) and the "Back to Connection" links (Sessions/Instances/Permissions), along with their code-behind handlers and visibility logic. - Revert all 2-arg navigation call sites back to single-arg Navigate across 11 pages. - Clean up obsolete resw keys and add NavBackButton strings across all five locales (en, fr, nl, zh-cn, zh-tw). In-page form/detail close buttons (ConnectionPage "Add a gateway", DebugPage log detail) are intentionally kept — they are view-state toggles within a page, not Frame navigations. Addresses PR #521 review feedback to rely on native back navigation. Co-authored-by: Copilot <[email protected]> * Add OpenClaw Onboard settings card Add a dedicated "OpenClaw Onboard" card to the Local Gateway section of Companion Settings. Its "Open onboarding" button opens the hosted setup window and navigates straight to the gateway onboarding step, skipping WSL installation. - New ShowGatewayWizard app command hosts SetupWindow and calls NavigateToWizard() after initial content is ready. - Local Gateway setup card keeps its single "Open setup" button. - Localized header, description, and button across all 5 locales. - Extend AppRefactorContractTests to cover the direct onboarding entrypoint. Co-authored-by: Copilot <[email protected]> * Address review: guard active setup and fix onboarding header localization - Guard direct onboarding so it cannot interrupt an in-progress setup. ShowGatewayWizardAsync now goes through EnsureSetupWindowAsync, which reports whether a setup window was newly created. It only calls NavigateToWizard() for a freshly created window; an already-open setup window (which may be mid-install on ProgressPage, whose Unloaded handler cancels the running pipeline) is just brought to the front instead. - Register SettingsPage_OnboardWizard_Header.Text as an invariant resource key. "OpenClaw Onboard" is a product/feature name kept identical across locales (the card's description and button are translated), fixing the LocalizationValidationTests all-or-none failure. - Extend AppRefactorContractTests to assert the active-setup guard (EnsureSetupWindowAsync + the createdNew check) stays in place. Co-authored-by: Copilot <[email protected]> * Add Run gateway doctor action to Diagnostics page Add a "Run gateway doctor" action to the Diagnostics page (DebugPage). The card opens a terminal in the app-managed WSL gateway, runs `openclaw doctor`, and leaves an interactive shell open so the operator can read the report. - Shown only when the active gateway is an app-managed WSL distro (GatewayHostAccessPlan.CanControlWslGateway); hidden for SSH/remote/none. - Reuses the same launcher path as the Connection page's Open terminal (GatewayTerminalLauncher / GatewayHostAccessClassifier), opening a themed Windows Terminal tab with a direct wsl.exe fallback. - Keep-open uses `&& openclaw doctor || true && exec bash` (no `;`): Windows Terminal splits its command line on `;` even inside quotes, which caused 0x80070002. `|| true` absorbs doctor's frequent advisory non-zero exit so the shell always stays open. - Start() now uses UseShellExecute = !UsesWindowsTerminal so direct wsl/ssh launches get a visible console window. - Adds a Doctor glyph to FluentIconCatalog and resw keys across all 5 locales. Co-authored-by: Copilot <[email protected]> * Fix diagnostics page contract merge Co-authored-by: Copilot <[email protected]> * Address onboarding and navigation review findings Co-authored-by: Copilot <[email protected]> * Hide onboard card after gateway removal Co-authored-by: Copilot <[email protected]> * Translate gateway doctor diagnostics strings Co-authored-by: Copilot <[email protected]> * Allow invariant gateway section label Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: ranjeshj <ranjeshj@DESKTOP-D683G7P>
1 parent c791416 commit 429be9b

32 files changed

Lines changed: 840 additions & 218 deletions

‎src/OpenClaw.SetupEngine.UI/SetupWindow.xaml.cs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public sealed partial class SetupWindow : Window
2121
public event EventHandler? AdvancedSetupRequested;
2222
public event EventHandler<SetupCompletedEventArgs>? SetupCompleted;
2323
public bool IsClosed => _isClosed;
24+
public bool CanNavigateToWizard => !_isClosed && _setupLock is not null;
2425

2526
[DllImport("user32.dll")]
2627
private static extern uint GetDpiForWindow(IntPtr hwnd);
@@ -92,7 +93,20 @@ public SetupWindow(string? configPath = null)
9293

9394
public void NavigateToCapabilities() => RootFrame.Navigate(typeof(CapabilitiesPage), _config);
9495
public void NavigateToProgress() => RootFrame.Navigate(typeof(ProgressPage), _config);
95-
public void NavigateToWizard() => RootFrame.Navigate(typeof(WizardPage), _config);
96+
public bool TryNavigateToWizard()
97+
{
98+
if (!CanNavigateToWizard)
99+
return false;
100+
101+
RootFrame.Navigate(typeof(WizardPage), _config);
102+
return true;
103+
}
104+
105+
public void NavigateToWizard()
106+
{
107+
if (!TryNavigateToWizard())
108+
throw new InvalidOperationException("Setup window is not ready to navigate to the gateway wizard.");
109+
}
96110
public void NavigateToPermissions() => RootFrame.Navigate(typeof(PermissionsPage), _config);
97111
public void NavigateToComplete(bool success, TimeSpan elapsed, string? logPath, string? errorMessage = null)
98112
=> RootFrame.Navigate(typeof(CompletePage), new CompletePageArgs(success, elapsed, logPath, errorMessage));

‎src/OpenClaw.Tray.WinUI/App.xaml.cs‎

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,7 @@ private string BuildTrayTooltip() =>
26782678

26792679
#region Window Management
26802680

2681-
internal void ShowHub(string? navigateTo = null, bool activate = true, string? originTag = null)
2681+
internal void ShowHub(string? navigateTo = null, bool activate = true)
26822682
{
26832683
if (_hubWindow == null || _hubWindow.IsClosed)
26842684
{
@@ -2729,7 +2729,7 @@ internal void ShowHub(string? navigateTo = null, bool activate = true, string? o
27292729

27302730
if (navigateTo != null)
27312731
{
2732-
_hubWindow.NavigateTo(navigateTo, originTag);
2732+
_hubWindow.NavigateTo(navigateTo);
27332733
}
27342734
if (activate)
27352735
{
@@ -3017,17 +3017,22 @@ private void ShowActivityStream(string? filter = null)
30173017
}
30183018

30193019
private async Task ShowOnboardingAsync()
3020+
{
3021+
await EnsureSetupWindowAsync();
3022+
}
3023+
3024+
private async Task<(SetupWindow? Window, bool CreatedNew)> EnsureSetupWindowAsync()
30203025
{
30213026
if (_settings == null)
3022-
return;
3027+
return (null, false);
30233028

30243029
if (_setupWindow != null)
30253030
{
30263031
var existingSetupWindow = _setupWindow;
30273032
await existingSetupWindow.WaitForInitialContentReadyAsync();
30283033
if (ReferenceEquals(_setupWindow, existingSetupWindow) && !existingSetupWindow.IsClosed)
30293034
existingSetupWindow.BringToFrontForSetupLaunch();
3030-
return;
3035+
return (existingSetupWindow, false);
30313036
}
30323037

30333038
try
@@ -3047,10 +3052,37 @@ private async Task ShowOnboardingAsync()
30473052
setupWindow.BringToFrontForSetupLaunch();
30483053
Logger.Info("Opened tray-hosted setup window");
30493054
}
3055+
return (setupWindow, true);
30503056
}
30513057
catch (Exception ex)
30523058
{
30533059
Logger.Error($"Failed to open setup window: {ex}");
3060+
return (null, false);
3061+
}
3062+
}
3063+
3064+
private async Task ShowGatewayWizardAsync()
3065+
{
3066+
var (setupWindow, createdNew) = await EnsureSetupWindowAsync();
3067+
if (setupWindow == null)
3068+
return;
3069+
3070+
// Only steer a freshly created setup window to the gateway wizard. An
3071+
// already-open setup window may be mid-install on ProgressPage, whose
3072+
// Unloaded handler cancels the running setup pipeline — navigating it
3073+
// away would abort an in-progress install. In that case leave the
3074+
// existing window on its current page (already brought to the front).
3075+
if (!createdNew)
3076+
{
3077+
Logger.Info("Setup window already open; skipping direct gateway wizard navigation to avoid interrupting active setup");
3078+
return;
3079+
}
3080+
3081+
await setupWindow.WaitForInitialContentReadyAsync();
3082+
if (ReferenceEquals(_setupWindow, setupWindow) && !setupWindow.IsClosed)
3083+
{
3084+
if (!setupWindow.TryNavigateToWizard())
3085+
Logger.Warn("Setup window is not ready for direct gateway wizard navigation; leaving current setup page visible");
30543086
}
30553087
}
30563088

@@ -3242,7 +3274,6 @@ private void OpenDashboard(string? path = null)
32423274

32433275
void IAppCommands.OpenDashboard(string? path) => OpenDashboard(path);
32443276
void IAppCommands.Navigate(string pageTag) => ShowHub(pageTag);
3245-
void IAppCommands.Navigate(string pageTag, string? originTag) => ShowHub(pageTag, originTag: originTag);
32463277
void IAppCommands.Reconnect() => _ = _connectionManager?.ReconnectAsync();
32473278
void IAppCommands.Disconnect()
32483279
{
@@ -3253,6 +3284,7 @@ void IAppCommands.Disconnect()
32533284
void IAppCommands.ShowChat() => ShowChatWindow();
32543285
void IAppCommands.CheckForUpdates() => _ = _updateCoordinator!.CheckForUpdatesUserInitiatedAsync();
32553286
void IAppCommands.ShowOnboarding() => _ = ShowOnboardingAsync();
3287+
void IAppCommands.ShowGatewayWizard() => _ = ShowGatewayWizardAsync();
32563288
void IAppCommands.ShowConnectionStatus() => ShowConnectionStatusWindow();
32573289
void IAppCommands.NotifySettingsSaved() => OnSettingsSaved(this, EventArgs.Empty);
32583290

‎src/OpenClaw.Tray.WinUI/Helpers/FluentIconCatalog.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public static class FluentIconCatalog
9393
public const string Clear = "\uE74D"; // Delete — clear/reset a buffer
9494
public const string Develop = "\uE943"; // Code — engineering / explorations action
9595
public const string AgentEvents = "\uE81C"; // History — agent events feed
96+
public const string Doctor = "\uE95E"; // Health — "Run gateway doctor" health-check action
9697

9798
// ── Agents / Workspace surface ─────────────────────────────────
9899
// Workspace concept (per-agent file viewer). Reuses the Folder

‎src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
77
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
8+
xmlns:helpers="using:OpenClawTray.Helpers"
89
xmlns:local="using:OpenClawTray.Controls">
910

1011
<Grid Padding="24,20,24,16">
@@ -18,7 +19,8 @@
1819
</Grid.RowDefinitions>
1920

2021
<!-- Page header -->
21-
<Grid Grid.Row="0" ColumnSpacing="16">
22+
<StackPanel Grid.Row="0" Spacing="4">
23+
<Grid ColumnSpacing="16">
2224
<Grid.ColumnDefinitions>
2325
<ColumnDefinition Width="*"/>
2426
<ColumnDefinition Width="Auto"/>
@@ -45,6 +47,7 @@
4547
</StackPanel>
4648
</Button>
4749
</Grid>
50+
</StackPanel>
4851

4952
<StackPanel Grid.Row="1" Spacing="8">
5053
<InfoBar x:Name="ConnectionInfoBar"

‎src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using OpenClawTray.Controls;
99
using OpenClawTray.Helpers;
1010
using OpenClawTray.Services;
11+
using OpenClawTray.Windows;
1112
using System;
1213
using System.Collections.Generic;
1314
using System.ComponentModel;

‎src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,12 +1848,12 @@ private void OnInstallLocalWslGateway(object sender, RoutedEventArgs e)
18481848

18491849
// ─── Operator card navigation ────────────────────────────────────
18501850

1851-
private void OnOpenSessions(object sender, RoutedEventArgs e) => ((IAppCommands)CurrentApp).Navigate("sessions", "connection");
1852-
private void OnOpenInstances(object sender, RoutedEventArgs e) => ((IAppCommands)CurrentApp).Navigate("instances", "connection");
1851+
private void OnOpenSessions(object sender, RoutedEventArgs e) => ((IAppCommands)CurrentApp).Navigate("sessions");
1852+
private void OnOpenInstances(object sender, RoutedEventArgs e) => ((IAppCommands)CurrentApp).Navigate("instances");
18531853

18541854
// ─── Node card navigation ────────────────────────────────────────
18551855

1856-
private void OnOpenPermissions(object sender, RoutedEventArgs e) => ((IAppCommands)CurrentApp).Navigate("permissions", "connection");
1856+
private void OnOpenPermissions(object sender, RoutedEventArgs e) => ((IAppCommands)CurrentApp).Navigate("permissions");
18571857

18581858
private void OnCopyNodeApproveCommand(object sender, RoutedEventArgs e)
18591859
{

‎src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,32 @@
8585
</controls:InfoBar.Content>
8686
</controls:InfoBar>
8787

88+
<!-- Gateway — shown only when the active gateway is an
89+
app-managed WSL distro we can run commands in
90+
(CanControlWslGateway). Hidden for SSH/remote
91+
gateways. Visibility is driven from code-behind in
92+
UpdateGatewayDoctorCard(). -->
93+
<StackPanel x:Name="GatewayDoctorSection"
94+
Spacing="{StaticResource DiagSettingsCardSpacing}"
95+
Visibility="Collapsed">
96+
<TextBlock x:Uid="DiagnosticsPage_Section_Gateway"
97+
Text="Gateway"
98+
Style="{StaticResource DiagSectionHeaderTextBlockStyle}"/>
99+
100+
<toolkit:SettingsCard x:Uid="DiagnosticsPage_Card_Doctor"
101+
x:Name="GatewayDoctorCard"
102+
Header="Run gateway doctor"
103+
Description="Opens a terminal and runs openclaw doctor to check the local gateway for problems."
104+
IsClickEnabled="True"
105+
Click="OnRunGatewayDoctor"
106+
AutomationProperties.AutomationId="DiagnosticsRunGatewayDoctor">
107+
<toolkit:SettingsCard.HeaderIcon>
108+
<FontIcon Glyph="{x:Bind helpers:FluentIconCatalog.Doctor, Mode=OneTime}"
109+
FontFamily="{ThemeResource SymbolThemeFontFamily}"/>
110+
</toolkit:SettingsCard.HeaderIcon>
111+
</toolkit:SettingsCard>
112+
</StackPanel>
113+
88114
<!-- Share diagnostics with support -->
89115
<TextBlock x:Uid="DiagnosticsPage_Section_Share"
90116
Text="Share diagnostics with support"

‎src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml.cs‎

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public sealed partial class DebugPage : Page
4343
private AppState? _appState;
4444
private bool _suppressOverrideChange;
4545

46+
private IGatewayTerminalLauncher? _terminalLauncher;
47+
private GatewayHostAccessPlan _doctorAccessPlan = GatewayHostAccessPlan.None();
48+
49+
private IGatewayTerminalLauncher TerminalLauncher =>
50+
_terminalLauncher ??= new GatewayTerminalLauncher(new OpenClawTray.AppLogger());
51+
4652
private static readonly string LocalAppData = Path.Combine(
4753
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "OpenClawTray");
4854
private static readonly string LogPath = Path.Combine(LocalAppData, "openclaw-tray.log");
@@ -107,6 +113,7 @@ public void Initialize()
107113
// (per docs/DATA_FLOW_ARCHITECTURE.md reactive-by-default ethos).
108114
CurrentApp.SettingsChanged += OnSettingsChanged;
109115
UpdateStatusInfoBar();
116+
UpdateGatewayDoctorCard();
110117
LoadDeviceIdentity();
111118
LoadChatSurfaceOverrides();
112119
}
@@ -118,11 +125,16 @@ private void OnAppStateChanged(object? sender, PropertyChangedEventArgs e)
118125
case nameof(AppState.Status):
119126
case nameof(AppState.GatewaySelf):
120127
UpdateStatusInfoBar();
128+
UpdateGatewayDoctorCard();
121129
break;
122130
}
123131
}
124132

125-
private void OnSettingsChanged(object? sender, EventArgs e) => UpdateStatusInfoBar();
133+
private void OnSettingsChanged(object? sender, EventArgs e)
134+
{
135+
UpdateStatusInfoBar();
136+
UpdateGatewayDoctorCard();
137+
}
126138

127139
/// <summary>
128140
/// Reset detail-mode state when the user navigates to a different
@@ -179,6 +191,40 @@ private void UpdateStatusInfoBar()
179191
private void OnManageOnConnection(object sender, RoutedEventArgs e)
180192
=> ((IAppCommands)CurrentApp).Navigate("connection");
181193

194+
// ── Gateway doctor (app-managed WSL only) ────────────────────────
195+
196+
/// <summary>
197+
/// Show the "Run gateway doctor" card only when the active gateway is an
198+
/// app-managed WSL distro we can run commands in (CanControlWslGateway).
199+
/// SSH/remote gateways have no such control surface, so the section stays
200+
/// collapsed. Mirrors ConnectionPage's gateway-host gating.
201+
/// </summary>
202+
private void UpdateGatewayDoctorCard()
203+
{
204+
var activeRecord = CurrentApp.Registry?.GetActive();
205+
_doctorAccessPlan = GatewayHostAccessClassifier.Classify(activeRecord);
206+
GatewayDoctorSection.Visibility = _doctorAccessPlan.CanControlWslGateway
207+
? Visibility.Visible
208+
: Visibility.Collapsed;
209+
}
210+
211+
private void OnRunGatewayDoctor(object sender, RoutedEventArgs e)
212+
{
213+
if (!_doctorAccessPlan.CanControlWslGateway)
214+
{
215+
return;
216+
}
217+
218+
try
219+
{
220+
TerminalLauncher.OpenGatewayDoctor(_doctorAccessPlan);
221+
}
222+
catch (Exception ex)
223+
{
224+
OpenClawTray.Services.Logger.Warn($"[DebugPage] Failed to launch gateway doctor: {ex.Message}");
225+
}
226+
}
227+
182228
// ── Detail view (recent log) ─────────────────────────────────────
183229

184230
private void OnOpenEventTimeline(object sender, RoutedEventArgs e)

‎src/OpenClaw.Tray.WinUI/Pages/InstancesPage.xaml‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@
66
<Grid HorizontalAlignment="Stretch">
77
<StackPanel Padding="24" Spacing="16" HorizontalAlignment="Stretch" MaxWidth="900">
88

9-
<!-- Inline back link — only shown when the user arrived via a
10-
cross-page link from Connection. Set by InstancesPage.Initialize
11-
based on HubWindow.LastNavigationOrigin. -->
12-
<HyperlinkButton x:Name="BackToConnectionLink"
13-
Click="OnBackToConnectionClicked"
14-
Padding="0" Margin="0,0,0,-8"
15-
Visibility="Collapsed"
16-
AutomationProperties.AutomationId="BackToConnectionLink">
17-
<StackPanel Orientation="Horizontal" Spacing="6">
18-
<FontIcon Glyph="&#xE72B;" FontSize="12"/>
19-
<TextBlock x:Uid="InstancesPage_BackToConnectionText" Text="Back to Connection"/>
20-
</StackPanel>
21-
</HyperlinkButton>
22-
239
<Grid>
2410
<Grid.ColumnDefinitions>
2511
<ColumnDefinition Width="*"/>

‎src/OpenClaw.Tray.WinUI/Pages/InstancesPage.xaml.cs‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ public InstancesPage()
4141
/// <summary>Called by HubWindow when this page becomes the navigation target.</summary>
4242
public void Initialize()
4343
{
44-
// Show "← Back to Connection" only when the user arrived from
45-
// Connection's cross-page link; staying hidden when the rail nav
46-
// is used keeps the page chrome quiet for direct navigation.
47-
var hub = CurrentApp.ActiveHubWindow as HubWindow;
48-
BackToConnectionLink.Visibility = hub?.LastNavigationOrigin == "connection"
49-
? Visibility.Visible
50-
: Visibility.Collapsed;
51-
5244
if (_appState != null) _appState.PropertyChanged -= OnAppStateChanged;
5345
_appState = CurrentApp.AppState!;
5446
_appState.PropertyChanged += OnAppStateChanged;
@@ -71,9 +63,6 @@ public void Initialize()
7163
}
7264
}
7365

74-
private void OnBackToConnectionClicked(object sender, RoutedEventArgs e)
75-
=> ((IAppCommands)CurrentApp).Navigate("connection");
76-
7766
private void OnAppStateChanged(object? sender, PropertyChangedEventArgs e)
7867
{
7968
switch (e.PropertyName)

0 commit comments

Comments
 (0)