diff --git a/Dashboard/SettingsWindow.xaml b/Dashboard/SettingsWindow.xaml
index 28f1f02b..03ed9092 100644
--- a/Dashboard/SettingsWindow.xaml
+++ b/Dashboard/SettingsWindow.xaml
@@ -205,6 +205,8 @@
TextAlignment="Center"/>
+
@@ -322,6 +324,8 @@
+
diff --git a/Dashboard/SettingsWindow.xaml.cs b/Dashboard/SettingsWindow.xaml.cs
index 2136fd96..c6d4de91 100644
--- a/Dashboard/SettingsWindow.xaml.cs
+++ b/Dashboard/SettingsWindow.xaml.cs
@@ -256,6 +256,31 @@ private void RestoreAlertDefaultsButton_Click(object sender, RoutedEventArgs e)
LongRunningQueryThresholdTextBox.Text = "30";
TempDbSpaceThresholdTextBox.Text = "80";
LongRunningJobMultiplierTextBox.Text = "3";
+ UpdateAlertPreviewText();
+ }
+
+ private void UpdateAlertPreviewText()
+ {
+ var parts = new System.Collections.Generic.List();
+
+ if (NotifyOnBlockingCheckBox.IsChecked == true)
+ parts.Add($"blocking > {BlockingThresholdTextBox.Text}s");
+ if (NotifyOnDeadlockCheckBox.IsChecked == true)
+ parts.Add($"deadlocks >= {DeadlockThresholdTextBox.Text}");
+ if (NotifyOnHighCpuCheckBox.IsChecked == true)
+ parts.Add($"CPU > {CpuThresholdTextBox.Text}%");
+ if (NotifyOnPoisonWaitsCheckBox.IsChecked == true)
+ parts.Add($"poison waits >= {PoisonWaitThresholdTextBox.Text}ms avg");
+ if (NotifyOnLongRunningQueriesCheckBox.IsChecked == true)
+ parts.Add($"queries > {LongRunningQueryThresholdTextBox.Text}min");
+ if (NotifyOnTempDbSpaceCheckBox.IsChecked == true)
+ parts.Add($"TempDB > {TempDbSpaceThresholdTextBox.Text}%");
+ if (NotifyOnLongRunningJobsCheckBox.IsChecked == true)
+ parts.Add($"jobs > {LongRunningJobMultiplierTextBox.Text}x avg");
+
+ AlertPreviewText.Text = parts.Count > 0
+ ? $"Will alert when: {string.Join(", ", parts)}"
+ : "No alerts enabled";
}
private void UpdateAlertNotificationStates()
@@ -275,6 +300,7 @@ private void UpdateAlertNotificationStates()
TempDbSpaceThresholdTextBox.IsEnabled = notificationsEnabled && NotifyOnTempDbSpaceCheckBox.IsChecked == true;
NotifyOnLongRunningJobsCheckBox.IsEnabled = notificationsEnabled;
LongRunningJobMultiplierTextBox.IsEnabled = notificationsEnabled && NotifyOnLongRunningJobsCheckBox.IsChecked == true;
+ UpdateAlertPreviewText();
}
private void UpdateNotificationCheckboxStates()
@@ -561,6 +587,35 @@ private void UpdateSmtpControlStates()
SmtpFromTextBox.IsEnabled = enabled;
SmtpRecipientsTextBox.IsEnabled = enabled;
TestEmailButton.IsEnabled = enabled;
+ ValidateSmtpButton.IsEnabled = enabled;
+ }
+
+ private void ValidateSmtpButton_Click(object sender, RoutedEventArgs e)
+ {
+ var errors = new System.Collections.Generic.List();
+
+ if (string.IsNullOrWhiteSpace(SmtpServerTextBox.Text))
+ errors.Add("SMTP server is required");
+ if (!int.TryParse(SmtpPortTextBox.Text, out var port) || port < 1 || port > 65535)
+ errors.Add("Port must be between 1 and 65535");
+ if (string.IsNullOrWhiteSpace(SmtpFromTextBox.Text))
+ errors.Add("From address is required");
+ else if (!SmtpFromTextBox.Text.Trim().Contains('@'))
+ errors.Add("From address must be a valid email");
+ if (string.IsNullOrWhiteSpace(SmtpRecipientsTextBox.Text))
+ errors.Add("At least one recipient is required");
+
+ if (errors.Count == 0)
+ {
+ TestEmailStatusText.Text = "Settings look good. Use 'Send Test Email' to verify delivery.";
+ }
+ else
+ {
+ TestEmailStatusText.Text = "";
+ MessageBox.Show(
+ "SMTP configuration has issues:\n\n" + string.Join("\n", errors),
+ "SMTP Validation", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
}
private async void TestEmailButton_Click(object sender, RoutedEventArgs e)
diff --git a/Lite/Windows/SettingsWindow.xaml b/Lite/Windows/SettingsWindow.xaml
index d6501a29..63686803 100644
--- a/Lite/Windows/SettingsWindow.xaml
+++ b/Lite/Windows/SettingsWindow.xaml
@@ -113,6 +113,9 @@
+
+
@@ -206,8 +211,13 @@
-
+
+
+
+
+
diff --git a/Lite/Windows/SettingsWindow.xaml.cs b/Lite/Windows/SettingsWindow.xaml.cs
index 8c014d51..7e52f9bf 100644
--- a/Lite/Windows/SettingsWindow.xaml.cs
+++ b/Lite/Windows/SettingsWindow.xaml.cs
@@ -323,6 +323,31 @@ private void RestoreAlertDefaultsButton_Click(object sender, RoutedEventArgs e)
AlertLongRunningQueryThresholdBox.Text = "30";
AlertTempDbSpaceThresholdBox.Text = "80";
AlertLongRunningJobMultiplierBox.Text = "3";
+ UpdateAlertPreviewText();
+ }
+
+ private void UpdateAlertPreviewText()
+ {
+ var parts = new System.Collections.Generic.List();
+
+ if (AlertCpuCheckBox.IsChecked == true)
+ parts.Add($"CPU > {AlertCpuThresholdBox.Text}%");
+ if (AlertBlockingCheckBox.IsChecked == true)
+ parts.Add($"blocking >= {AlertBlockingThresholdBox.Text}");
+ if (AlertDeadlockCheckBox.IsChecked == true)
+ parts.Add($"deadlocks >= {AlertDeadlockThresholdBox.Text}");
+ if (AlertPoisonWaitCheckBox.IsChecked == true)
+ parts.Add($"poison waits >= {AlertPoisonWaitThresholdBox.Text}ms avg");
+ if (AlertLongRunningQueryCheckBox.IsChecked == true)
+ parts.Add($"queries > {AlertLongRunningQueryThresholdBox.Text}min");
+ if (AlertTempDbSpaceCheckBox.IsChecked == true)
+ parts.Add($"TempDB > {AlertTempDbSpaceThresholdBox.Text}%");
+ if (AlertLongRunningJobCheckBox.IsChecked == true)
+ parts.Add($"jobs > {AlertLongRunningJobMultiplierBox.Text}x avg");
+
+ AlertPreviewText.Text = parts.Count > 0
+ ? $"Will alert when: {string.Join(", ", parts)}"
+ : "No alerts enabled";
}
private void UpdateAlertControlStates()
@@ -343,6 +368,7 @@ private void UpdateAlertControlStates()
AlertTempDbSpaceThresholdBox.IsEnabled = enabled;
AlertLongRunningJobCheckBox.IsEnabled = enabled;
AlertLongRunningJobMultiplierBox.IsEnabled = enabled;
+ UpdateAlertPreviewText();
}
private void LoadSmtpSettings()
@@ -430,6 +456,35 @@ private void UpdateSmtpControlStates()
SmtpFromBox.IsEnabled = enabled;
SmtpRecipientsBox.IsEnabled = enabled;
TestEmailButton.IsEnabled = enabled;
+ ValidateSmtpButton.IsEnabled = enabled;
+ }
+
+ private void ValidateSmtpButton_Click(object sender, RoutedEventArgs e)
+ {
+ var errors = new System.Collections.Generic.List();
+
+ if (string.IsNullOrWhiteSpace(SmtpServerBox.Text))
+ errors.Add("SMTP server is required");
+ if (!int.TryParse(SmtpPortBox.Text, out var port) || port < 1 || port > 65535)
+ errors.Add("Port must be between 1 and 65535");
+ if (string.IsNullOrWhiteSpace(SmtpFromBox.Text))
+ errors.Add("From address is required");
+ else if (!SmtpFromBox.Text.Trim().Contains('@'))
+ errors.Add("From address must be a valid email");
+ if (string.IsNullOrWhiteSpace(SmtpRecipientsBox.Text))
+ errors.Add("At least one recipient is required");
+
+ if (errors.Count == 0)
+ {
+ SmtpStatusText.Text = "Settings look good. Use 'Send Test Email' to verify delivery.";
+ }
+ else
+ {
+ SmtpStatusText.Text = "";
+ MessageBox.Show(
+ "SMTP configuration has issues:\n\n" + string.Join("\n", errors),
+ "SMTP Validation", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
}
private async void TestEmailButton_Click(object sender, RoutedEventArgs e)