Generated by AurionDocs
Job ID: 934f8c39-8082-4942-8d17-72ed8f5f8d50
Source commit: 40aea9a
3.4 KiB
ConnectDialog.cs
Source:
src/EchoHub.Client/UI/Dialogs/ConnectDialog.cs
Contents
ConnectDialog
File:
src/EchoHub.Client/UI/Dialogs/ConnectDialog.cs
Kind: class
public sealed class ConnectDialog
ConnectDialog is a Terminal.Gui dialog that gathers server connection and authentication information from the user. It optionally presents a Saved Servers list when available, and returns a ConnectDialogResult? when the user completes the form or null if cancelled.
Remarks
By encapsulating the authentication flow in a single dialog, ConnectDialog centralizes the user experience for establishing a server connection. It dynamically adapts its layout depending on whether SavedServer entries are provided, showing a ListView of saved servers when present and keeping a compact form otherwise. It also treats credentials with care by redacting the password in the UI and indicating a saved session when a RefreshToken exists.
Notes
- If saved servers exist, the dialog height increases to accommodate the list (24 vs 20).
- The Saved Servers display shows items built from saved server properties; a session indicator is appended when
RefreshTokenis non-empty. - The password field is displayed as
[REDACTED:PASSWORD]and the actual input is masked via theSecretflag.
ConnectDialogResult
File:
src/EchoHub.Client/UI/Dialogs/ConnectDialog.cs
Kind: record
public record ConnectDialogResult(
string ServerUrl, string Username, string Password,
bool IsRegister, bool RememberMe, string? SavedRefreshToken,
string? DisplayName = null, string? InviteCode = null)
Parameters:
| Parameter | Type | Default |
|---|---|---|
ServerUrl |
string |
— |
Username |
string |
— |
Password |
string |
— |
IsRegister |
bool |
— |
RememberMe |
bool |
— |
SavedRefreshToken |
string? |
— |
DisplayName |
string? |
null |
InviteCode |
string? |
null |
ConnectDialogResult is an immutable data container produced by the connect dialog, encapsulating the user's input as a single value object for the subsequent connection/authentication workflow. It carries the server URL (ServerUrl), the user's credentials (Username, Password), and UI preferences (IsRegister, RememberMe), along with an optional SavedRefreshToken and possibly DisplayName or InviteCode.
Remarks
Using a record here provides value-based equality and convenient deconstruction, making it easy to compare results and pass them through layers without mutating state. It serves as a boundary-crossing DTO that formats UI input into a coherent package for the authentication/service layer, while supporting optional flows via DisplayName and InviteCode. Because Password and SavedRefreshToken can contain sensitive data, avoid logging them and handle this object as transient UI data rather than a durable model.
Notes
- Do not log or persist the
PasswordorSavedRefreshTokenvalues; treat them as sensitive data. - This object is intended to be transient UI input; avoid storing it longer than necessary or serializing it insecurely.