mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 09:59:47 -05:00
Bring in all the extensibility updates we added during the hackathon (#2056)
Extensibility updates
This commit is contained in:
@@ -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<string[]> {
|
||||
return this._proxy.$listDatabases(connectionId);
|
||||
}
|
||||
|
||||
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||
return this._proxy.$getUriForConnection(connectionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -49,6 +49,18 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId));
|
||||
}
|
||||
|
||||
public async $listDatabases(connectionId: string): Promise<string[]> {
|
||||
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<string> {
|
||||
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;
|
||||
|
||||
@@ -101,6 +101,12 @@ export function createApiFactory(
|
||||
},
|
||||
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||
return extHostConnectionManagement.$getCredentials(connectionId);
|
||||
},
|
||||
listDatabases(connectionId: string): Thenable<string[]> {
|
||||
return extHostConnectionManagement.$listDatabases(connectionId);
|
||||
},
|
||||
getUriForConnection(connectionId: string): Thenable<string> {
|
||||
return extHostConnectionManagement.$getUriForConnection(connectionId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -473,6 +473,8 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
|
||||
$getActiveConnections(): Thenable<sqlops.connection.Connection[]>;
|
||||
$getCurrentConnection(): Thenable<sqlops.connection.Connection>;
|
||||
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
||||
$listDatabases(connectionId: string): Thenable<string[]>;
|
||||
$getUriForConnection(connectionId: string): Thenable<string>;
|
||||
}
|
||||
|
||||
export interface MainThreadCredentialManagementShape extends IDisposable {
|
||||
|
||||
Reference in New Issue
Block a user