Fix handling of connections in editors (#9682)

* fix handling of connections in editors

* initial tests

* remove test
This commit is contained in:
Anthony Dresser
2020-03-21 14:13:32 -07:00
committed by GitHub
parent a649461409
commit a7dbb68f7d
9 changed files with 52 additions and 41 deletions

View File

@@ -45,7 +45,7 @@ export async function scriptSelect(connectionProfile: IConnectionProfile, metada
let paramDetails: azdata.ScriptingParamDetails = getScriptingParamDetails(connectionService, connectionResult, metadata);
const result = await scriptingService.script(connectionResult, metadata, ScriptOperation.Select, paramDetails);
if (result && result.script) {
const owner = await queryEditorService.newSqlEditor(result.script);
const owner = await queryEditorService.newSqlEditor({ initalContent: result.script });
// Connect our editor to the input connection
let options: IConnectionCompletionOptions = {
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.executeQuery, input: owner },
@@ -127,7 +127,7 @@ export async function script(connectionProfile: IConnectionProfile, metadata: az
if (script) {
let description = (metadata.schema && metadata.schema !== '') ? `${metadata.schema}.${metadata.name}` : metadata.name;
const owner = await queryEditorService.newSqlEditor(script, connectionProfile.providerName, undefined, description);
const owner = await queryEditorService.newSqlEditor({ initalContent: script, description });
// Connect our editor to the input connection
let options: IConnectionCompletionOptions = {
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none, input: owner },

View File

@@ -79,10 +79,10 @@ export function getCurrentGlobalConnection(objectExplorerService: IObjectExplore
if (activeInput) {
// dashboard Connection
if (activeInput instanceof DashboardInput && activeInput.uri) {
connection = connectionManagementService.getConnectionProfile(activeInput.uri.toString());
connection = connectionManagementService.getConnectionProfile(activeInput.uri);
} else if (activeInput.resource) {
// editor Connection
connection = connectionManagementService.getConnectionProfile(activeInput.resource.toString());
connection = connectionManagementService.getConnectionProfile(activeInput.resource.toString(true));
}
}