diff --git a/extensions/mssql/src/constants.ts b/extensions/mssql/src/constants.ts index cd5a92ea5e..f415329b73 100644 --- a/extensions/mssql/src/constants.ts +++ b/extensions/mssql/src/constants.ts @@ -65,10 +65,6 @@ export enum MssqlClusterItemsSubType { Spark = ':spark:' } -export enum TableType { - Basic = 'basic' -} - // SPARK JOB SUBMISSION ////////////////////////////////////////////////////////// export const mssqlClusterNewNotebookTask = 'mssqlCluster.task.newNotebook'; export const mssqlClusterOpenNotebookTask = 'mssqlCluster.task.openNotebook'; diff --git a/extensions/mssql/src/tableDesigner/tableDesigner.ts b/extensions/mssql/src/tableDesigner/tableDesigner.ts index c21eb02f23..fdd573db33 100644 --- a/extensions/mssql/src/tableDesigner/tableDesigner.ts +++ b/extensions/mssql/src/tableDesigner/tableDesigner.ts @@ -6,21 +6,23 @@ import { AppContext } from '../appContext'; import * as azdata from 'azdata'; import * as vscode from 'vscode'; -import { sqlProviderName, TableType } from '../constants'; +import { sqlProviderName } from '../constants'; import { generateUuid } from 'vscode-languageclient/lib/utils/uuid'; import { ITelemetryEventProperties, Telemetry } from '../telemetry'; export function registerTableDesignerCommands(appContext: AppContext) { appContext.extensionContext.subscriptions.push(vscode.commands.registerCommand('mssql.newTable', async (context: azdata.ObjectExplorerContext) => { const connectionString = await azdata.connection.getConnectionString(context.connectionProfile.id, true); - const telemetryInfo = await getTelemetryInfo(context, TableType.Basic); + const tableIcon = context.nodeInfo.nodeSubType as azdata.designers.TableIcon; + const telemetryInfo = await getTelemetryInfo(context, tableIcon); await azdata.designers.openTableDesigner(sqlProviderName, { server: context.connectionProfile.serverName, database: context.connectionProfile.databaseName, isNewTable: true, id: generateUuid(), connectionString: connectionString, - accessToken: context.connectionProfile.options.azureAccountToken + accessToken: context.connectionProfile.options.azureAccountToken, + tableIcon: tableIcon }, telemetryInfo); })); @@ -30,7 +32,8 @@ export function registerTableDesignerCommands(appContext: AppContext) { const schema = context.nodeInfo.metadata.schema; const name = context.nodeInfo.metadata.name; const connectionString = await azdata.connection.getConnectionString(context.connectionProfile.id, true); - const telemetryInfo = await getTelemetryInfo(context, TableType.Basic); + const tableIcon = context.nodeInfo.nodeSubType as azdata.designers.TableIcon; + const telemetryInfo = await getTelemetryInfo(context, tableIcon); await azdata.designers.openTableDesigner(sqlProviderName, { server: server, database: database, @@ -39,7 +42,8 @@ export function registerTableDesignerCommands(appContext: AppContext) { schema: schema, id: `${sqlProviderName}|${server}|${database}|${schema}|${name}`, connectionString: connectionString, - accessToken: context.connectionProfile.options.azureAccountToken + accessToken: context.connectionProfile.options.azureAccountToken, + tableIcon: tableIcon }, telemetryInfo); })); } diff --git a/extensions/theme-seti/icons/images/table.svg b/extensions/theme-seti/icons/images/table-basic.svg similarity index 100% rename from extensions/theme-seti/icons/images/table.svg rename to extensions/theme-seti/icons/images/table-basic.svg diff --git a/extensions/theme-seti/icons/images/table-graphedge.svg b/extensions/theme-seti/icons/images/table-graphedge.svg new file mode 100644 index 0000000000..781181ab87 --- /dev/null +++ b/extensions/theme-seti/icons/images/table-graphedge.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + diff --git a/extensions/theme-seti/icons/images/table-graphnode.svg b/extensions/theme-seti/icons/images/table-graphnode.svg new file mode 100644 index 0000000000..1d68bad781 --- /dev/null +++ b/extensions/theme-seti/icons/images/table-graphnode.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/extensions/theme-seti/icons/images/table-temporal.svg b/extensions/theme-seti/icons/images/table-temporal.svg new file mode 100644 index 0000000000..c6550c0885 --- /dev/null +++ b/extensions/theme-seti/icons/images/table-temporal.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/extensions/theme-seti/icons/vs-seti-icon-theme.json b/extensions/theme-seti/icons/vs-seti-icon-theme.json index 2e26306b7a..d18512a88e 100644 --- a/extensions/theme-seti/icons/vs-seti-icon-theme.json +++ b/extensions/theme-seti/icons/vs-seti-icon-theme.json @@ -1518,8 +1518,17 @@ "scmp_dark": { "iconPath": "./images/scmp_inverse.svg" }, - "table-designer": { - "iconPath": "./images/table.svg" + "table-basic": { + "iconPath": "./images/table-basic.svg" + }, + "table-temporal": { + "iconPath": "./images/table-temporal.svg" + }, + "table-graphnode": { + "iconPath": "./images/table-graphnode.svg" + }, + "table-graphedge": { + "iconPath": "./images/table-graphedge.svg" } }, "file": "_default", @@ -1818,7 +1827,10 @@ "dashboard": "_shell", "profiler": "_csv", "Schema Compare": "scmp_dark", - "table-designer": "table-designer" + "table-basic": "table-basic", + "table-temporal": "table-temporal", + "table-graphnode": "table-graphnode", + "table-graphedge": "table-graphedge" }, "languageIds": { "bat": "_windows", diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 3a3cff1783..3a4375eb9f 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -743,6 +743,11 @@ declare module 'azdata' { * Extension can store additional information that the provider needs to uniquely identify a table. */ [key: string]: any; + /** + * Table icon type that's shown in the editor tab. Default is the basic + * table icon. + */ + tableIcon?: TableIcon; } /** @@ -759,6 +764,16 @@ declare module 'azdata' { viewModel: DesignerViewModel; } + /** + * Table icon that's shown on the editor tab + */ + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphNode = 'GraphNode', + GraphEdge = 'GraphEdge' + } + /** * Name of the common table properties. * Extensions can use the names to access the designer view model. diff --git a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts index acfcc5f366..2ec19cc4ac 100644 --- a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts @@ -587,6 +587,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp TableIndexProperty: sqlExtHostTypes.designers.TableIndexProperty, TableIndexColumnSpecificationProperty: sqlExtHostTypes.designers.TableIndexColumnSpecificationProperty, DesignerEditType: sqlExtHostTypes.designers.DesignerEditType, + TableIcon: sqlExtHostTypes.designers.TableIcon, openTableDesigner(providerId, tableInfo: azdata.designers.TableInfo, telemetryInfo?: ITelemetryEventProperties): Promise { return extHostDataProvider.$openTableDesigner(providerId, tableInfo, telemetryInfo); } diff --git a/src/sql/workbench/api/common/sqlExtHostTypes.ts b/src/sql/workbench/api/common/sqlExtHostTypes.ts index c2ec95a67a..3ad5ad8d76 100644 --- a/src/sql/workbench/api/common/sqlExtHostTypes.ts +++ b/src/sql/workbench/api/common/sqlExtHostTypes.ts @@ -544,6 +544,8 @@ export class SqlThemeIcon { static readonly ExternalTable = new SqlThemeIcon('ExternalTable'); static readonly ColumnMasterKey = new SqlThemeIcon('ColumnMasterKey'); static readonly ColumnEncryptionKey = new SqlThemeIcon('ColumnEncryptionKey'); + static readonly GraphEdge = new SqlThemeIcon('GraphEdge'); + static readonly GraphNode = new SqlThemeIcon('GraphNode'); public readonly id: string; @@ -1014,4 +1016,11 @@ export namespace designers { Remove = 1, Update = 2 } + + export enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphEdge = 'GraphEdge', + GraphNode = 'GraphNode' + } } diff --git a/src/sql/workbench/browser/editor/tableDesigner/tableDesignerInput.ts b/src/sql/workbench/browser/editor/tableDesigner/tableDesignerInput.ts index b05f47b544..726cc28696 100644 --- a/src/sql/workbench/browser/editor/tableDesigner/tableDesignerInput.ts +++ b/src/sql/workbench/browser/editor/tableDesigner/tableDesignerInput.ts @@ -18,11 +18,25 @@ import { INotificationService } from 'vs/platform/notification/common/notificati const NewTable: string = localize('tableDesigner.newTable', "New Table"); +enum TableIcon { + Basic = 'Basic', + Temporal = 'Temporal', + GraphEdge = 'GraphEdge', + GraphNode = 'GraphNode' +} export class TableDesignerInput extends EditorInput { public static ID: string = 'workbench.editorinputs.tableDesignerInput'; private _designerComponentInput: TableDesignerComponentInput; private _title: string; private _name: string; + private _tableIcon: azdata.designers.TableIcon; + private _tableIconMap: Map = new Map([ + [TableIcon.Basic, 'table-basic'], + [TableIcon.Temporal, 'table-temporal'], + [TableIcon.GraphEdge, 'table-graphedge'], + [TableIcon.GraphNode, 'table-graphnode'] + ]); + constructor( private _provider: TableDesignerProvider, @@ -42,6 +56,7 @@ export class TableDesignerInput extends EditorInput { this._onDidChangeDirty.fire(); } })); + this._tableIcon = tableInfo.tableIcon.toString() === '' ? TableIcon.Basic : tableInfo.tableIcon as TableIcon; this.setEditorLabel(); } @@ -52,7 +67,7 @@ export class TableDesignerInput extends EditorInput { public get resource(): URI { return URI.from({ scheme: Schemas.tableDesigner, - path: 'table-designer' + path: this._tableIconMap.get(this._tableIcon) }); } diff --git a/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/Table_GraphEdge.svg b/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/Table_GraphEdge.svg new file mode 100644 index 0000000000..781181ab87 --- /dev/null +++ b/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/Table_GraphEdge.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/Table_GraphNode.svg b/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/Table_GraphNode.svg new file mode 100644 index 0000000000..1d68bad781 --- /dev/null +++ b/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/Table_GraphNode.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/objecttypes.css b/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/objecttypes.css index af5ef46917..96fb6ad090 100644 --- a/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/objecttypes.css +++ b/src/sql/workbench/services/objectExplorer/browser/media/objectTypes/objecttypes.css @@ -579,6 +579,19 @@ background: url("Table_Temporal.svg") center center no-repeat; } +.vs .icon.table_graphnode, +.vs-dark .icon.table_graphnode, +.hc-black .icon.table_graphnode { + background: url("Table_GraphNode.svg") center center no-repeat; +} + +.vs .icon.table_graphedge, +.vs-dark .icon.table_graphedge, +.hc-black .icon.table_graphedge { + background: url("Table_GraphEdge.svg") center center no-repeat; +} + + .vs .icon.trigger, .vs-dark .icon.trigger, .hc-black .icon.trigger {