mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -05:00
Added error handling service for providers (#21627)
* added prototype errorHandlerService * added initial contracts * Added WIP client sent request function * added WIP signature for handleOtherError to resourceProviderService * made some small fixes * removed unnecessary resourceProviderId * added updates to contracts and resourceProvider * moved error codes to azdata proposed * added connection type instead of profile * added WIP handleOtherError code * added fix for send * added WIP change password function in resource provider * added work in progress error handling thread * added errorHandler interface * added result error check * renamed errorHandling namespace to diagnostics * WIP rename of errorhandler * light cleanup * Bump json5 from 2.1.3 to 2.2.3 in /extensions/machine-learning (#21514) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Stops second invocation of createNewSession while expanding OE tree items on disconnected servers (#21437) * Debounces second invocation while expanding OE tree items * Minor clean up * Adjusts debounce time * Adding temp trace comments * Adds missing semicolon * Removes debouncer to stop 2nd newSession calls * Removes temp trace comments * Updates comment Co-authored-by: Alan Ren <alanren@microsoft.com> * Bump json5 from 2.1.3 to 2.2.3 in /extensions/admin-tool-ext-win (#21546) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix resource endpoints to end with slash (#21540) * Bump json5 from 2.1.3 to 2.2.3 in /extensions/azcli (#21543) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump json5 from 2.1.3 to 2.2.3 in /extensions/arc (#21544) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * renamed diagnostics service slightly * registered service * added work in progress diagnostics implementation * small changes * added new diagnostics exe * Changes for Diagnostics Service (#21583) Co-authored-by: Cheena Malhotra <cmalhotra@microsoft.com> * WIP provider changes * added changes for errorDiagnosticsService * removed stuff from mssql. * made fix to connectionManagementService * added error catch * added small changes * more small changes made * added small changes to handleOtherError * moved changePassword to CMS * added testErrorDiagnosticsService * Added provider-based handling for change password/generic error handling. (#21662) * WIP rework for error connection change * added connectionProfileDuringError * added working password reset * added comments * consolidated connection profile conversion * added additionalObjects parameter. * removed unnecessary error profile grab * added comments * added changes to parameters and comments * added changes and params * added handleConnectionErrorParam * added more changes * added async * added params and more * added many fixes * added updated documentation * added WIP password change dialog with await * added error handling * added comment * added options as parameters * cleaned up parameters * added async * added check fixes * Added username to title * added server name to dialog * Added dialog changes * Revert "Added dialog changes" This reverts commit c2bdcd16f4a0dffdc643ef9cae1c1a20642ac512. * Revert "added server name to dialog" This reverts commit dbd22e80461b5a068643f0c2d6728adce4010978. * Revert "Added username to title" This reverts commit 6d936b4d5f97f9345f8ec2fdbbcf6b52df18820a. * Revert "added check fixes" This reverts commit f58081a5af3276766e2042b4d671455b18add9a7. * Revert "added async" This reverts commit dd1198e26ec7542ec51add0628f588361d674299. * Revert "cleaned up parameters" This reverts commit 51135c9f9db452104697483779d8df15b6430717. * Revert "added options as parameters" This reverts commit b167804a2410558bbe60042e017ae2c77af7697f. * Revert "added comment" This reverts commit 0ad37326a3e025e88f715e3f2547be6825597a8d. * Revert "added error handling" This reverts commit 69340980d2c84056a2bcf126ea77f4b5ed4cddf3. * Revert "added WIP password change dialog with await" This reverts commit 9e43113e07b10421b39575f6c7dd14287662b90d. * added a fix to check * added fixes * added back in change password changes * added in comment * added suggested changes * removed param colons * Update extensions/mssql/src/errorDiagnostics/errorDiagnosticsProvider.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * fixed conversion and provider dialog * altered comments * Update src/sql/platform/connection/common/utils.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * renamed Id * Update src/sql/platform/connection/common/utils.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Improvements for Change password dialog + logs added (#21794) * Improvements for Change password dialog + logs added * Include server * fixed tab space * added comment --------- Co-authored-by: Alex Ma <alma1@microsoft.com> * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * added fix to id to extHostErrorDiagnostics --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lewis Sanchez <87730006+lewis-sanchez@users.noreply.github.com> Co-authored-by: Alan Ren <alanren@microsoft.com> Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Co-authored-by: Cheena Malhotra <cmalhotra@microsoft.com> Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -20,5 +20,6 @@ import './mainThreadNotebookDocumentsAndEditors';
|
||||
import './mainThreadObjectExplorer';
|
||||
import './mainThreadQueryEditor';
|
||||
import './mainThreadResourceProvider';
|
||||
import './mainThreadErrorDiagnostics';
|
||||
import './mainThreadTasks';
|
||||
import './mainThreadWorkspace';
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/br
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as TaskUtilities from 'sql/workbench/browser/taskUtilities';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { convertToRpcConnectionProfile } from 'sql/platform/connection/common/utils';
|
||||
import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
@@ -92,7 +93,7 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
||||
}
|
||||
|
||||
public $getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]> {
|
||||
return Promise.resolve(this._connectionManagementService.getConnections(activeConnectionsOnly).map(profile => this.convertToConnectionProfile(profile)));
|
||||
return Promise.resolve(this._connectionManagementService.getConnections(activeConnectionsOnly).map(profile => convertToRpcConnectionProfile(profile, true, this._connectionManagementService.removeConnectionProfileCredentials)));
|
||||
}
|
||||
|
||||
public $getConnection(uri: string): Thenable<azdata.connection.ConnectionProfile> {
|
||||
@@ -101,22 +102,7 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
let connection: azdata.connection.ConnectionProfile = {
|
||||
providerId: profile.providerName,
|
||||
connectionId: profile.id,
|
||||
connectionName: profile.connectionName,
|
||||
serverName: profile.serverName,
|
||||
databaseName: profile.databaseName,
|
||||
userName: profile.userName,
|
||||
password: profile.password,
|
||||
authenticationType: profile.authenticationType,
|
||||
savePassword: profile.savePassword,
|
||||
groupFullName: profile.groupFullName,
|
||||
groupId: profile.groupId,
|
||||
saveProfile: profile.savePassword,
|
||||
azureTenantId: profile.azureTenantId,
|
||||
options: profile.options
|
||||
};
|
||||
let connection = convertToRpcConnectionProfile(profile);
|
||||
return Promise.resolve(connection);
|
||||
}
|
||||
|
||||
@@ -129,7 +115,7 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
||||
}
|
||||
|
||||
public $getCurrentConnectionProfile(): Thenable<azdata.connection.ConnectionProfile> {
|
||||
return Promise.resolve(this.convertToConnectionProfile(TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._workbenchEditorService, true)));
|
||||
return Promise.resolve(convertToRpcConnectionProfile(TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._workbenchEditorService, true,), true, this._connectionManagementService.removeConnectionProfileCredentials));
|
||||
}
|
||||
|
||||
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||
@@ -182,6 +168,12 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
||||
return connection;
|
||||
}
|
||||
|
||||
public $openChangePasswordDialog(profile: IConnectionProfile): Thenable<string | undefined> {
|
||||
// Need to have access to getOptionsKey, so recreate profile from details.
|
||||
let convertedProfile = new ConnectionProfile(this._capabilitiesService, profile);
|
||||
return this._connectionManagementService.openChangePasswordDialog(convertedProfile);
|
||||
}
|
||||
|
||||
public async $listDatabases(connectionId: string): Promise<string[]> {
|
||||
let connectionUri = await this.$getUriForConnection(connectionId);
|
||||
let result = await this._connectionManagementService.listDatabases(connectionUri);
|
||||
@@ -209,30 +201,6 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
||||
return connection;
|
||||
}
|
||||
|
||||
private convertToConnectionProfile(profile: IConnectionProfile): azdata.connection.ConnectionProfile {
|
||||
if (!profile) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
profile = this._connectionManagementService.removeConnectionProfileCredentials(profile);
|
||||
let connection: azdata.connection.ConnectionProfile = {
|
||||
providerId: profile.providerName,
|
||||
connectionId: profile.id,
|
||||
options: deepClone(profile.options),
|
||||
connectionName: profile.connectionName,
|
||||
serverName: profile.serverName,
|
||||
databaseName: profile.databaseName,
|
||||
userName: profile.userName,
|
||||
password: profile.password,
|
||||
authenticationType: profile.authenticationType,
|
||||
savePassword: profile.savePassword,
|
||||
groupFullName: profile.groupFullName,
|
||||
groupId: profile.groupId,
|
||||
saveProfile: profile.saveProfile
|
||||
};
|
||||
return connection;
|
||||
}
|
||||
|
||||
public $connect(connectionProfile: IConnectionProfile, saveConnection: boolean = true, showDashboard: boolean = true): Thenable<azdata.ConnectionResult> {
|
||||
let profile = new ConnectionProfile(this._capabilitiesService, connectionProfile);
|
||||
profile.id = generateUuid();
|
||||
|
||||
50
src/sql/workbench/api/browser/mainThreadErrorDiagnostics.ts
Normal file
50
src/sql/workbench/api/browser/mainThreadErrorDiagnostics.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { IErrorDiagnosticsService } from 'sql/workbench/services/diagnostics/common/errorDiagnosticsService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import {
|
||||
ExtHostErrorDiagnosticsShape,
|
||||
MainThreadErrorDiagnosticsShape
|
||||
} from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
|
||||
import { SqlExtHostContext, SqlMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadErrorDiagnostics)
|
||||
export class MainThreadErrorDiagnostics extends Disposable implements MainThreadErrorDiagnosticsShape {
|
||||
private _providerMetadata: { [handle: number]: azdata.diagnostics.ErrorDiagnosticsProviderMetadata };
|
||||
private _proxy: ExtHostErrorDiagnosticsShape;
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IErrorDiagnosticsService private _errorDiagnosticsService: IErrorDiagnosticsService
|
||||
) {
|
||||
super();
|
||||
this._providerMetadata = {};
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostErrorDiagnostics);
|
||||
}
|
||||
}
|
||||
|
||||
public $registerDiagnosticsProvider(providerMetadata: azdata.diagnostics.ErrorDiagnosticsProviderMetadata, handle: number): Thenable<void> {
|
||||
let self = this;
|
||||
|
||||
//Create the error handler that interfaces with the extension via the proxy and register it
|
||||
let errorDiagnostics: azdata.diagnostics.ErrorDiagnosticsProvider = {
|
||||
handleConnectionError(errorCode: number, errorMessage: string, connection: azdata.connection.ConnectionProfile): Thenable<azdata.diagnostics.ConnectionDiagnosticsResult> {
|
||||
return self._proxy.$handleConnectionError(handle, errorCode, errorMessage, connection);
|
||||
}
|
||||
};
|
||||
this._errorDiagnosticsService.registerDiagnosticsProvider(providerMetadata.targetProviderId, errorDiagnostics);
|
||||
this._providerMetadata[handle] = providerMetadata;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $unregisterDiagnosticsProvider(handle: number): Thenable<void> {
|
||||
this._errorDiagnosticsService.unregisterDiagnosticsProvider(this._providerMetadata[handle].targetProviderId);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,10 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
|
||||
return this._proxy.$openConnectionDialog(providers, initialConnectionProfile, connectionCompletionOptions);
|
||||
}
|
||||
|
||||
public $openChangePasswordDialog(profile: azdata.IConnectionProfile): Thenable<string | undefined> {
|
||||
return this._proxy.$openChangePasswordDialog(profile);
|
||||
}
|
||||
|
||||
public $listDatabases(connectionId: string): Thenable<string[]> {
|
||||
return this._proxy.$listDatabases(connectionId);
|
||||
}
|
||||
|
||||
84
src/sql/workbench/api/common/extHostErrorDiagnostics.ts
Normal file
84
src/sql/workbench/api/common/extHostErrorDiagnostics.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { Disposable } from 'vs/workbench/api/common/extHostTypes';
|
||||
import {
|
||||
ExtHostErrorDiagnosticsShape,
|
||||
MainThreadErrorDiagnosticsShape,
|
||||
} from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { SqlMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
|
||||
export class ExtHostErrorDiagnostics extends ExtHostErrorDiagnosticsShape {
|
||||
private _handlePool: number = 0;
|
||||
private _proxy: MainThreadErrorDiagnosticsShape;
|
||||
private _providers: { [handle: number]: DiagnosticsWithMetadata } = {};
|
||||
|
||||
constructor(mainContext: IMainContext) {
|
||||
super();
|
||||
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadErrorDiagnostics);
|
||||
}
|
||||
|
||||
// PUBLIC METHODS //////////////////////////////////////////////////////
|
||||
// - MAIN THREAD AVAILABLE METHODS /////////////////////////////////////
|
||||
public override $handleConnectionError(handle: number, errorCode: number, errorMessage: string, connection: azdata.connection.ConnectionProfile): Thenable<azdata.diagnostics.ConnectionDiagnosticsResult> {
|
||||
let provider = this._providers[handle];
|
||||
if (provider === undefined) {
|
||||
return Promise.resolve({ handled: false });
|
||||
}
|
||||
else {
|
||||
return provider.provider.handleConnectionError(errorCode, errorMessage, connection);
|
||||
}
|
||||
}
|
||||
|
||||
// - EXTENSION HOST AVAILABLE METHODS //////////////////////////////////
|
||||
public $registerDiagnosticsProvider(providerMetadata: azdata.diagnostics.ErrorDiagnosticsProviderMetadata, errorDiagnostics: azdata.diagnostics.ErrorDiagnosticsProvider): Disposable {
|
||||
let self = this;
|
||||
|
||||
// Look for any diagnostic providers that have the same provider ID
|
||||
let matchingProviderIndex = values(this._providers).findIndex((provider: DiagnosticsWithMetadata) => {
|
||||
return provider.metadata.targetProviderId === providerMetadata.targetProviderId;
|
||||
});
|
||||
if (matchingProviderIndex >= 0) {
|
||||
throw new Error(`Diagnostics Provider with ID '${providerMetadata.targetProviderId}' has already been registered`);
|
||||
}
|
||||
|
||||
// Create the handle for the provider
|
||||
let handle: number = this._nextHandle();
|
||||
this._providers[handle] = {
|
||||
metadata: providerMetadata,
|
||||
provider: errorDiagnostics
|
||||
};
|
||||
|
||||
// Register the provider in the main thread via the proxy
|
||||
this._proxy.$registerDiagnosticsProvider(providerMetadata, handle);
|
||||
|
||||
// Return a disposable to cleanup the provider
|
||||
return new Disposable(() => {
|
||||
delete self._providers[handle];
|
||||
self._proxy.$unregisterDiagnosticsProvider(handle);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is for testing only, it is not exposed via the shape.
|
||||
* @return Number of providers that are currently registered
|
||||
*/
|
||||
public getProviderCount(): number {
|
||||
return Object.keys(this._providers).length;
|
||||
}
|
||||
|
||||
// PRIVATE METHODS /////////////////////////////////////////////////////
|
||||
private _nextHandle(): number {
|
||||
return this._handlePool++;
|
||||
}
|
||||
}
|
||||
|
||||
interface DiagnosticsWithMetadata {
|
||||
metadata: azdata.diagnostics.ErrorDiagnosticsProviderMetadata;
|
||||
provider: azdata.diagnostics.ErrorDiagnosticsProvider;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { ExtHostAccountManagement } from 'sql/workbench/api/common/extHostAccoun
|
||||
import { ExtHostCredentialManagement } from 'sql/workbench/api/common/extHostCredentialManagement';
|
||||
import { ExtHostDataProtocol } from 'sql/workbench/api/common/extHostDataProtocol';
|
||||
import { ExtHostResourceProvider } from 'sql/workbench/api/common/extHostResourceProvider';
|
||||
import { ExtHostErrorDiagnostics } from 'sql/workbench/api/common/extHostErrorDiagnostics';
|
||||
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ExtHostModalDialogs } from 'sql/workbench/api/common/extHostModalDialog';
|
||||
import { ExtHostTasks } from 'sql/workbench/api/common/extHostTasks';
|
||||
@@ -87,6 +88,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
const extHostDataProvider = rpcProtocol.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(rpcProtocol, uriTransformer));
|
||||
const extHostObjectExplorer = rpcProtocol.set(SqlExtHostContext.ExtHostObjectExplorer, new ExtHostObjectExplorer(rpcProtocol, commands));
|
||||
const extHostResourceProvider = rpcProtocol.set(SqlExtHostContext.ExtHostResourceProvider, new ExtHostResourceProvider(rpcProtocol));
|
||||
const extHostErrorDiagnostics = rpcProtocol.set(SqlExtHostContext.ExtHostErrorDiagnostics, new ExtHostErrorDiagnostics(rpcProtocol));
|
||||
const extHostModalDialogs = rpcProtocol.set(SqlExtHostContext.ExtHostModalDialogs, new ExtHostModalDialogs(rpcProtocol));
|
||||
const extHostTasks = rpcProtocol.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(rpcProtocol, extHostLogService));
|
||||
const extHostBackgroundTaskManagement = rpcProtocol.set(SqlExtHostContext.ExtHostBackgroundTaskManagement, new ExtHostBackgroundTaskManagement(rpcProtocol));
|
||||
@@ -136,6 +138,9 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
openConnectionDialog(providers?: string[], initialConnectionProfile?: azdata.IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Thenable<azdata.connection.Connection> {
|
||||
return extHostConnectionManagement.$openConnectionDialog(providers, initialConnectionProfile, connectionCompletionOptions);
|
||||
},
|
||||
openChangePasswordDialog(profile: azdata.IConnectionProfile): Thenable<string | undefined> {
|
||||
return extHostConnectionManagement.$openChangePasswordDialog(profile);
|
||||
},
|
||||
listDatabases(connectionId: string): Thenable<string[]> {
|
||||
return extHostConnectionManagement.$listDatabases(connectionId);
|
||||
},
|
||||
@@ -215,6 +220,13 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
}
|
||||
};
|
||||
|
||||
// namespace: diagnostics
|
||||
const diagnostics: typeof azdata.diagnostics = {
|
||||
registerDiagnosticsProvider: (providerMetadata: azdata.diagnostics.ErrorDiagnosticsProviderMetadata, errorDiagnostics: azdata.diagnostics.ErrorDiagnosticsProvider): vscode.Disposable => {
|
||||
return extHostErrorDiagnostics.$registerDiagnosticsProvider(providerMetadata, errorDiagnostics);
|
||||
}
|
||||
}
|
||||
|
||||
let registerConnectionProvider = (provider: azdata.ConnectionProvider): vscode.Disposable => {
|
||||
// Connection callbacks
|
||||
provider.registerOnConnectionComplete((connSummary: azdata.ConnectionInfoSummary) => {
|
||||
@@ -666,6 +678,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
TextType: sqlExtHostTypes.TextType,
|
||||
designers: designers,
|
||||
executionPlan: executionPlan,
|
||||
diagnostics: diagnostics,
|
||||
env
|
||||
};
|
||||
}
|
||||
|
||||
@@ -604,7 +604,16 @@ export abstract class ExtHostResourceProviderShape {
|
||||
* Handle firewall rule
|
||||
*/
|
||||
$handleFirewallRule(handle: number, errorCode: number, errorMessage: string, connectionTypeId: string): Thenable<azdata.HandleFirewallRuleResponse> { throw ni(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* ResourceProvider extension host class.
|
||||
*/
|
||||
export abstract class ExtHostErrorDiagnosticsShape {
|
||||
/**
|
||||
* Handle other connection error types
|
||||
*/
|
||||
$handleConnectionError(handle: number, errorCode: number, errorMessage: string, connection: azdata.connection.ConnectionProfile): Thenable<azdata.diagnostics.ConnectionDiagnosticsResult> { throw ni(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -646,6 +655,11 @@ export interface MainThreadResourceProviderShape extends IDisposable {
|
||||
$unregisterResourceProvider(handle: number): Thenable<any>;
|
||||
}
|
||||
|
||||
export interface MainThreadErrorDiagnosticsShape extends IDisposable {
|
||||
$registerDiagnosticsProvider(providerMetadata: azdata.diagnostics.ErrorDiagnosticsProviderMetadata, handle: number): Thenable<any>;
|
||||
$unregisterDiagnosticsProvider(handle: number): Thenable<any>;
|
||||
}
|
||||
|
||||
export interface MainThreadDataProtocolShape extends IDisposable {
|
||||
$registerConnectionProvider(providerId: string, handle: number): Promise<any>;
|
||||
$registerBackupProvider(providerId: string, handle: number): Promise<any>;
|
||||
@@ -708,6 +722,7 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
|
||||
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
||||
$getServerInfo(connectedId: string): Thenable<azdata.ServerInfo>;
|
||||
$openConnectionDialog(providers: string[], initialConnectionProfile?: azdata.IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Thenable<azdata.connection.Connection>;
|
||||
$openChangePasswordDialog(profile: azdata.IConnectionProfile): Thenable<string | undefined>;
|
||||
$listDatabases(connectionId: string): Thenable<string[]>;
|
||||
$getConnectionString(connectionId: string, includePassword: boolean): Thenable<string>;
|
||||
$getUriForConnection(connectionId: string): Thenable<string>;
|
||||
|
||||
Reference in New Issue
Block a user