mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
@@ -232,7 +232,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public findSqlClusterSessionBySqlConnProfile(connectionProfile: azdata.IConnectionProfile): SqlClusterSession {
|
public findSqlClusterSessionBySqlConnProfile(connectionProfile: azdata.IConnectionProfile): SqlClusterSession | undefined {
|
||||||
for (let session of this.clusterSessionMap.values()) {
|
for (let session of this.clusterSessionMap.values()) {
|
||||||
if (session.isMatchedSqlConnection(connectionProfile)) {
|
if (session.isMatchedSqlConnection(connectionProfile)) {
|
||||||
return session;
|
return session;
|
||||||
|
|||||||
@@ -21,9 +21,12 @@ const localize = nls.loadMessageBundle();
|
|||||||
|
|
||||||
export async function findSqlClusterConnection(
|
export async function findSqlClusterConnection(
|
||||||
obj: ICommandObjectExplorerContext | azdata.IConnectionProfile,
|
obj: ICommandObjectExplorerContext | azdata.IConnectionProfile,
|
||||||
appContext: AppContext): Promise<SqlClusterConnection> {
|
appContext: AppContext): Promise<SqlClusterConnection | undefined> {
|
||||||
|
|
||||||
if (!obj || !appContext) { return undefined; }
|
if (!obj || !appContext) {
|
||||||
|
console.error('SqlClusterLookup::findSqlClusterConnection - No context available');
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
let sqlConnProfile: azdata.IConnectionProfile;
|
let sqlConnProfile: azdata.IConnectionProfile;
|
||||||
if ('type' in obj && obj.type === constants.ObjectExplorerService
|
if ('type' in obj && obj.type === constants.ObjectExplorerService
|
||||||
@@ -36,18 +39,29 @@ export async function findSqlClusterConnection(
|
|||||||
let sqlClusterConnection: SqlClusterConnection = undefined;
|
let sqlClusterConnection: SqlClusterConnection = undefined;
|
||||||
if (sqlConnProfile) {
|
if (sqlConnProfile) {
|
||||||
sqlClusterConnection = await findSqlClusterConnectionBySqlConnProfile(sqlConnProfile, appContext);
|
sqlClusterConnection = await findSqlClusterConnectionBySqlConnProfile(sqlConnProfile, appContext);
|
||||||
|
} else {
|
||||||
|
console.error('SqlClusterLookup::findSqlClusterConnection - No connection profile');
|
||||||
}
|
}
|
||||||
return sqlClusterConnection;
|
return sqlClusterConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findSqlClusterConnectionBySqlConnProfile(sqlConnProfile: azdata.IConnectionProfile, appContext: AppContext): Promise<SqlClusterConnection> {
|
async function findSqlClusterConnectionBySqlConnProfile(sqlConnProfile: azdata.IConnectionProfile, appContext: AppContext): Promise<SqlClusterConnection | undefined> {
|
||||||
if (!sqlConnProfile || !appContext) { return undefined; }
|
if (!sqlConnProfile || !appContext) {
|
||||||
|
console.error('SqlClusterLookup::findSqlClusterConnectionBySqlConnProfile - No context available');
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
let sqlOeNodeProvider = appContext.getService<MssqlObjectExplorerNodeProvider>(constants.ObjectExplorerService);
|
let sqlOeNodeProvider = appContext.getService<MssqlObjectExplorerNodeProvider>(constants.ObjectExplorerService);
|
||||||
if (!sqlOeNodeProvider) { return undefined; }
|
if (!sqlOeNodeProvider) {
|
||||||
|
console.error('SqlClusterLookup::findSqlClusterConnectionBySqlConnProfile - No OE Node Provider available');
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
let sqlClusterSession = sqlOeNodeProvider.findSqlClusterSessionBySqlConnProfile(sqlConnProfile);
|
let sqlClusterSession = sqlOeNodeProvider.findSqlClusterSessionBySqlConnProfile(sqlConnProfile);
|
||||||
if (!sqlClusterSession) { return undefined; }
|
if (!sqlClusterSession) {
|
||||||
|
console.error('SqlClusterLookup::findSqlClusterConnectionBySqlConnProfile - No SQL Cluster Session found');
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
return sqlClusterSession.getSqlClusterConnection();
|
return sqlClusterSession.getSqlClusterConnection();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user