[Table Designer] Support hash index and column store index (#20562)

This commit is contained in:
Hai Cao
2022-09-08 11:39:36 -07:00
committed by GitHub
parent f38077069c
commit 40b2c1e74e
4 changed files with 56 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{ {
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.3.0.15", "version": "4.3.0.18",
"downloadFileNames": { "downloadFileNames": {
"Windows_86": "win-x86-net6.0.zip", "Windows_86": "win-x86-net6.0.zip",
"Windows_64": "win-x64-net6.0.zip", "Windows_64": "win-x64-net6.0.zip",

View File

@@ -817,6 +817,7 @@ declare module 'azdata' {
ForeignKeys = 'foreignKeys', ForeignKeys = 'foreignKeys',
CheckConstraints = 'checkConstraints', CheckConstraints = 'checkConstraints',
Indexes = 'indexes', Indexes = 'indexes',
PrimaryKey = 'primaryKey',
PrimaryKeyName = 'primaryKeyName', PrimaryKeyName = 'primaryKeyName',
PrimaryKeyDescription = 'primaryKeyDescription', PrimaryKeyDescription = 'primaryKeyDescription',
PrimaryKeyColumns = 'primaryKeyColumns' PrimaryKeyColumns = 'primaryKeyColumns'
@@ -944,6 +945,10 @@ declare module 'azdata' {
* Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription.
*/ */
additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[];
/**
* Components to be placed under the pre-defined tabs.
*/
additionalComponents?: DesignerDataPropertyWithTabInfo[];
/** /**
* Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes. * Whether to use advanced save mode. for advanced save mode, a publish changes dialog will be opened with preview of changes.
*/ */
@@ -1016,6 +1021,16 @@ declare module 'azdata' {
componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; componentProperties: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties;
} }
/**
* The definition of the property in the designer with tab info.
*/
export interface DesignerDataPropertyWithTabInfo extends DesignerDataPropertyInfo {
/**
* The tab info where this property belongs to.
*/
tab: TableProperty.Columns | TableProperty.PrimaryKey | TableProperty.ForeignKeys | TableProperty.CheckConstraints | TableProperty.Indexes;
}
/** /**
* The child component types supported by designer. * The child component types supported by designer.
*/ */

View File

@@ -972,6 +972,7 @@ export namespace designers {
ForeignKeys = 'foreignKeys', ForeignKeys = 'foreignKeys',
CheckConstraints = 'checkConstraints', CheckConstraints = 'checkConstraints',
Indexes = 'indexes', Indexes = 'indexes',
PrimaryKey = 'primaryKey',
PrimaryKeyName = 'primaryKeyName', PrimaryKeyName = 'primaryKeyName',
PrimaryKeyDescription = 'primaryKeyDescription', PrimaryKeyDescription = 'primaryKeyDescription',
PrimaryKeyColumns = 'primaryKeyColumns' PrimaryKeyColumns = 'primaryKeyColumns'

View File

@@ -327,21 +327,21 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
const tabs = []; const tabs = [];
if (tableDesignerView.columnTableOptions?.showTable) { if (tableDesignerView.columnTableOptions?.showTable) {
tabs.push(this.getColumnsTab(tableDesignerView.columnTableOptions)); tabs.push(this.getColumnsTab(tableDesignerView.columnTableOptions, tableDesignerView.additionalComponents));
} }
tabs.push(this.getPrimaryKeyTab(tableDesignerView)); tabs.push(this.getPrimaryKeyTab(tableDesignerView, tableDesignerView.additionalComponents));
if (tableDesignerView.foreignKeyTableOptions?.showTable) { if (tableDesignerView.foreignKeyTableOptions?.showTable) {
tabs.push(this.getForeignKeysTab(tableDesignerView.foreignKeyTableOptions, tableDesignerView.foreignKeyColumnMappingTableOptions)); tabs.push(this.getForeignKeysTab(tableDesignerView.foreignKeyTableOptions, tableDesignerView.foreignKeyColumnMappingTableOptions, tableDesignerView.additionalComponents));
} }
if (tableDesignerView.checkConstraintTableOptions?.showTable) { if (tableDesignerView.checkConstraintTableOptions?.showTable) {
tabs.push(this.getCheckConstraintsTab(tableDesignerView.checkConstraintTableOptions)); tabs.push(this.getCheckConstraintsTab(tableDesignerView.checkConstraintTableOptions, tableDesignerView.additionalComponents));
} }
if (tableDesignerView.indexTableOptions?.showTable) { if (tableDesignerView.indexTableOptions?.showTable) {
tabs.push(this.getIndexesTab(tableDesignerView.indexTableOptions, tableDesignerView.indexColumnSpecificationTableOptions)); tabs.push(this.getIndexesTab(tableDesignerView.indexTableOptions, tableDesignerView.indexColumnSpecificationTableOptions, tableDesignerView.additionalComponents));
} }
if (tableDesignerView.additionalTabs) { if (tableDesignerView.additionalTabs) {
@@ -393,7 +393,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
}; };
} }
private getColumnsTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions): DesignerTab { private getColumnsTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions, additionalComponents: azdata.designers.DesignerDataPropertyWithTabInfo[]): DesignerTab {
const columnProperties: DesignerDataPropertyInfo[] = [ const columnProperties: DesignerDataPropertyInfo[] = [
{ {
@@ -488,7 +488,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
designers.TableColumnProperty.DefaultValue, designers.TableColumnProperty.DefaultValue,
]); ]);
return <DesignerTab>{ const tab = <DesignerTab>{
title: localize('tableDesigner.columnsTabTitle', "Columns"), title: localize('tableDesigner.columnsTabTitle', "Columns"),
components: [ components: [
{ {
@@ -511,9 +511,11 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
] ]
}; };
this.appendAdditionalComponents(tab, additionalComponents, designers.TableProperty.Columns);
return tab;
} }
private getForeignKeysTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions, columnMappingTableOptions: azdata.designers.TableDesignerBuiltInTableViewOptions): DesignerTab { private getForeignKeysTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions, columnMappingTableOptions: azdata.designers.TableDesignerBuiltInTableViewOptions, additionalComponents: azdata.designers.DesignerDataPropertyWithTabInfo[]): DesignerTab {
const foreignKeyColumnMappingProperties: DesignerDataPropertyInfo[] = [ const foreignKeyColumnMappingProperties: DesignerDataPropertyInfo[] = [
{ {
@@ -596,7 +598,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
]; ];
return <DesignerTab>{ const tab = <DesignerTab>{
title: localize('tableDesigner.foreignKeysTabTitle', "Foreign Keys"), title: localize('tableDesigner.foreignKeysTabTitle', "Foreign Keys"),
components: [ components: [
{ {
@@ -617,9 +619,11 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
] ]
}; };
this.appendAdditionalComponents(tab, additionalComponents, designers.TableProperty.ForeignKeys);
return tab;
} }
private getPrimaryKeyTab(view: azdata.designers.TableDesignerView): DesignerTab { private getPrimaryKeyTab(view: azdata.designers.TableDesignerView, additionalComponents: azdata.designers.DesignerDataPropertyWithTabInfo[]): DesignerTab {
const options = view.primaryKeyColumnSpecificationTableOptions; const options = view.primaryKeyColumnSpecificationTableOptions;
const columnSpecProperties: DesignerDataPropertyInfo[] = [ const columnSpecProperties: DesignerDataPropertyInfo[] = [
{ {
@@ -678,13 +682,15 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
}); });
return <DesignerTab>{ const tab = <DesignerTab>{
title: localize('tableDesigner.PrimaryKeyTabTitle', "Primary Key"), title: localize('tableDesigner.PrimaryKeyTabTitle', "Primary Key"),
components: tabComponents components: tabComponents
}; };
this.appendAdditionalComponents(tab, additionalComponents, designers.TableProperty.PrimaryKey);
return tab;
} }
private getCheckConstraintsTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions): DesignerTab { private getCheckConstraintsTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions, additionalComponents: azdata.designers.DesignerDataPropertyWithTabInfo[]): DesignerTab {
const checkConstraintProperties: DesignerDataPropertyInfo[] = [ const checkConstraintProperties: DesignerDataPropertyInfo[] = [
{ {
componentType: 'input', componentType: 'input',
@@ -712,7 +718,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
]; ];
return <DesignerTab>{ const tab = <DesignerTab>{
title: localize('tableDesigner.checkConstraintsTabTitle', "Check Constraints"), title: localize('tableDesigner.checkConstraintsTabTitle', "Check Constraints"),
components: [ components: [
{ {
@@ -733,9 +739,11 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
] ]
}; };
this.appendAdditionalComponents(tab, additionalComponents, designers.TableProperty.CheckConstraints);
return tab;
} }
private getIndexesTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions, columnSpecTableOptions: azdata.designers.TableDesignerBuiltInTableViewOptions): DesignerTab { private getIndexesTab(options: azdata.designers.TableDesignerBuiltInTableViewOptions, columnSpecTableOptions: azdata.designers.TableDesignerBuiltInTableViewOptions, additionalComponents: azdata.designers.DesignerDataPropertyWithTabInfo[]): DesignerTab {
const columnSpecProperties: DesignerDataPropertyInfo[] = [ const columnSpecProperties: DesignerDataPropertyInfo[] = [
{ {
componentType: 'dropdown', componentType: 'dropdown',
@@ -782,7 +790,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
]; ];
return <DesignerTab>{ const tab = <DesignerTab>{
title: localize('tableDesigner.indexesTabTitle', "Indexes"), title: localize('tableDesigner.indexesTabTitle', "Indexes"),
components: [ components: [
{ {
@@ -803,6 +811,22 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
} }
] ]
}; };
this.appendAdditionalComponents(tab, additionalComponents, designers.TableProperty.Indexes);
return tab;
}
private appendAdditionalComponents(tab: DesignerTab, components: azdata.designers.DesignerDataPropertyWithTabInfo[], tabInfo: designers.TableProperty.Columns | designers.TableProperty.PrimaryKey | designers.TableProperty.ForeignKeys | designers.TableProperty.CheckConstraints | designers.TableProperty.Indexes) {
const additionalTables = this.getAdditionalComponentsForTab(components, tabInfo);
if (additionalTables) {
tab.components.push(...additionalTables);
}
}
private getAdditionalComponentsForTab(components: azdata.designers.DesignerDataPropertyWithTabInfo[], tab: designers.TableProperty.Columns | designers.TableProperty.PrimaryKey | designers.TableProperty.ForeignKeys | designers.TableProperty.CheckConstraints | designers.TableProperty.Indexes): azdata.designers.DesignerDataPropertyInfo[] {
if (components) {
return components.filter(c => c.tab === tab);
}
return [];
} }
private getTableDisplayProperties(options: azdata.designers.TableDesignerBuiltInTableViewOptions, defaultProperties: string[]): string[] { private getTableDisplayProperties(options: azdata.designers.TableDesignerBuiltInTableViewOptions, defaultProperties: string[]): string[] {