mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Update query editor connection display when connecting via API (#1819)
This commit is contained in:
@@ -9,9 +9,7 @@ import * as sqlops from 'sqlops';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||||
import { IConnectableInput, IConnectionManagementService, IConnectionCompletionOptions,
|
import { IConnectionManagementService, IConnectionCompletionOptions, ConnectionType, RunQueryOnConnectionMode } from 'sql/parts/connection/common/connectionManagement';
|
||||||
ConnectionType , RunQueryOnConnectionMode
|
|
||||||
} from 'sql/parts/connection/common/connectionManagement';
|
|
||||||
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||||
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
||||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
@@ -41,12 +39,13 @@ export class MainThreadQueryEditor implements MainThreadQueryEditorShape {
|
|||||||
|
|
||||||
public $connect(fileUri: string, connectionId: string): Thenable<void> {
|
public $connect(fileUri: string, connectionId: string): Thenable<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
|
let editor = this._editorService.getVisibleEditors().find(editor => editor.input.getResource().toString() === fileUri);
|
||||||
let options: IConnectionCompletionOptions = {
|
let options: IConnectionCompletionOptions = {
|
||||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none },
|
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none, input: editor ? editor.input as any : undefined },
|
||||||
saveTheConnection: false,
|
saveTheConnection: false,
|
||||||
showDashboard: false,
|
showDashboard: false,
|
||||||
showConnectionDialogOnError: true,
|
showConnectionDialogOnError: true,
|
||||||
showFirewallRuleOnError: true
|
showFirewallRuleOnError: true,
|
||||||
};
|
};
|
||||||
if (connectionId) {
|
if (connectionId) {
|
||||||
let connection = this._connectionManagementService.getActiveConnections().filter(c => c.id === connectionId);
|
let connection = this._connectionManagementService.getActiveConnections().filter(c => c.id === connectionId);
|
||||||
@@ -54,7 +53,7 @@ export class MainThreadQueryEditor implements MainThreadQueryEditorShape {
|
|||||||
this._connectionManagementService.connect(connection[0], fileUri, options).then(() => {
|
this._connectionManagementService.connect(connection[0], fileUri, options).then(() => {
|
||||||
resolve();
|
resolve();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject();
|
reject(error);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
Reference in New Issue
Block a user