diff --git a/DBADashGUI/CommunityTools/CommunityTools.cs b/DBADashGUI/CommunityTools/CommunityTools.cs index 2b7e69ab..f213e8d9 100644 --- a/DBADashGUI/CommunityTools/CommunityTools.cs +++ b/DBADashGUI/CommunityTools/CommunityTools.cs @@ -1524,6 +1524,7 @@ internal class CommunityTools ProcedureName = ProcedureExecutionMessage.CommandNames.sp_HumanEvents.ToString(), URL = ErikDarlingUrl, Description = "Extended events capture", + CancellationMessageWarning = "Cancellation of this report will leave an extended event session running that will require cleanup.", Params = new Params() { ParamList = new List @@ -1637,11 +1638,14 @@ internal class CommunityTools ParameterName = "@skip_plans", Name = "Skip Plans", DefaultValue = false, - PickerItems = new() - { - { true, "Yes" }, - { false, "No" } - } + PickerItems = BooleanPickerItems + }, + new() + { + ParameterName = "@cleanup", + Name = "Cleanup", + DefaultValue = true, + PickerItems = BooleanPickerItems }, new() { diff --git a/DBADashGUI/CustomReports/CustomReport.cs b/DBADashGUI/CustomReports/CustomReport.cs index 5e95ffac..261fd07b 100644 --- a/DBADashGUI/CustomReports/CustomReport.cs +++ b/DBADashGUI/CustomReports/CustomReport.cs @@ -30,6 +30,8 @@ public class CustomReport public List TriggerCollectionTypes { get; set; } = new(); + public string CancellationMessageWarning { get; set; } + [JsonIgnore] public Params Params { get; set; } @@ -43,14 +45,14 @@ public class CustomReport /// [JsonIgnore] public IEnumerable UserParams => Params == null ? new List() : Params.ParamList.Where(p => - !SystemParamNames.Contains(p.ParamName.ToUpper())); + !SystemParamNames.Contains(p.ParamName.ToUpper())); /// /// Parameters for the stored procedure that are supplied automatically based on context /// [JsonIgnore] public IEnumerable SystemParams => Params == null ? new List() : Params.ParamList.Where(p => - SystemParamNames.Contains(p.ParamName.ToUpper())); + SystemParamNames.Contains(p.ParamName.ToUpper())); [JsonIgnore] public bool IsRootLevel => Params != null && Params.ParamList.Any(p => p.ParamName.ToUpper() == "@INSTANCEIDS"); @@ -71,8 +73,8 @@ public class CustomReport /// [JsonIgnore] public bool TimeFilterSupported => Params.ParamList.Any(p => - p.ParamName.Equals("@FromDate", StringComparison.CurrentCultureIgnoreCase) || - p.ParamName.Equals("@ToDate", StringComparison.CurrentCultureIgnoreCase)); + p.ParamName.Equals("@FromDate", StringComparison.CurrentCultureIgnoreCase) || + p.ParamName.Equals("@ToDate", StringComparison.CurrentCultureIgnoreCase)); /// /// Save customizations diff --git a/DBADashGUI/CustomReports/CustomReportView.cs b/DBADashGUI/CustomReports/CustomReportView.cs index a7662641..2b1ffe41 100644 --- a/DBADashGUI/CustomReports/CustomReportView.cs +++ b/DBADashGUI/CustomReports/CustomReportView.cs @@ -1154,6 +1154,9 @@ private async void TsCancel_Click(object sender, EventArgs e) private async Task CancelProcessing() { + if (!string.IsNullOrEmpty(report.CancellationMessageWarning) + && MessageBox.Show(report.CancellationMessageWarning + "\nDo you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) return; + if (report is DirectExecutionReport) { if (CurrentMessageGroup != Guid.Empty) @@ -1177,7 +1180,7 @@ await MessagingHelper.SendMessageAndProcessReply(msg, context, SetStatus, Proces } else { - cancellationTokenSource.Cancel(); + await cancellationTokenSource.CancelAsync(); } } }