diff --git a/product.json b/product.json index aa6c04a450..d78cfc30cd 100644 --- a/product.json +++ b/product.json @@ -43,4 +43,4 @@ "extensionsGallery": { "serviceUrl": "https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery.json" } -} \ No newline at end of file +} diff --git a/src/sql/parts/modelComponents/declarativeTable.component.ts b/src/sql/parts/modelComponents/declarativeTable.component.ts index 1ba7c09767..dc5df42f1d 100644 --- a/src/sql/parts/modelComponents/declarativeTable.component.ts +++ b/src/sql/parts/modelComponents/declarativeTable.component.ts @@ -36,10 +36,7 @@ export enum DeclarativeDataType { - {{column.displayName}} - - @@ -183,7 +180,13 @@ export default class DeclarativeTableComponent extends ComponentBase implements let cellData = this.data[row][cell]; if (cellData && column.categoryValues) { let category = column.categoryValues.find(v => v.name === cellData); - return category.displayName; + if (category) { + return category.displayName; + } else if (this.isEditableSelectBox(cell)) { + return cellData; + } else { + return undefined; + } } else { return ''; } diff --git a/src/sql/parts/modelComponents/declarativeTable.css b/src/sql/parts/modelComponents/declarativeTable.css index 1247c26eb5..a09223aa17 100644 --- a/src/sql/parts/modelComponents/declarativeTable.css +++ b/src/sql/parts/modelComponents/declarativeTable.css @@ -2,7 +2,6 @@ .declarative-table { padding: 5px 30px 0px 30px; box-sizing: border-box; - border-collapse: collapse; } diff --git a/src/sql/parts/modelComponents/table.component.ts b/src/sql/parts/modelComponents/table.component.ts index 81407f59ea..babc53fdcb 100644 --- a/src/sql/parts/modelComponents/table.component.ts +++ b/src/sql/parts/modelComponents/table.component.ts @@ -22,7 +22,7 @@ import { RowSelectionModel } from 'sql/base/browser/ui/table/plugins/rowSelectio @Component({ selector: 'modelview-table', template: ` -
+
` }) export default class TableComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit { @@ -98,7 +98,7 @@ export default class TableComponent extends ComponentBase implements IComponent, syncColumnCellResize: true, enableColumnReorder: false, enableCellNavigation: true, - forceFitColumns: true, + forceFitColumns: true }; this._table = new Table(this._inputContainer.nativeElement, this._tableData, this._tableColumns, options); @@ -178,6 +178,10 @@ export default class TableComponent extends ComponentBase implements IComponent, return this.getPropertyOrDefault((props) => props.columns, []); } + public get fontSize(): number | string { + return this.getPropertyOrDefault((props) => props.fontSize, ''); + } + public set columns(newValue: string[]) { this.setPropertyFromUI((props, value) => props.columns = value, newValue); } diff --git a/src/sql/sqlops.proposed.d.ts b/src/sql/sqlops.proposed.d.ts index 6697a7ae35..5557ebd910 100644 --- a/src/sql/sqlops.proposed.d.ts +++ b/src/sql/sqlops.proposed.d.ts @@ -376,6 +376,7 @@ declare module 'sqlops' { export interface TableComponentProperties extends ComponentProperties { data: any[][]; columns: string[] | TableColumn[]; + fontSize?: number | string; selectedRows?: number[]; } @@ -1108,4 +1109,21 @@ declare module 'sqlops' { export function startBackgroundOperation(operationInfo: BackgroundOperationInfo): void; } + + export namespace connection { + /** + * List the databases that can be accessed from the given connection + * @param {string} connectionId The ID of the connection + * @returns {string[]} An list of names of databases + */ + export function listDatabases(connectionId: string): Thenable; + + /** + * Get a URI corresponding to the given connection so that it can be used with data + * providers and other APIs that require a connection API. + * Note: If the given connection corresponds to multiple URIs this may return any of them + * @param connectionId The ID of the connection + */ + export function getUriForConnection(connectionId: string): Thenable; + } } diff --git a/src/sql/workbench/api/node/extHostConnectionManagement.ts b/src/sql/workbench/api/node/extHostConnectionManagement.ts index bf8415fa3b..f56f00b351 100644 --- a/src/sql/workbench/api/node/extHostConnectionManagement.ts +++ b/src/sql/workbench/api/node/extHostConnectionManagement.ts @@ -8,7 +8,7 @@ import { ExtHostConnectionManagementShape, SqlMainContext, MainThreadConnectionM import { IMainContext } from 'vs/workbench/api/node/extHost.protocol'; import * as sqlops from 'sqlops'; -export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape { +export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape { private _proxy: MainThreadConnectionManagementShape; @@ -27,7 +27,15 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap return this._proxy.$getCurrentConnection(); } - public $getCredentials(connectionId: string): Thenable<{ [name: string]: string}> { + public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> { return this._proxy.$getCredentials(connectionId); } + + public $listDatabases(connectionId: string): Thenable { + return this._proxy.$listDatabases(connectionId); + } + + public $getUriForConnection(connectionId: string): Thenable { + return this._proxy.$getUriForConnection(connectionId); + } } diff --git a/src/sql/workbench/api/node/extHostModelView.ts b/src/sql/workbench/api/node/extHostModelView.ts index 3340204822..81ea4d104f 100644 --- a/src/sql/workbench/api/node/extHostModelView.ts +++ b/src/sql/workbench/api/node/extHostModelView.ts @@ -847,6 +847,14 @@ class TableComponentWrapper extends ComponentWrapper implements sqlops.TableComp this.setProperty('columns', v); } + public get fontSize(): number | string { + return this.properties['fontSize']; + } + + public set fontSize(size: number | string) { + this.setProperty('fontSize', size); + } + public get selectedRows(): number[] { return this.properties['selectedRows']; } diff --git a/src/sql/workbench/api/node/mainThreadConnectionManagement.ts b/src/sql/workbench/api/node/mainThreadConnectionManagement.ts index 874698911d..c7532a7e44 100644 --- a/src/sql/workbench/api/node/mainThreadConnectionManagement.ts +++ b/src/sql/workbench/api/node/mainThreadConnectionManagement.ts @@ -49,6 +49,18 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId)); } + public async $listDatabases(connectionId: string): Promise { + let connection = this._connectionManagementService.getActiveConnections().find(profile => profile.id === connectionId); + let connectionUri = this._connectionManagementService.getConnectionId(connection); + let result = await this._connectionManagementService.listDatabases(connectionUri); + return result.databaseNames; + } + + public $getUriForConnection(connectionId: string): Thenable { + let connection = this._connectionManagementService.getActiveConnections().find(profile => profile.id === connectionId); + return Promise.resolve(this._connectionManagementService.getConnectionId(connection)); + } + private convertConnection(profile: IConnectionProfile): sqlops.connection.Connection { if (!profile) { return undefined; diff --git a/src/sql/workbench/api/node/sqlExtHost.api.impl.ts b/src/sql/workbench/api/node/sqlExtHost.api.impl.ts index 1ba29ed9db..ae67191252 100644 --- a/src/sql/workbench/api/node/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/node/sqlExtHost.api.impl.ts @@ -101,6 +101,12 @@ export function createApiFactory( }, getCredentials(connectionId: string): Thenable<{ [name: string]: string }> { return extHostConnectionManagement.$getCredentials(connectionId); + }, + listDatabases(connectionId: string): Thenable { + return extHostConnectionManagement.$listDatabases(connectionId); + }, + getUriForConnection(connectionId: string): Thenable { + return extHostConnectionManagement.$getUriForConnection(connectionId); } }; diff --git a/src/sql/workbench/api/node/sqlExtHost.protocol.ts b/src/sql/workbench/api/node/sqlExtHost.protocol.ts index cca1cf9fab..f3774ae0ee 100644 --- a/src/sql/workbench/api/node/sqlExtHost.protocol.ts +++ b/src/sql/workbench/api/node/sqlExtHost.protocol.ts @@ -473,6 +473,8 @@ export interface MainThreadConnectionManagementShape extends IDisposable { $getActiveConnections(): Thenable; $getCurrentConnection(): Thenable; $getCredentials(connectionId: string): Thenable<{ [name: string]: string }>; + $listDatabases(connectionId: string): Thenable; + $getUriForConnection(connectionId: string): Thenable; } export interface MainThreadCredentialManagementShape extends IDisposable {