[Table Designer] Only show index hash options when table is memory-optimized (#1714)

This commit is contained in:
Hai Cao
2022-09-28 10:26:59 -07:00
committed by GitHub
parent af2c0c77e7
commit 04c64223e2
5 changed files with 30 additions and 46 deletions

View File

@@ -8901,14 +8901,6 @@ namespace Microsoft.SqlTools.ServiceLayer
}
}
public static string HashIndexGroupTitle
{
get
{
return Keys.GetString(Keys.HashIndexGroupTitle);
}
}
public static string TableDesignerColumnsDisplayValueTitle
{
get
@@ -13557,9 +13549,6 @@ namespace Microsoft.SqlTools.ServiceLayer
public const string IndexBucketCountPropertyTitle = "IndexBucketCountPropertyTitle";
public const string HashIndexGroupTitle = "HashIndexGroupTitle";
public const string TableDesignerColumnsDisplayValueTitle = "TableDesignerColumnsDisplayValueTitle";

View File

@@ -4867,10 +4867,6 @@ The Query Processor estimates that implementing the following index could improv
<value>Bucket Count</value>
<comment></comment>
</data>
<data name="HashIndexGroupTitle" xml:space="preserve">
<value>Hash Index</value>
<comment></comment>
</data>
<data name="TableDesignerColumnsDisplayValueTitle" xml:space="preserve">
<value>Columns</value>
<comment></comment>

View File

@@ -2302,7 +2302,6 @@ IndexIsHashPropertyDescription = Whether the index is a hash index
IndexIsHashPropertyTitle = Is Hash
IndexBucketCountPropertyDescription = Bucket count of the hash index, note the value will always automatically round up to the next power of 2.
IndexBucketCountPropertyTitle = Bucket Count
HashIndexGroupTitle = Hash Index
TableDesignerColumnsDisplayValueTitle = Columns
ColumnStoreIndexNamePropertyTitle = Name
ColumnStoreIndexNamePropertyDescription = Name of the columnstore index

View File

@@ -6397,11 +6397,6 @@ The Query Processor estimates that implementing the following index could improv
<target state="new">Bucket Count</target>
<note></note>
</trans-unit>
<trans-unit id="HashIndexGroupTitle">
<source>Hash Index</source>
<target state="new">Hash Index</target>
<note></note>
</trans-unit>
<trans-unit id="ColumnStoreIndexNamePropertyTitle">
<source>Name</source>
<target state="new">Name</target>

View File

@@ -1111,7 +1111,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
this.SetColumnsViewInfo(view);
this.SetForeignKeysViewInfo(view);
this.SetCheckConstraintsViewInfo(view);
this.SetIndexesViewInfo(view);
this.SetIndexesViewInfo(view, tableDesigner);
this.SetColumnStoreIndexesViewInfo(view);
this.SetGraphTableViewInfo(view, tableDesigner);
this.SetEdgeConstraintsViewInfo(view, tableDesigner);
@@ -1298,7 +1298,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
view.CheckConstraintTableOptions.CanInsertRows = false;
}
private void SetIndexesViewInfo(TableDesignerView view)
private void SetIndexesViewInfo(TableDesignerView view, Dac.TableDesigner tableDesigner)
{
view.IndexTableOptions.AdditionalProperties.AddRange(new DesignerDataPropertyInfo[] {
new DesignerDataPropertyInfo()
@@ -1354,29 +1354,6 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.IsHash,
Description = SR.IndexIsHashPropertyDescription,
ComponentType = DesignerComponentType.Checkbox,
Group = SR.HashIndexGroupTitle,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.IndexIsHashPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.BucketCount,
Description = SR.IndexBucketCountPropertyDescription,
ComponentType = DesignerComponentType.Input,
Group = SR.HashIndexGroupTitle,
ComponentProperties = new InputBoxProperties()
{
Title = SR.IndexBucketCountPropertyTitle,
Width = 200
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.IncludedColumns,
Description = SR.IndexIncludedColumnsPropertyDescription,
@@ -1403,6 +1380,34 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
}
}
});
if (tableDesigner.TableViewModel.IsMemoryOptimized || tableDesigner.TableViewModel.Indexes.Items.Any(idx => idx.IsHash))
{
view.IndexTableOptions.AdditionalProperties.AddRange(new DesignerDataPropertyInfo[] {
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.IsHash,
Description = SR.IndexIsHashPropertyDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.IndexIsHashPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.BucketCount,
Description = SR.IndexBucketCountPropertyDescription,
ComponentType = DesignerComponentType.Input,
ComponentProperties = new InputBoxProperties()
{
Title = SR.IndexBucketCountPropertyTitle,
Width = 200
}
},
});
}
view.IndexTableOptions.PropertiesToDisplay = new List<string>() { IndexPropertyNames.Name, IndexPropertyNames.ColumnsDisplayValue, IndexPropertyNames.IsClustered, IndexPropertyNames.IsUnique };
view.IndexTableOptions.CanAddRows = true;
view.IndexTableOptions.CanRemoveRows = true;