Adds a new wizard page (positioned right after Welcome, FreshInstall only) that auto-runs EnvironmentCheckService on entry and shows one row per check with status icon, localized title/message, and hint+help-link on failure/unknown. A "Recheck" button re-runs it, guarded against re-entrancy. IInstallerPage gets a BlocksNavigation default member; WizardViewModel's Next button now binds to CanGoNext, which the current page can veto (used here while a check run is in flight or a blocking Error+Failed result is present — Warnings and Unknown results never block). The summary line names the blocking checks so a disabled Next is self-explanatory. Wires up DI for the check pipeline (IProcessRunner, IPortOwnerResolver, per-run ClaudeCliLookup) and adds the checks.* / installer.systemCheck.* locale keys in en.json + de.json. Visual appearance is NOT verified — needs a manual pass in the running installer.
85 lines
2.3 KiB
C#
85 lines
2.3 KiB
C#
using System.Windows.Controls;
|
|
using ClaudeDo.Installer.Core;
|
|
using ClaudeDo.Installer.Localization;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
namespace ClaudeDo.Installer.Pages.UiSettingsPage;
|
|
|
|
public partial class UiSettingsPageViewModel : ObservableObject, IInstallerPage
|
|
{
|
|
private readonly InstallContext _context;
|
|
private UiSettingsPageView? _view;
|
|
|
|
public string Title => TrExtension.Localizer?["installer.uiSettings.title"] ?? "UI Settings";
|
|
public string Icon => "\uE771";
|
|
public int Order => 4;
|
|
public bool ShowInWizard => true;
|
|
public bool ShowInSettings => true;
|
|
public UserControl View => _view ??= new UiSettingsPageView { DataContext = this };
|
|
|
|
[ObservableProperty] private string _signalRUrl = "http://127.0.0.1:47821/hub";
|
|
[ObservableProperty] private string _uiDbPath = "~/.todo-app/todo.db";
|
|
[ObservableProperty] private bool _isSynced = true;
|
|
[ObservableProperty] private string? _validationError;
|
|
|
|
public UiSettingsPageViewModel(InstallContext context) => _context = context;
|
|
|
|
partial void OnIsSyncedChanged(bool value)
|
|
{
|
|
if (value) SyncFromContext();
|
|
}
|
|
|
|
private void SyncFromContext()
|
|
{
|
|
SignalRUrl = $"http://127.0.0.1:{_context.SignalRPort}/hub";
|
|
UiDbPath = _context.DbPath;
|
|
}
|
|
|
|
public Task LoadAsync()
|
|
{
|
|
if (IsSynced)
|
|
{
|
|
SyncFromContext();
|
|
}
|
|
else
|
|
{
|
|
var cfg = InstallerAppSettings.Load();
|
|
SignalRUrl = cfg.SignalRUrl;
|
|
UiDbPath = cfg.DbPath;
|
|
}
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task ApplyAsync()
|
|
{
|
|
if (IsSynced) SyncFromContext();
|
|
_context.SignalRUrl = SignalRUrl;
|
|
_context.UiDbPath = UiDbPath;
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public bool Validate()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(SignalRUrl))
|
|
{
|
|
ValidationError = "SignalR URL is required.";
|
|
return false;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(UiDbPath))
|
|
{
|
|
ValidationError = "Database path is required.";
|
|
return false;
|
|
}
|
|
|
|
if (!Uri.TryCreate(SignalRUrl, UriKind.Absolute, out _))
|
|
{
|
|
ValidationError = "SignalR URL must be a valid URL.";
|
|
return false;
|
|
}
|
|
|
|
ValidationError = null;
|
|
return true;
|
|
}
|
|
}
|