From 57b4c253953bf9c5d4c03b59a7249851c4c7db2d Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 12 Aug 2022 15:57:01 -0700 Subject: [PATCH] set graph table types (#1633) --- .../SmoModel/SmoTableCustomNode.cs | 17 ++++++++++++----- .../ObjectExplorer/SmoModel/SmoTreeNodes.cs | 10 ++++++++++ .../SmoModel/SmoTreeNodesDefinition.xml | 2 ++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs index 4310b3c3..f033b279 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs @@ -34,11 +34,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } else if (table != null && IsPropertySupported("IsExternal", smoContext, table, CachedSmoProperties) && table.IsExternal) { - return $"{table.Schema}.{table.Name} ({SR.External_LabelPart})"; + return $"{table.Schema}.{table.Name} ({SR.External_LabelPart})"; } else if (table != null && IsPropertySupported("IsFileTable", smoContext, table, CachedSmoProperties) && table.IsFileTable) { - return $"{table.Schema}.{table.Name} ({SR.FileTable_LabelPart})"; + return $"{table.Schema}.{table.Name} ({SR.FileTable_LabelPart})"; } } catch @@ -63,13 +63,20 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { return "Temporal"; } + if (table != null && IsPropertySupported("IsEdge", smoContext, table, CachedSmoProperties) && table.IsEdge) + { + return "GraphEdge"; + } + if (table != null && IsPropertySupported("IsNode", smoContext, table, CachedSmoProperties) && table.IsNode) + { + return "GraphNode"; + } // TODO carbon issue 3125 enable "External" subtype once icon is ready. Otherwise will get missing icon here. // else if (table != null && IsPropertySupported("IsExternal", smoContext, table, CachedSmoProperties) && table.IsExternal) // { // return "External"; // } - // return string.Empty; - + // return string.Empty; } catch { @@ -112,7 +119,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel return "LedgerHistory"; } } - catch {} + catch { } return string.Empty; } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs index 8c1270bc..29c1a95d 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs @@ -838,6 +838,16 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Name = "IsExternal", ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand }); + properties.Add(new NodeSmoProperty + { + Name = "IsEdge", + ValidFor = ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + }); + properties.Add(new NodeSmoProperty + { + Name = "IsNode", + ValidFor = ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + }); return properties; } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml index 56f25eb4..53591657 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml @@ -90,6 +90,8 @@ + +