feat: complete TASK-WP0-08 logging
This commit is contained in:
@@ -268,6 +268,8 @@ internal sealed class SupervisorForm : Form
|
||||
|
||||
internal sealed class DiagnosticsForm : Form
|
||||
{
|
||||
internal string CopyPayload { get; }
|
||||
|
||||
internal DiagnosticsForm(SupervisorState state)
|
||||
{
|
||||
BackColor = Color.White;
|
||||
@@ -281,11 +283,22 @@ internal sealed class DiagnosticsForm : Form
|
||||
checks.Columns.Add("组件", 170);
|
||||
checks.Columns.Add("状态", 110);
|
||||
checks.Columns.Add("检查结果", 390);
|
||||
var report = DiagnosticReport.Create(
|
||||
state,
|
||||
[
|
||||
state == SupervisorState.StorageUnavailable
|
||||
? DiagnosticCheck.Fail("log_writable", "log_write_failed")
|
||||
: DiagnosticCheck.Pass("log_writable", "log_ready"),
|
||||
DiagnosticCheck.Pass("fixed_port", "loopback_only"),
|
||||
],
|
||||
new DiagnosticStorageSummary(0, 0, 0),
|
||||
[]);
|
||||
CopyPayload = System.Text.Json.JsonSerializer.Serialize(report, new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
|
||||
checks.Items.Add(new ListViewItem(["Supervisor", "正常", StateLabel(state)]));
|
||||
checks.Items.Add(new ListViewItem(["固定端口", "43121", "仅绑定 127.0.0.1"]));
|
||||
checks.Items.Add(new ListViewItem(["凭据", "已脱敏", "仅显示是否已配置"]));
|
||||
var copy = new Button { Location = new Point(592, 382), Size = new Size(138, 36), Text = "复制脱敏结果" };
|
||||
copy.Click += (_, _) => Clipboard.SetText("Dada diagnostics: redacted");
|
||||
copy.Click += (_, _) => Clipboard.SetText(CopyPayload);
|
||||
Controls.AddRange([title, detail, checks, copy]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user