mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Adding node overlays to execution plans (#1451)
* Adding node overlays to execution plans * Adding critical warnings and parallelism * adding critical warning, badge type enum * Renaming badge type class * Adding explicit values to Badge Type
This commit is contained in:
@@ -74,6 +74,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.Contracts
|
|||||||
public string[] Subtext { get; set; }
|
public string[] Subtext { get; set; }
|
||||||
public List<ExecutionPlanNode> Children { get; set; }
|
public List<ExecutionPlanNode> Children { get; set; }
|
||||||
public List<ExecutionPlanEdges> Edges { get; set; }
|
public List<ExecutionPlanEdges> Edges { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Add badge icon to nodes like warnings and parallelism
|
||||||
|
/// </summary>
|
||||||
|
public List<Badge> Badges { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExecutionPlanGraphPropertyBase
|
public class ExecutionPlanGraphPropertyBase
|
||||||
@@ -161,4 +165,24 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.Contracts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string GraphFileType { get; set; }
|
public string GraphFileType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Badge
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of the node overlay. This determines the icon that is displayed for it
|
||||||
|
/// </summary>
|
||||||
|
public BadgeType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text to display for the overlay tooltip
|
||||||
|
/// </summary>
|
||||||
|
public string Tooltip { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BadgeType
|
||||||
|
{
|
||||||
|
WARNING = 0,
|
||||||
|
CRITICALWARNING = 1,
|
||||||
|
PARALLELISM = 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -46,11 +46,46 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan
|
|||||||
Properties = GetProperties(currentNode.Properties),
|
Properties = GetProperties(currentNode.Properties),
|
||||||
Children = currentNode.Children.Select(x => ConvertShowPlanTreeToExecutionPlanTree(x)).ToList(),
|
Children = currentNode.Children.Select(x => ConvertShowPlanTreeToExecutionPlanTree(x)).ToList(),
|
||||||
Edges = currentNode.Edges.Select(x => ConvertShowPlanEdgeToExecutionPlanEdge(x)).ToList(),
|
Edges = currentNode.Edges.Select(x => ConvertShowPlanEdgeToExecutionPlanEdge(x)).ToList(),
|
||||||
|
Badges = GenerateNodeOverlay(currentNode),
|
||||||
Name = currentNode.DisplayName,
|
Name = currentNode.DisplayName,
|
||||||
ElapsedTimeInMs = currentNode.ElapsedTimeInMs
|
ElapsedTimeInMs = currentNode.ElapsedTimeInMs
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Badge> GenerateNodeOverlay(Node currentNode)
|
||||||
|
{
|
||||||
|
List<Badge> overlays = new List<Badge>();
|
||||||
|
|
||||||
|
if (currentNode.HasWarnings)
|
||||||
|
{
|
||||||
|
if (currentNode.HasCriticalWarnings)
|
||||||
|
{
|
||||||
|
overlays.Add(new Badge
|
||||||
|
{
|
||||||
|
Type = BadgeType.CRITICALWARNING,
|
||||||
|
Tooltip = SR.WarningOverlayTooltip
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
overlays.Add(new Badge
|
||||||
|
{
|
||||||
|
Type = BadgeType.WARNING,
|
||||||
|
Tooltip = SR.WarningOverlayTooltip
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNode.IsParallel)
|
||||||
|
{
|
||||||
|
overlays.Add(new Badge
|
||||||
|
{
|
||||||
|
Type = BadgeType.PARALLELISM,
|
||||||
|
Tooltip = SR.ParallelismOverlayTooltip
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return overlays;
|
||||||
|
}
|
||||||
|
|
||||||
public static ExecutionPlanEdges ConvertShowPlanEdgeToExecutionPlanEdge(Edge edge)
|
public static ExecutionPlanEdges ConvertShowPlanEdgeToExecutionPlanEdge(Edge edge)
|
||||||
{
|
{
|
||||||
return new ExecutionPlanEdges
|
return new ExecutionPlanEdges
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value that indicates whether the Node has critical warnings.
|
/// Gets the value that indicates whether the Node has critical warnings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool HasCriticalWarnings
|
public bool HasCriticalWarnings
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8445,6 +8445,22 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string WarningOverlayTooltip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Keys.GetString(Keys.WarningOverlayTooltip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ParallelismOverlayTooltip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Keys.GetString(Keys.ParallelismOverlayTooltip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string TableEditPathNotProvidedException
|
public static string TableEditPathNotProvidedException
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -12664,6 +12680,12 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
public const string MissingIndexDetailsTitle = "MissingIndexDetailsTitle";
|
public const string MissingIndexDetailsTitle = "MissingIndexDetailsTitle";
|
||||||
|
|
||||||
|
|
||||||
|
public const string WarningOverlayTooltip = "WarningOverlayTooltip";
|
||||||
|
|
||||||
|
|
||||||
|
public const string ParallelismOverlayTooltip = "ParallelismOverlayTooltip";
|
||||||
|
|
||||||
|
|
||||||
public const string TableNotInitializedException = "TableNotInitializedException";
|
public const string TableNotInitializedException = "TableNotInitializedException";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4619,6 +4619,14 @@ The Query Processor estimates that implementing the following index could improv
|
|||||||
<comment>title of missing index details.
|
<comment>title of missing index details.
|
||||||
Parameters: 0 - fileName (string), 1 - impact (string) </comment>
|
Parameters: 0 - fileName (string), 1 - impact (string) </comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="WarningOverlayTooltip" xml:space="preserve">
|
||||||
|
<value>Warnings</value>
|
||||||
|
<comment>tooltip text for node warning overlay</comment>
|
||||||
|
</data>
|
||||||
|
<data name="ParallelismOverlayTooltip" xml:space="preserve">
|
||||||
|
<value>Parallel Execution</value>
|
||||||
|
<comment>tooltip text for node parallelism overlay</comment>
|
||||||
|
</data>
|
||||||
<data name="TableNotInitializedException" xml:space="preserve">
|
<data name="TableNotInitializedException" xml:space="preserve">
|
||||||
<value>Initialization is not properly done for table with id '{0}'</value>
|
<value>Initialization is not properly done for table with id '{0}'</value>
|
||||||
<comment>.
|
<comment>.
|
||||||
|
|||||||
@@ -2223,7 +2223,10 @@ ActualOfEstimated(string actual, string estimated, decimal percent) = {0} of\n{1
|
|||||||
MissingIndexFormat(string impact, string queryText) = Missing Index (Impact {0}): {1}
|
MissingIndexFormat(string impact, string queryText) = Missing Index (Impact {0}): {1}
|
||||||
;title of missing index details
|
;title of missing index details
|
||||||
MissingIndexDetailsTitle(string fileName, string impact) = /*\r\nMissing Index Details from {0}\r\nThe Query Processor estimates that implementing the following index could improve the query cost by {1}%.\r\n*/
|
MissingIndexDetailsTitle(string fileName, string impact) = /*\r\nMissing Index Details from {0}\r\nThe Query Processor estimates that implementing the following index could improve the query cost by {1}%.\r\n*/
|
||||||
|
;tooltip text for node warning overlay
|
||||||
|
WarningOverlayTooltip = Warnings
|
||||||
|
;tooltip text for node parallelism overlay
|
||||||
|
ParallelismOverlayTooltip = Parallel Execution
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
# Table Designer
|
# Table Designer
|
||||||
|
|||||||
@@ -5993,6 +5993,16 @@ The Query Processor estimates that implementing the following index could improv
|
|||||||
<target state="new">New Clause</target>
|
<target state="new">New Clause</target>
|
||||||
<note></note>
|
<note></note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="WarningOverlayTooltip">
|
||||||
|
<source>Warnings</source>
|
||||||
|
<target state="new">Warnings</target>
|
||||||
|
<note>tooltip text for node warning overlay</note>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="ParallelismOverlayTooltip">
|
||||||
|
<source>Parallel Execution</source>
|
||||||
|
<target state="new">Parallel Execution</target>
|
||||||
|
<note>tooltip text for node parallelism overlay</note>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
Reference in New Issue
Block a user