Dynamic labels & Changed color to light green
- Filesystem size - Flexi version - Flexi Revision - MAC - Timestamp - Temperature - ZoomLock - Serial and model Number - Licenses - CPU usage
This commit is contained in:
@@ -43,12 +43,12 @@ namespace AiQ_GUI
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(errMssg))
|
||||
{
|
||||
Lbl.Text += "OK";
|
||||
Lbl.ForeColor = Color.LightGreen;
|
||||
Lbl.Text = Lbl.Text.TrimEnd('=', ' ') + " = OK"; // SET the text with proper format
|
||||
Lbl.ForeColor = Color.LimeGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
Lbl.Text += errMssg;
|
||||
Lbl.Text = Lbl.Text.TrimEnd('=', ' ') + " = " + errMssg; // SET the text with error message
|
||||
Lbl.ForeColor = Color.Red;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{
|
||||
VorI.Sort(); // Sort the list from lowest to highest to prepare for finding the median
|
||||
double medianVorI = (VorI[2] + VorI[3]) / 2.0; // Will always be even (6) number of channels therefore average the two middle elements
|
||||
lblVorI.Text += $"Median: {medianVorI}{VormA} "; // Display median value
|
||||
string medianText = $"Median: {medianVorI}{VormA}";
|
||||
|
||||
// Define the 20% threshold ranges
|
||||
double LowerThreshold = ExpVorI * 0.8;
|
||||
@@ -18,8 +18,12 @@
|
||||
// Check median is within 20% of the expected value
|
||||
if (medianVorI < LowerThreshold || medianVorI > UpperThreshold)
|
||||
{
|
||||
lblVorI.Text += $" Median away from excepted {ExpVorI}{VormA}";
|
||||
lblVorI.ForeColor = Color.Red;
|
||||
medianText += $" (away from expected {ExpVorI}{VormA})";
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
|
||||
lblVorI.ForeColor = Color.Red;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,12 +39,20 @@
|
||||
// If there are no single channels outside the threshold then green, else red
|
||||
if (outOfRangeVoltageChannels.Count == 0)
|
||||
{
|
||||
lblVorI.ForeColor = Color.LightGreen;
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
|
||||
lblVorI.ForeColor = Color.LimeGreen;
|
||||
});
|
||||
}
|
||||
else if (outOfRangeVoltageChannels.Count != 0)
|
||||
{
|
||||
lblVorI.Text += "error on " + string.Join(", ", outOfRangeVoltageChannels); // Join all problem channels together to present on form
|
||||
lblVorI.ForeColor = Color.Red;
|
||||
string errorText = medianText + " (error on " + string.Join(", ", outOfRangeVoltageChannels) + ")";
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + errorText;
|
||||
lblVorI.ForeColor = Color.Red;
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -40,6 +40,13 @@ namespace AiQ_GUI
|
||||
{
|
||||
SshClient client = SshConnect(IPAddress);
|
||||
|
||||
// CRITICAL: Check if connection actually succeeded
|
||||
if (client == null)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"SSH connection failed for {IPAddress}", Level.ERROR);
|
||||
return Data; // Return empty data
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Data.packages = GetVaxtorPackages(client);
|
||||
@@ -78,9 +85,6 @@ namespace AiQ_GUI
|
||||
MainForm.Instance.AddToActionsList($"SSH connection failed: {ex.Message}. Check password or network. ", Level.WARNING);
|
||||
}
|
||||
|
||||
string LogMssg = string.Join(" | ", typeof(SSHData).GetProperties().Select(p => $"{p.Name}: {p.GetValue(Data)}"));
|
||||
Logging.LogMessage(LogMssg); // Log all of Data
|
||||
|
||||
return Data;
|
||||
}
|
||||
|
||||
@@ -234,6 +238,14 @@ namespace AiQ_GUI
|
||||
const double Deviation = 20.0; // ±20GB
|
||||
|
||||
double currentSize = NormaliseFSSize(sshData.FilesystemSize);
|
||||
|
||||
// Create label dynamically if not provided
|
||||
if (LblFSSize == null)
|
||||
{
|
||||
MainForm.Instance.AddLabelToPanel($"Filesystem Size = {currentSize}GB", currentSize < (GoodSize - Deviation) || currentSize > (GoodSize + Deviation));
|
||||
return sshData;
|
||||
}
|
||||
|
||||
LblFSSize.Text = $"Filesystem Size = {currentSize}GB";
|
||||
|
||||
if (Math.Abs(GoodSize - currentSize) < Deviation)
|
||||
@@ -280,7 +292,8 @@ namespace AiQ_GUI
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(rootSize)) return 0;
|
||||
if (string.IsNullOrWhiteSpace(rootSize))
|
||||
return 0;
|
||||
|
||||
// Extract value & unit
|
||||
System.Text.RegularExpressions.Match match = RegexCache.FileSizeRegex().Match(rootSize.Trim());
|
||||
|
||||
Reference in New Issue
Block a user