mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
fix azdata connection API for dashboard connections (#9311)
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
} from 'sql/platform/connection/common/connectionManagement';
|
} from 'sql/platform/connection/common/connectionManagement';
|
||||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
|
import { DashboardInput } from 'sql/workbench/browser/editor/profiler/dashboardInput';
|
||||||
|
|
||||||
export function replaceConnection(oldUri: string, newUri: string, connectionService: IConnectionManagementService): Promise<IConnectionResult> {
|
export function replaceConnection(oldUri: string, newUri: string, connectionService: IConnectionManagementService): Promise<IConnectionResult> {
|
||||||
return new Promise<IConnectionResult>((resolve, reject) => {
|
return new Promise<IConnectionResult>((resolve, reject) => {
|
||||||
@@ -58,7 +59,7 @@ export function replaceConnection(oldUri: string, newUri: string, connectionServ
|
|||||||
*/
|
*/
|
||||||
export function getCurrentGlobalConnection(objectExplorerService: IObjectExplorerService, connectionManagementService: IConnectionManagementService, workbenchEditorService: IEditorService, topLevelOnly: boolean = false): IConnectionProfile {
|
export function getCurrentGlobalConnection(objectExplorerService: IObjectExplorerService, connectionManagementService: IConnectionManagementService, workbenchEditorService: IEditorService, topLevelOnly: boolean = false): IConnectionProfile {
|
||||||
let connection: IConnectionProfile;
|
let connection: IConnectionProfile;
|
||||||
|
// object Explorer Connection
|
||||||
let objectExplorerSelection = objectExplorerService.getSelectedProfileAndDatabase();
|
let objectExplorerSelection = objectExplorerService.getSelectedProfileAndDatabase();
|
||||||
if (objectExplorerSelection) {
|
if (objectExplorerSelection) {
|
||||||
let objectExplorerProfile = objectExplorerSelection.profile;
|
let objectExplorerProfile = objectExplorerSelection.profile;
|
||||||
@@ -76,8 +77,14 @@ export function getCurrentGlobalConnection(objectExplorerService: IObjectExplore
|
|||||||
|
|
||||||
let activeInput = workbenchEditorService.activeEditor;
|
let activeInput = workbenchEditorService.activeEditor;
|
||||||
if (activeInput) {
|
if (activeInput) {
|
||||||
|
// dashboard Connection
|
||||||
|
if (activeInput instanceof DashboardInput) {
|
||||||
|
connection = connectionManagementService.getConnectionProfile(activeInput.uri.toString());
|
||||||
|
} else {
|
||||||
|
// editor Connection
|
||||||
connection = connectionManagementService.getConnectionProfile(activeInput.resource.toString());
|
connection = connectionManagementService.getConnectionProfile(activeInput.resource.toString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user