From 0738c148ca5fc3b056d84df0f754885b3d606888 Mon Sep 17 00:00:00 2001 From: Hai Cao Date: Fri, 8 Apr 2022 15:00:56 -0700 Subject: [PATCH] A few table designer improvements && bump STS to .227 (#18982) * Add unified col for data type deit * remove seperate type setting cols and rename unified col to 'type' * remove advanced type from properties window * add description to col, idx, constraints * nit * bump STS to .227 --- extensions/mssql/config.json | 2 +- src/sql/azdata.proposed.d.ts | 8 ++- .../workbench/api/common/sqlExtHostTypes.ts | 6 ++ .../browser/tableDesignerComponentInput.ts | 58 +++++++++++++++++-- 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/extensions/mssql/config.json b/extensions/mssql/config.json index 59d9c4dcb3..97c72f710b 100644 --- a/extensions/mssql/config.json +++ b/extensions/mssql/config.json @@ -1,6 +1,6 @@ { "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", - "version": "3.0.0-release.226", + "version": "3.0.0-release.227", "downloadFileNames": { "Windows_86": "win-x86-net6.0.zip", "Windows_64": "win-x64-net6.0.zip", diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index b7187be748..bb4902e6e4 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -807,6 +807,7 @@ declare module 'azdata' { CheckConstraints = 'checkConstraints', Indexes = 'indexes', PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', PrimaryKeyColumns = 'primaryKeyColumns' } /** @@ -818,7 +819,9 @@ declare module 'azdata' { DefaultValue = 'defaultValue', Length = 'length', Name = 'name', + Description = 'description', Type = 'type', + AdvancedType = 'advancedType', IsPrimaryKey = 'isPrimaryKey', Precision = 'precision', Scale = 'scale' @@ -830,6 +833,7 @@ declare module 'azdata' { */ export enum TableForeignKeyProperty { Name = 'name', + Description = 'description', ForeignTable = 'foreignTable', OnDeleteAction = 'onDeleteAction', OnUpdateAction = 'onUpdateAction', @@ -850,6 +854,7 @@ declare module 'azdata' { */ export enum TableCheckConstraintProperty { Name = 'name', + Description = 'description', Expression = 'expression' } @@ -859,6 +864,7 @@ declare module 'azdata' { */ export enum TableIndexProperty { Name = 'name', + Description = 'description', Columns = 'columns' } @@ -924,7 +930,7 @@ declare module 'azdata' { */ primaryKeyColumnSpecificationTableOptions?: TableDesignerBuiltInTableViewOptions; /** - * Additional primary key properties. Common primary key properties: primaryKeyName. + * Additional primary key properties. Common primary key properties: primaryKeyName, primaryKeyDescription. */ additionalPrimaryKeyProperties?: DesignerDataPropertyInfo[]; } diff --git a/src/sql/workbench/api/common/sqlExtHostTypes.ts b/src/sql/workbench/api/common/sqlExtHostTypes.ts index 003d03c10e..b41ccdbbdc 100644 --- a/src/sql/workbench/api/common/sqlExtHostTypes.ts +++ b/src/sql/workbench/api/common/sqlExtHostTypes.ts @@ -971,11 +971,14 @@ export namespace designers { CheckConstraints = 'checkConstraints', Indexes = 'indexes', PrimaryKeyName = 'primaryKeyName', + PrimaryKeyDescription = 'primaryKeyDescription', PrimaryKeyColumns = 'primaryKeyColumns' } export enum TableColumnProperty { Name = 'name', + Description = 'description', + AdvancedType = 'advancedType', Type = 'type', AllowNulls = 'allowNulls', DefaultValue = 'defaultValue', @@ -987,6 +990,7 @@ export namespace designers { export enum TableForeignKeyProperty { Name = 'name', + Description = 'description', ForeignTable = 'foreignTable', OnDeleteAction = 'onDeleteAction', OnUpdateAction = 'onUpdateAction', @@ -1000,11 +1004,13 @@ export namespace designers { export enum TableCheckConstraintProperty { Name = 'name', + Description = 'description', Expression = 'expression' } export enum TableIndexProperty { Name = 'name', + Description = 'description', Columns = 'columns' } diff --git a/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts b/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts index 9c19b29953..119502471c 100644 --- a/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts +++ b/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts @@ -197,7 +197,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput { reportNotificationHandle.close(); this.updateState(this.valid, this.dirty); } catch (error) { - this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.generatePreviewReportError', "An error occured while generating preview report: {0}", error?.message ?? error)); + this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.generatePreviewReportError', "An error occurred while generating preview report: {0}", error?.message ?? error)); this.updateState(this.valid, this.dirty); this._adsTelemetryService.createErrorEvent(TelemetryView.TableDesigner, TelemetryAction.GeneratePreviewReport).withAdditionalProperties(telemetryInfo).send(); return; @@ -253,7 +253,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput { this.doInitialization(result); this._onInitialized.fire(); }, error => { - this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.errorInitializingTableDesigner', "An error occured while initializing the table designer: {0}", error?.message ?? error)); + this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.errorInitializingTableDesigner', "An error occurred while initializing the table designer: {0}", error?.message ?? error)); }); } @@ -345,6 +345,23 @@ export class TableDesignerComponentInput implements DesignerComponentInput { title: localize('tableDesigner.columnNameTitle', "Name"), width: 150 } + }, { + componentType: 'input', + propertyName: designers.TableColumnProperty.Description, + description: localize('designer.column.description.description', "Displays the description of the column"), + componentProperties: { + title: localize('tableDesigner.columnDescriptionTitle', "Description"), + } + }, { + componentType: 'dropdown', + propertyName: designers.TableColumnProperty.AdvancedType, + showInPropertiesView: false, + description: localize('designer.column.description.advancedType', "Displays the unified data type (including length, scale and precision) for the column"), + componentProperties: { + title: localize('tableDesigner.columnAdvancedTypeTitle', "Type"), + width: 120, + isEditable: true + } }, { componentType: 'dropdown', propertyName: designers.TableColumnProperty.Type, @@ -406,10 +423,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput { const displayProperties = this.getTableDisplayProperties(options, [ designers.TableColumnProperty.Name, - designers.TableColumnProperty.Type, - designers.TableColumnProperty.Length, - designers.TableColumnProperty.Precision, - designers.TableColumnProperty.Scale, + designers.TableColumnProperty.AdvancedType, designers.TableColumnProperty.IsPrimaryKey, designers.TableColumnProperty.AllowNulls, designers.TableColumnProperty.DefaultValue, @@ -469,6 +483,14 @@ export class TableDesignerComponentInput implements DesignerComponentInput { width: 300 } }, + { + componentType: 'input', + propertyName: designers.TableForeignKeyProperty.Description, + description: localize('designer.foreignkey.description.description', "The description of the foreign key."), + componentProperties: { + title: localize('tableDesigner.foreignKeyDescriptionTitle', "Description"), + } + }, { componentType: 'dropdown', propertyName: designers.TableForeignKeyProperty.ForeignTable, @@ -559,6 +581,15 @@ export class TableDesignerComponentInput implements DesignerComponentInput { componentProperties: { title: localize('tableDesigner.primaryKeyNameTitle', "Name") } + }, + { + componentType: 'input', + propertyName: designers.TableProperty.PrimaryKeyDescription, + showInPropertiesView: false, + description: localize('designer.table.primaryKeyDescription.description', "The description of the primary key."), + componentProperties: { + title: localize('tableDesigner.primaryKeyDescriptionTitle', "Description"), + } }); if (view.additionalPrimaryKeyProperties) { view.additionalPrimaryKeyProperties.forEach(component => { @@ -602,6 +633,13 @@ export class TableDesignerComponentInput implements DesignerComponentInput { title: localize('tableDesigner.checkConstraintNameTitle', "Name"), width: 200 } + }, { + componentType: 'input', + propertyName: designers.TableCheckConstraintProperty.Description, + description: localize('designer.checkConstraint.description.description', "The description of the check constraint."), + componentProperties: { + title: localize('tableDesigner.checkConstraintDescriptionTitle', "Description"), + } }, { componentType: 'input', propertyName: designers.TableCheckConstraintProperty.Expression, @@ -656,6 +694,14 @@ export class TableDesignerComponentInput implements DesignerComponentInput { title: localize('tableDesigner.indexName', "Name"), width: 200 } + }, { + componentType: 'input', + propertyName: designers.TableIndexProperty.Description, + description: localize('designer.index.description.description', "The description of the index."), + componentProperties: { + title: localize('tableDesigner.indexDescription', "Description"), + width: 200 + } }, { componentType: 'table', propertyName: designers.TableIndexProperty.Columns,