Add live TLS certificate probing and improve restart error handling.
Configure CertificateCheckUrl per container for curl-like TLS checks, classify Sonic permission errors, and extend setup wizard for container management. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -36,6 +36,7 @@ public sealed class SetupWizardForm : Form
|
||||
private Button _btnSaveSelection = null!;
|
||||
private Button _btnFinish = null!;
|
||||
private Button _btnAddCredential = null!;
|
||||
private Button _btnEditCredential = null!;
|
||||
|
||||
private IReadOnlyList<SonicSystemOption> _systems = [];
|
||||
private IReadOnlyList<SonicCredentialProfile> _profiles = [];
|
||||
@@ -385,11 +386,12 @@ public sealed class SetupWizardForm : Form
|
||||
|
||||
_lvContainers = SettingsUi.CreateListView();
|
||||
_lvContainers.Dock = DockStyle.Fill;
|
||||
_lvContainers.Columns.Add("Company", 80);
|
||||
_lvContainers.Columns.Add("Container", 180);
|
||||
_lvContainers.Columns.Add("Anzeige", 160);
|
||||
_lvContainers.Columns.Add("System", 160);
|
||||
_lvContainers.Columns.Add("Timeout", 90);
|
||||
_lvContainers.Columns.Add("Company", 70);
|
||||
_lvContainers.Columns.Add("Container", 150);
|
||||
_lvContainers.Columns.Add("Anzeige", 120);
|
||||
_lvContainers.Columns.Add("System", 120);
|
||||
_lvContainers.Columns.Add("Prüf-URL", 180);
|
||||
_lvContainers.Columns.Add("Timeout", 80);
|
||||
_lvContainers.DoubleClick += async (_, _) => await EditSelectedContainerAsync();
|
||||
|
||||
FinishPanelLayout(_panelContainers, _lvContainers, toolbar);
|
||||
@@ -484,6 +486,12 @@ public sealed class SetupWizardForm : Form
|
||||
_btnAddCredential.Click += async (_, _) =>
|
||||
await AddCredentialAsync();
|
||||
|
||||
_btnEditCredential = SettingsUi.CreateGhostButton("Profil bearbeiten");
|
||||
_btnEditCredential.Location = new Point(550, 122);
|
||||
_btnEditCredential.Size = new Size(160, 34);
|
||||
_btnEditCredential.Click += async (_, _) =>
|
||||
await EditCredentialAsync();
|
||||
|
||||
_lblSystemDetails = new Label
|
||||
{
|
||||
Location = new Point(24, 180),
|
||||
@@ -502,6 +510,7 @@ public sealed class SetupWizardForm : Form
|
||||
card.Controls.Add(credentialLabel);
|
||||
card.Controls.Add(_cmbCredential);
|
||||
card.Controls.Add(_btnAddCredential);
|
||||
card.Controls.Add(_btnEditCredential);
|
||||
card.Controls.Add(_lblSystemDetails);
|
||||
card.Controls.Add(_btnSaveSelection);
|
||||
|
||||
@@ -625,6 +634,10 @@ public sealed class SetupWizardForm : Form
|
||||
item.SubItems.Add(container.ContainerName);
|
||||
item.SubItems.Add(container.ContainerDisplayName ?? "—");
|
||||
item.SubItems.Add(container.ConnectionName);
|
||||
item.SubItems.Add(
|
||||
string.IsNullOrWhiteSpace(container.CertificateCheckUrl)
|
||||
? "—"
|
||||
: container.CertificateCheckUrl);
|
||||
item.SubItems.Add(container.RestartTimeoutSeconds + " s");
|
||||
item.Tag = container;
|
||||
_lvContainers.Items.Add(item);
|
||||
@@ -722,7 +735,12 @@ public sealed class SetupWizardForm : Form
|
||||
return "Kennwort nötig";
|
||||
}
|
||||
|
||||
return result.Success ? "fehlt" : "n/a";
|
||||
if (result.AccessDenied)
|
||||
{
|
||||
return CertificateProbeResult.AccessDeniedShortText;
|
||||
}
|
||||
|
||||
return result.Success ? "fehlt" : "nicht erreichbar";
|
||||
}
|
||||
|
||||
private static string? PromptCertificatePassword(IWin32Window owner)
|
||||
@@ -1228,19 +1246,9 @@ public sealed class SetupWizardForm : Form
|
||||
}
|
||||
|
||||
await SystemChangedAsync();
|
||||
SelectCredential(dialog.CreatedProfile.SonicCredentialId);
|
||||
|
||||
for (int index = 0; index < _cmbCredential.Items.Count; index++)
|
||||
{
|
||||
if (_cmbCredential.Items[index] is SonicCredentialProfile profile
|
||||
&& profile.SonicCredentialId
|
||||
== dialog.CreatedProfile.SonicCredentialId)
|
||||
{
|
||||
_cmbCredential.SelectedIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show(
|
||||
MessageBox.Show(
|
||||
this,
|
||||
"Profil geladen.",
|
||||
"Benutzerprofil",
|
||||
@@ -1248,6 +1256,53 @@ public sealed class SetupWizardForm : Form
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private async Task EditCredentialAsync()
|
||||
{
|
||||
if (_cmbSystem.SelectedItem is not SonicSystemOption system)
|
||||
{
|
||||
ShowWarning("Bitte System wählen.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_cmbCredential.SelectedItem is not SonicCredentialProfile profile)
|
||||
{
|
||||
ShowWarning("Bitte Profil wählen.");
|
||||
return;
|
||||
}
|
||||
|
||||
using AddCredentialProfileForm dialog =
|
||||
new(_coordinator, system, profile);
|
||||
|
||||
if (dialog.ShowDialog(this) != DialogResult.OK
|
||||
|| dialog.CreatedProfile is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await SystemChangedAsync();
|
||||
SelectCredential(dialog.CreatedProfile.SonicCredentialId);
|
||||
|
||||
MessageBox.Show(
|
||||
this,
|
||||
"Profil aktualisiert.",
|
||||
"Benutzerprofil",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void SelectCredential(int sonicCredentialId)
|
||||
{
|
||||
for (int index = 0; index < _cmbCredential.Items.Count; index++)
|
||||
{
|
||||
if (_cmbCredential.Items[index] is SonicCredentialProfile profile
|
||||
&& profile.SonicCredentialId == sonicCredentialId)
|
||||
{
|
||||
_cmbCredential.SelectedIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SystemChangedAsync()
|
||||
{
|
||||
if (_cmbSystem.SelectedItem is not SonicSystemOption system)
|
||||
@@ -1275,9 +1330,12 @@ public sealed class SetupWizardForm : Form
|
||||
Environment.NewLine
|
||||
+ "Noch kein Benutzerprofil — bitte hinzufügen.";
|
||||
_btnSaveSelection.Enabled = false;
|
||||
_btnEditCredential.Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_btnEditCredential.Enabled = true;
|
||||
|
||||
_btnSaveSelection.Enabled = true;
|
||||
|
||||
LocalSetupSelection? selection = _coordinator.LoadSelection();
|
||||
|
||||
Reference in New Issue
Block a user