mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
Migrate cert validation error handling to mssql extension (#21829)
This commit is contained in:
@@ -34,8 +34,8 @@ export class MainThreadErrorDiagnostics extends Disposable implements MainThread
|
||||
|
||||
//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);
|
||||
handleConnectionError(errorInfo: azdata.diagnostics.IErrorInformation, connection: azdata.connection.ConnectionProfile): Thenable<azdata.diagnostics.ConnectionDiagnosticsResult> {
|
||||
return self._proxy.$handleConnectionError(handle, errorInfo, connection);
|
||||
}
|
||||
};
|
||||
this._errorDiagnosticsService.registerDiagnosticsProvider(providerMetadata.targetProviderId, errorDiagnostics);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { MainThreadModelViewDialogShape, ExtHostModelViewDialogShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { Dialog, DialogTab, DialogButton, WizardPage, Wizard } from 'sql/workbench/services/dialog/common/dialogTypes';
|
||||
import { CustomDialogService, DefaultWizardOptions, DefaultDialogOptions } from 'sql/workbench/services/dialog/browser/customDialogService';
|
||||
import { IModelViewDialogDetails, IModelViewTabDetails, IModelViewButtonDetails, IModelViewWizardPageDetails, IModelViewWizardDetails } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IModelViewDialogDetails, IModelViewTabDetails, IModelViewButtonDetails, IModelViewWizardPageDetails, IModelViewWizardDetails, IErrorDialogOptions } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ModelViewInput, ModelViewInputModel, ModeViewSaveHandler } from 'sql/workbench/browser/modelComponents/modelViewInput';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
@@ -113,6 +113,10 @@ export class MainThreadModelViewDialog extends Disposable implements MainThreadM
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public $openCustomErrorDialog(options: IErrorDialogOptions): Promise<string | undefined> {
|
||||
return this._dialogService.openCustomErrorDialog(options);
|
||||
}
|
||||
|
||||
public $setDialogDetails(handle: number, details: IModelViewDialogDetails): Thenable<void> {
|
||||
let dialog = this._dialogs.get(handle);
|
||||
if (!dialog) {
|
||||
|
||||
@@ -25,13 +25,13 @@ export class ExtHostErrorDiagnostics extends ExtHostErrorDiagnosticsShape {
|
||||
|
||||
// PUBLIC METHODS //////////////////////////////////////////////////////
|
||||
// - MAIN THREAD AVAILABLE METHODS /////////////////////////////////////
|
||||
public override $handleConnectionError(handle: number, errorCode: number, errorMessage: string, connection: azdata.connection.ConnectionProfile): Thenable<azdata.diagnostics.ConnectionDiagnosticsResult> {
|
||||
public override $handleConnectionError(handle: number, errorInfo: azdata.diagnostics.IErrorInformation, 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);
|
||||
return provider.provider.handleConnectionError(errorInfo, connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -777,6 +777,10 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
this._proxy.$openDialog(handle);
|
||||
}
|
||||
|
||||
public openCustomErrorDialog(options: azdata.window.IErrorDialogOptions): Thenable<string | undefined> {
|
||||
return this._proxy.$openCustomErrorDialog(options);
|
||||
}
|
||||
|
||||
public closeDialog(dialog: azdata.window.Dialog): void {
|
||||
let handle = this.getHandle(dialog);
|
||||
this._proxy.$closeDialog(handle);
|
||||
|
||||
@@ -224,7 +224,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
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 => {
|
||||
@@ -477,7 +477,10 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
createModelViewDashboard(title: string, name?: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard {
|
||||
return extHostModelViewDialog.createModelViewDashboard(title, name, options, extension);
|
||||
},
|
||||
MessageLevel: sqlExtHostTypes.MessageLevel
|
||||
MessageLevel: sqlExtHostTypes.MessageLevel,
|
||||
openCustomErrorDialog(options: sqlExtHostTypes.IErrorDialogOptions): Thenable<string | undefined> {
|
||||
return extHostModelViewDialog.openCustomErrorDialog(options);
|
||||
}
|
||||
};
|
||||
|
||||
const tasks: typeof azdata.tasks = {
|
||||
|
||||
@@ -18,7 +18,8 @@ import {
|
||||
IModelViewWizardDetails, IModelViewWizardPageDetails, IExecuteManagerDetails, INotebookSessionDetails,
|
||||
INotebookKernelDetails, INotebookFutureDetails, FutureMessageType, INotebookFutureDone, INotebookEditOperation,
|
||||
NotebookChangeKind,
|
||||
ISerializationManagerDetails
|
||||
ISerializationManagerDetails,
|
||||
IErrorDialogOptions
|
||||
} from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IUndoStopOptions } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
@@ -613,7 +614,7 @@ 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(); }
|
||||
$handleConnectionError(handle: number, errorInfo: azdata.diagnostics.IErrorInformation, connection: azdata.connection.ConnectionProfile): Thenable<azdata.diagnostics.ConnectionDiagnosticsResult> { throw ni(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -878,6 +879,7 @@ export interface MainThreadModelViewDialogShape extends IDisposable {
|
||||
$openEditor(handle: number, modelViewId: string, title: string, name?: string, options?: azdata.ModelViewEditorOptions, position?: vscode.ViewColumn): Thenable<void>;
|
||||
$closeEditor(handle: number): Thenable<void>;
|
||||
$openDialog(handle: number, dialogName?: string): Thenable<void>;
|
||||
$openCustomErrorDialog(options: IErrorDialogOptions): Promise<string | undefined>;
|
||||
$closeDialog(handle: number): Thenable<void>;
|
||||
$setDialogDetails(handle: number, details: IModelViewDialogDetails): Thenable<void>;
|
||||
$setTabDetails(handle: number, details: IModelViewTabDetails): Thenable<void>;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as azdata from 'azdata';
|
||||
import * as vsExtTypes from 'vs/workbench/api/common/extHostTypes';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { TelemetryView } from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
|
||||
// SQL added extension host types
|
||||
export enum ServiceOptionType {
|
||||
@@ -328,6 +329,29 @@ export interface IDialogProperties {
|
||||
height: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides dialog options to customize modal dialog content and layout
|
||||
*/
|
||||
export interface IErrorDialogOptions {
|
||||
severity: MessageLevel;
|
||||
headerTitle: string;
|
||||
message: string;
|
||||
messageDetails?: string;
|
||||
telemetryView?: TelemetryView | string;
|
||||
actions?: IDialogAction[];
|
||||
instructionText?: string;
|
||||
readMoreLink?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An action that will be rendered as a button on the dialog.
|
||||
*/
|
||||
export interface IDialogAction {
|
||||
id: string;
|
||||
label: string;
|
||||
isPrimary: boolean;
|
||||
}
|
||||
|
||||
export enum MessageLevel {
|
||||
Error = 0,
|
||||
Warning = 1,
|
||||
|
||||
Reference in New Issue
Block a user