Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp_HumanEvents report improvement #1087

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions DBADashGUI/CommunityTools/CommunityTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Param>
Expand Down Expand Up @@ -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()
{
Expand Down
10 changes: 6 additions & 4 deletions DBADashGUI/CustomReports/CustomReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class CustomReport

public List<string> TriggerCollectionTypes { get; set; } = new();

public string CancellationMessageWarning { get; set; }

[JsonIgnore]
public Params Params { get; set; }

Expand All @@ -43,14 +45,14 @@ public class CustomReport
/// </summary>
[JsonIgnore]
public IEnumerable<Param> UserParams => Params == null ? new List<Param>() : Params.ParamList.Where(p =>
!SystemParamNames.Contains(p.ParamName.ToUpper()));
!SystemParamNames.Contains(p.ParamName.ToUpper()));

/// <summary>
/// Parameters for the stored procedure that are supplied automatically based on context
/// </summary>
[JsonIgnore]
public IEnumerable<Param> SystemParams => Params == null ? new List<Param>() : 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");
Expand All @@ -71,8 +73,8 @@ public class CustomReport
/// </summary>
[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));

/// <summary>
/// Save customizations
Expand Down
5 changes: 4 additions & 1 deletion DBADashGUI/CustomReports/CustomReportView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -1177,7 +1180,7 @@ await MessagingHelper.SendMessageAndProcessReply(msg, context, SetStatus, Proces
}
else
{
cancellationTokenSource.Cancel();
await cancellationTokenSource.CancelAsync();
}
}
}
Expand Down