mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Fixing faulty showInTooltip logic and adding prop display value for Query Plan (#1401)
* Fixing faulty showInTooltip logic * Renaming one prop appropriately * Fixing prop function * Fixed PR related comments * Fixing stuff * Logging errors now
This commit is contained in:
@@ -87,9 +87,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int DisplayOrder { get; set; }
|
public int DisplayOrder { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip
|
/// Flag to show property at the bottom of tooltip. Generally done for for properties with longer value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsLongString { get; set; }
|
public bool PositionAtBottom { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Value to be displayed in UI like tooltips and properties View
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public string DisplayValue { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NestedExecutionPlanGraphProperty : ExecutionPlanGraphPropertyBase
|
public class NestedExecutionPlanGraphProperty : ExecutionPlanGraphPropertyBase
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShowInTooltip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.showInTooltip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsLongString
|
public bool IsLongString
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -189,6 +197,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph
|
|||||||
if (showInToolTipAttribute != null)
|
if (showInToolTipAttribute != null)
|
||||||
{
|
{
|
||||||
this.isLongString = showInToolTipAttribute.LongString;
|
this.isLongString = showInToolTipAttribute.LongString;
|
||||||
|
this.showInTooltip = showInToolTipAttribute.Value;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
this.showInTooltip = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +215,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph
|
|||||||
private PropertyDescriptor baseProperty;
|
private PropertyDescriptor baseProperty;
|
||||||
private bool isLongString;
|
private bool isLongString;
|
||||||
private bool initialized;
|
private bool initialized;
|
||||||
|
private bool showInTooltip;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph;
|
using Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph;
|
||||||
|
using Microsoft.SqlTools.Utility;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.ShowPlan
|
namespace Microsoft.SqlTools.ServiceLayer.ShowPlan
|
||||||
{
|
{
|
||||||
@@ -70,9 +72,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan
|
|||||||
{
|
{
|
||||||
Name = prop.DisplayName,
|
Name = prop.DisplayName,
|
||||||
Value = propertyValue,
|
Value = propertyValue,
|
||||||
ShowInTooltip = prop.IsBrowsable,
|
ShowInTooltip = prop.ShowInTooltip,
|
||||||
DisplayOrder = prop.DisplayOrder,
|
DisplayOrder = prop.DisplayOrder,
|
||||||
IsLongString = prop.IsLongString,
|
PositionAtBottom = prop.IsLongString,
|
||||||
|
DisplayValue = GetPropertyDisplayValue(prop)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -82,9 +85,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan
|
|||||||
{
|
{
|
||||||
Name = prop.DisplayName,
|
Name = prop.DisplayName,
|
||||||
Value = propertyValue,
|
Value = propertyValue,
|
||||||
ShowInTooltip = prop.IsBrowsable,
|
ShowInTooltip = prop.ShowInTooltip,
|
||||||
DisplayOrder = prop.DisplayOrder,
|
DisplayOrder = prop.DisplayOrder,
|
||||||
IsLongString = prop.IsLongString,
|
PositionAtBottom = prop.IsLongString,
|
||||||
|
DisplayValue = GetPropertyDisplayValue(prop)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,5 +126,27 @@ GO
|
|||||||
*/
|
*/
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetPropertyDisplayValue(PropertyValue property)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Get the property value.
|
||||||
|
object propertyValue = property.GetValue(property.Value);
|
||||||
|
|
||||||
|
if (propertyValue == null)
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the property value to the text.
|
||||||
|
return property.Converter.ConvertToString(propertyValue).Trim();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Write(TraceEventType.Error, e.ToString());
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user