feat: add modal dialog, paged results, scan status, and trend value table components
- Introduced ModalDialog component for displaying modal dialogs with accessibility features. - Added PagedResults component to handle pagination of items with customizable rendering. - Created ScanStatus component to display the status of a scan with elapsed time. - Implemented TrendValueTable component for displaying trend data in a paginated table format. - Added measurement utility functions for formatting and validating measurement values. - Included tests for measurement functions and trend series fetching logic to ensure correctness.
This commit is contained in:
1 parent
c19c77334f
commit
a8b6cd4061
23 files changed
+1479
-2157
No files matched your search
@@ -6,6 +6,8 @@
|
||||
4. Die Fragen zur Konfiguration beantworten. Bei Passwörtern kannst du den sicher erzeugten Vorschlag übernehmen. Für vorhandene Controller aktiviert „Bestandsanlage“ den bisherigen Datenbankzugang `wago` mit Passwort `3112` und gibt den MariaDB-Port im Netzwerk frei.
|
||||
5. Docker Desktop bei Bedarf fertig einrichten. Der Assistent baut und startet die Dienste und prüft Web, API und Collector. Danach kannst du SE-LTD über den Link im Assistenten auf Port 81 öffnen.
|
||||
|
||||
Die Fortschrittsanzeige nennt den aktuellen Schritt und die bisherige Laufzeit. Mit „Nach Schritt anhalten“ stoppt der Assistent vor dem nächsten Schritt. Ein gerade laufender Build darf fertig werden; bereits gestartete Dienste und gespeicherte Daten werden nicht entfernt.
|
||||
|
||||
Die Option „Nur dieser Rechner“ beschränkt Web, API, Collector und Hilfsoberflächen auf die lokale IPv4-Adresse. „Zugriff aus dem Netzwerk“ öffnet Web, API und Collector und setzt `CORS_ORIGIN=*`. Der Assistent ändert keine Windows-Firewallregeln. Verwende den Netzzugriff nur im vertrauenswürdigen Netz.
|
||||
|
||||
Eine bestehende `.env` bleibt unverändert. „Bestandsanlage“ bezieht sich auf den Controller-Zugang für eine neu aufgesetzte Datenbank. Vorhandene Datenbank-Volumes ändern ihr Passwort nicht durch eine neue `.env`. Es wird kein Backup oder Datenimport durchgeführt und es werden keine bestehenden Docker-Volumes gelöscht.
|
||||
|
||||
@@ -109,31 +109,42 @@ namespace SeLtd.Setup
|
||||
return true;
|
||||
}
|
||||
|
||||
internal void Prepare(string folder, Action<string> progress)
|
||||
internal void Prepare(string folder, Action<string> progress, CancellationToken cancellation = default(CancellationToken))
|
||||
{
|
||||
Folder = Path.GetFullPath(folder);
|
||||
Legacy = Remote = false;
|
||||
foreach (var step in Config.prepare)
|
||||
for (int index = 0; index < Config.prepare.Length; index++)
|
||||
{
|
||||
progress(step.label);
|
||||
cancellation.ThrowIfCancellationRequested();
|
||||
var step = Config.prepare[index];
|
||||
progress(StepLabel(step, index, Config.prepare.Length));
|
||||
if (step.action == "checkout") Checkout();
|
||||
else if (step.action == "template") LoadTemplate();
|
||||
else if (step.action == "command") RunStep(step);
|
||||
else throw new InvalidDataException("Unbekannter Vorbereitungsschritt: " + step.action);
|
||||
}
|
||||
cancellation.ThrowIfCancellationRequested();
|
||||
}
|
||||
|
||||
internal void Install(Action<string> progress)
|
||||
internal void Install(Action<string> progress, CancellationToken cancellation = default(CancellationToken))
|
||||
{
|
||||
foreach (var step in Config.install)
|
||||
for (int index = 0; index < Config.install.Length; index++)
|
||||
{
|
||||
progress(step.label);
|
||||
cancellation.ThrowIfCancellationRequested();
|
||||
var step = Config.install[index];
|
||||
progress(StepLabel(step, index, Config.install.Length));
|
||||
if (step.action == "dockerReady") WaitForDocker(TimeoutFor(step, 180), progress);
|
||||
else if (step.action == "writeSetup") WriteSetup();
|
||||
else if (step.action == "command") RunStep(step);
|
||||
else if (step.action == "http") CheckHttp(Expand(step.url), TimeoutFor(step, 45));
|
||||
else throw new InvalidDataException("Unbekannter Installationsschritt: " + step.action);
|
||||
}
|
||||
cancellation.ThrowIfCancellationRequested();
|
||||
}
|
||||
|
||||
private static string StepLabel(Step step, int index, int count)
|
||||
{
|
||||
return string.Format("Schritt {0} von {1}: {2}", index + 1, count, step.label);
|
||||
}
|
||||
|
||||
internal string LocalOrigin
|
||||
|
||||
@@ -40,6 +40,25 @@ namespace SeLtd.Setup
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
using (var wizard = new SetupWizard(setup)) Assert(wizard.Text == "SE-LTD Setup", "wizard initialization");
|
||||
|
||||
using (var pause = new CancellationTokenSource())
|
||||
{
|
||||
int announced = 0;
|
||||
bool paused = false;
|
||||
try
|
||||
{
|
||||
setup.Prepare(Path.Combine(root, "paused install"), phase =>
|
||||
{
|
||||
Assert(phase.StartsWith("Schritt 1 von 2:"), "visible progress position");
|
||||
announced++;
|
||||
pause.Cancel();
|
||||
}, pause.Token);
|
||||
}
|
||||
catch (OperationCanceledException) { paused = true; }
|
||||
Assert(paused && announced == 1, "pause between safe setup steps");
|
||||
Assert(Directory.Exists(Path.Combine(root, "paused install", ".git")), "active checkout completed before pausing");
|
||||
Assert(!File.Exists(Path.Combine(root, "paused install", ".env")), "pause does not write settings");
|
||||
}
|
||||
|
||||
foreach (bool legacy in new[] { false, true })
|
||||
{
|
||||
string target = Path.Combine(root, legacy ? "legacy install" : "new install");
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -15,6 +16,13 @@ namespace SeLtd.Setup
|
||||
private readonly FlowLayoutPanel body = new FlowLayoutPanel();
|
||||
private readonly Button back = new Button { Text = "Zurück", AutoSize = true };
|
||||
private readonly Button next = new Button { Text = "Weiter", AutoSize = true };
|
||||
private readonly Button pause = new Button { Text = "Nach Schritt anhalten", AutoSize = true, Visible = false };
|
||||
private readonly System.Windows.Forms.Timer progressTimer = new System.Windows.Forms.Timer { Interval = 1000 };
|
||||
private readonly Stopwatch elapsed = new Stopwatch();
|
||||
private CancellationTokenSource cancellation;
|
||||
private Label activeStep;
|
||||
private Label elapsedLabel;
|
||||
private ProgressBar progressBar;
|
||||
private TextBox input;
|
||||
private TextBox log;
|
||||
private CheckBox choice;
|
||||
@@ -66,7 +74,7 @@ namespace SeLtd.Setup
|
||||
body.Margin = new Padding(0);
|
||||
body.ClientSizeChanged += delegate { FitBody(); };
|
||||
var buttons = new FlowLayoutPanel { Dock = DockStyle.Fill, AutoSize = true, FlowDirection = FlowDirection.RightToLeft };
|
||||
buttons.Controls.AddRange(new Control[] { next, back });
|
||||
buttons.Controls.AddRange(new Control[] { next, back, pause });
|
||||
layout.Controls.Add(section, 0, 0);
|
||||
layout.Controls.Add(headline, 0, 1);
|
||||
layout.Controls.Add(body, 0, 2);
|
||||
@@ -75,7 +83,15 @@ namespace SeLtd.Setup
|
||||
AcceptButton = next;
|
||||
back.Click += OnBack;
|
||||
next.Click += OnNext;
|
||||
FormClosing += delegate(object sender, FormClosingEventArgs e) { if (busy) e.Cancel = true; };
|
||||
pause.Click += delegate { RequestPause(); };
|
||||
progressTimer.Tick += delegate { UpdateElapsed(); };
|
||||
Disposed += delegate { progressTimer.Dispose(); };
|
||||
FormClosing += delegate(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (!busy) return;
|
||||
e.Cancel = true;
|
||||
RequestPause();
|
||||
};
|
||||
ShowChecks();
|
||||
}
|
||||
|
||||
@@ -88,6 +104,7 @@ namespace SeLtd.Setup
|
||||
next.Text = nextText;
|
||||
back.Visible = canGoBack;
|
||||
next.Enabled = true;
|
||||
pause.Visible = false;
|
||||
validation = null;
|
||||
input = null;
|
||||
choice = null;
|
||||
@@ -239,22 +256,72 @@ namespace SeLtd.Setup
|
||||
{
|
||||
page = 4;
|
||||
Screen("SE-LTD SETUP / LÄUFT", title, "Erneut versuchen", false);
|
||||
cancellation = new CancellationTokenSource();
|
||||
activeStep = Note("Wird vorbereitet …");
|
||||
elapsedLabel = Note("");
|
||||
progressBar = new ProgressBar { Style = ProgressBarStyle.Marquee, Height = 12, Width = 320, AccessibleName = "Arbeitsschritt läuft" };
|
||||
Add(progressBar);
|
||||
log = new TextBox { ReadOnly = true, Multiline = true, ScrollBars = ScrollBars.Vertical, Height = 200, AccessibleName = "Installationsfortschritt" };
|
||||
Add(log);
|
||||
elapsed.Restart();
|
||||
UpdateElapsed();
|
||||
progressTimer.Start();
|
||||
pause.Enabled = true;
|
||||
pause.Visible = true;
|
||||
SetBusy(true);
|
||||
}
|
||||
|
||||
private void UpdateElapsed()
|
||||
{
|
||||
if (elapsedLabel == null || elapsedLabel.IsDisposed) return;
|
||||
var state = cancellation != null && cancellation.IsCancellationRequested
|
||||
? "Aktueller Schritt wird abgeschlossen. Danach hält das Setup an."
|
||||
: "Setup läuft.";
|
||||
elapsedLabel.Text = state + " Laufzeit " + elapsed.Elapsed.ToString(@"hh\:mm\:ss");
|
||||
}
|
||||
|
||||
private void RequestPause()
|
||||
{
|
||||
if (!busy || cancellation == null || cancellation.IsCancellationRequested) return;
|
||||
cancellation.Cancel();
|
||||
pause.Enabled = false;
|
||||
UpdateElapsed();
|
||||
}
|
||||
|
||||
private void SetBusy(bool value)
|
||||
{
|
||||
busy = value;
|
||||
back.Enabled = !value;
|
||||
next.Enabled = !value;
|
||||
UseWaitCursor = value;
|
||||
if (!value)
|
||||
{
|
||||
progressTimer.Stop();
|
||||
elapsed.Stop();
|
||||
if (progressBar != null && !progressBar.IsDisposed)
|
||||
{
|
||||
progressBar.Style = ProgressBarStyle.Blocks;
|
||||
progressBar.Visible = false;
|
||||
}
|
||||
pause.Visible = false;
|
||||
if (cancellation != null)
|
||||
{
|
||||
cancellation.Dispose();
|
||||
cancellation = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Progress(string line)
|
||||
{
|
||||
BeginInvoke(new Action(() => log.AppendText(line + Environment.NewLine)));
|
||||
var output = log;
|
||||
var label = activeStep;
|
||||
BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (output.IsDisposed) return;
|
||||
label.Text = line;
|
||||
output.AppendText(line + Environment.NewLine);
|
||||
}));
|
||||
}
|
||||
|
||||
private void ShowSuccess()
|
||||
@@ -304,10 +371,12 @@ namespace SeLtd.Setup
|
||||
ShowProgress("Projekt wird vorbereitet");
|
||||
try
|
||||
{
|
||||
await Task.Run(() => setup.Prepare(folder, Progress));
|
||||
var stop = cancellation.Token;
|
||||
await Task.Run(() => setup.Prepare(folder, Progress, stop));
|
||||
if (setup.ExistingEnvironment) ShowExisting();
|
||||
else { variableIndex = 0; ShowVariable(); }
|
||||
}
|
||||
catch (OperationCanceledException) { ShowFolder(); }
|
||||
catch (Exception error) { ShowError(error); ShowFolder(); }
|
||||
finally { SetBusy(false); }
|
||||
}
|
||||
@@ -332,12 +401,19 @@ namespace SeLtd.Setup
|
||||
ShowProgress("SE-LTD wird installiert");
|
||||
try
|
||||
{
|
||||
await Task.Run(() => setup.Install(Progress));
|
||||
var stop = cancellation.Token;
|
||||
await Task.Run(() => setup.Install(Progress, stop));
|
||||
ShowSuccess();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
headline.Text = "Setup angehalten";
|
||||
elapsedLabel.Text = "Bereits gestartete Dienste bleiben unverändert. Du kannst das Setup erneut starten.";
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
log.AppendText(Environment.NewLine + error.Message);
|
||||
elapsedLabel.Text = "Setup fehlgeschlagen. Details stehen im Fortschrittsprotokoll.";
|
||||
ShowError(error);
|
||||
}
|
||||
finally { SetBusy(false); }
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
{ "action": "dockerReady", "label": "Docker Desktop starten und Verbindung prüfen", "timeout": 180 },
|
||||
{ "action": "writeSetup", "label": "Lokale Installationseinstellungen schreiben" },
|
||||
{ "action": "command", "label": "Docker-Konfiguration prüfen", "tool": "docker", "arguments": ["compose", "--env-file", ".env", "config", "--quiet"], "timeout": 60 },
|
||||
{ "action": "command", "label": "Alle SE-LTD-Dienste bauen und starten", "tool": "docker", "arguments": ["compose", "--env-file", ".env", "up", "-d", "--build", "--wait", "--wait-timeout", "240"], "timeout": 2400 },
|
||||
{ "action": "command", "label": "Docker-Images für SE-LTD bauen", "tool": "docker", "arguments": ["compose", "--env-file", ".env", "build"], "timeout": 2400 },
|
||||
{ "action": "command", "label": "Dienste starten und auf Bereitschaft warten", "tool": "docker", "arguments": ["compose", "--env-file", ".env", "up", "-d", "--no-build", "--wait", "--wait-timeout", "240"], "timeout": 900 },
|
||||
{ "action": "http", "label": "Weboberfläche prüfen", "url": "http://127.0.0.1:{{WEB_PORT}}/", "timeout": 45 },
|
||||
{ "action": "http", "label": "API prüfen", "url": "http://127.0.0.1:{{API_PORT}}/api/health", "timeout": 45 },
|
||||
{ "action": "http", "label": "Collector prüfen", "url": "http://127.0.0.1:18110/health", "timeout": 45 }
|
||||
|
||||
Reference in new issue
Block a user