mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Refact/idea lastknown (#501)
* close * connection is working * formatting * adds all * formatting * removed unneeded logging * readd npm shrinkwrap * addressed comments * fix capabilities cacheing * updated shrinkwrap * fixed tests * remove dead code * vbump sqltools
This commit is contained in:
@@ -29,6 +29,7 @@ import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { SplitView, CollapsibleState } from 'sql/base/browser/ui/splitview/splitview';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export class CategoryView extends FixedCollapsibleView {
|
||||
private _treecontainer: HTMLElement;
|
||||
@@ -167,13 +168,13 @@ export class OptionsDialog extends Modal {
|
||||
var widget: Widget = this._optionElements[optionName].optionWidget;
|
||||
var option = this._optionElements[optionName].option;
|
||||
switch (option.valueType) {
|
||||
case OptionsDialogHelper.ServiceOptionType.category:
|
||||
case OptionsDialogHelper.ServiceOptionType.boolean:
|
||||
case ServiceOptionType.category:
|
||||
case ServiceOptionType.boolean:
|
||||
this._register(styler.attachSelectBoxStyler(<SelectBox>widget, this._themeService));
|
||||
break;
|
||||
case OptionsDialogHelper.ServiceOptionType.string:
|
||||
case OptionsDialogHelper.ServiceOptionType.password:
|
||||
case OptionsDialogHelper.ServiceOptionType.number:
|
||||
case ServiceOptionType.string:
|
||||
case ServiceOptionType.password:
|
||||
case ServiceOptionType.number:
|
||||
this._register(styler.attachInputBoxStyler(<InputBox>widget, this._themeService));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import data = require('data');
|
||||
import { localize } from 'vs/nls';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export interface IOptionElement {
|
||||
optionWidget: any;
|
||||
@@ -21,15 +22,6 @@ export interface IOptionElement {
|
||||
optionValue: any;
|
||||
}
|
||||
|
||||
export enum ServiceOptionType {
|
||||
string = 0,
|
||||
multistring = 1,
|
||||
password = 2,
|
||||
number = 3,
|
||||
category = 4,
|
||||
boolean = 5
|
||||
}
|
||||
|
||||
export function createOptionElement(option: data.ServiceOption, rowContainer: Builder, options: { [name: string]: any },
|
||||
optionsMap: { [optionName: string]: IOptionElement }, contextViewService: IContextViewService, onFocus: (name) => void): void {
|
||||
let possibleInputs: string[] = [];
|
||||
|
||||
113
src/sql/data.d.ts
vendored
113
src/sql/data.d.ts
vendored
@@ -11,7 +11,29 @@ declare module 'data' {
|
||||
* Namespace for Data Management Protocol global methods
|
||||
*/
|
||||
export namespace dataprotocol {
|
||||
export function registerProvider(provider: DataProtocolProvider): vscode.Disposable;
|
||||
export function registerConnectionProvider(provider: ConnectionProvider): vscode.Disposable;
|
||||
|
||||
export function registerBackupProvider(provider: BackupProvider): vscode.Disposable;
|
||||
|
||||
export function registerRestoreProvider(provider: RestoreProvider): vscode.Disposable;
|
||||
|
||||
export function registerScriptingProvider(provider: ScriptingProvider): vscode.Disposable;
|
||||
|
||||
export function registerObjectExplorerProvider(provider: ObjectExplorerProvider): vscode.Disposable;
|
||||
|
||||
export function registerTaskServicesProvider(provider: TaskServicesProvider): vscode.Disposable;
|
||||
|
||||
export function registerFileBrowserProvider(provider: FileBrowserProvider): vscode.Disposable;
|
||||
|
||||
export function registerProfilerProvider(provider: ProfilerProvider): vscode.Disposable;
|
||||
|
||||
export function registerMetadataProvider(provider: MetadataProvider): vscode.Disposable;
|
||||
|
||||
export function registerQueryProvider(provider: QueryProvider): vscode.Disposable;
|
||||
|
||||
export function registerAdminServicesProvider(provider: AdminServicesProvider): vscode.Disposable;
|
||||
|
||||
export function registerCapabilitiesServiceProvider(provider: CapabilitiesProvider): vscode.Disposable;
|
||||
|
||||
/**
|
||||
* An [event](#Event) which fires when the specific flavor of a language used in DMP
|
||||
@@ -155,8 +177,12 @@ declare module 'data' {
|
||||
osVersion: string;
|
||||
}
|
||||
|
||||
export interface ConnectionProvider {
|
||||
handle: number;
|
||||
export interface DataProvider {
|
||||
handle?: number;
|
||||
readonly providerId: string;
|
||||
}
|
||||
|
||||
export interface ConnectionProvider extends DataProvider {
|
||||
|
||||
connect(connectionUri: string, connectionInfo: ConnectionInfo): Thenable<boolean>;
|
||||
|
||||
@@ -170,11 +196,11 @@ declare module 'data' {
|
||||
|
||||
rebuildIntelliSenseCache(connectionUri: string): Thenable<void>;
|
||||
|
||||
registerOnConnectionComplete(handler: (connSummary: ConnectionInfoSummary) => any);
|
||||
registerOnConnectionComplete(handler: (connSummary: ConnectionInfoSummary) => any): void;
|
||||
|
||||
registerOnIntelliSenseCacheComplete(handler: (connectionUri: string) => any);
|
||||
registerOnIntelliSenseCacheComplete(handler: (connectionUri: string) => any): void;
|
||||
|
||||
registerOnConnectionChanged(handler: (changedConnInfo: ChangedConnectionInfo) => any);
|
||||
registerOnConnectionChanged(handler: (changedConnInfo: ChangedConnectionInfo) => any): void;
|
||||
}
|
||||
|
||||
export enum ServiceOptionType {
|
||||
@@ -188,12 +214,12 @@ declare module 'data' {
|
||||
}
|
||||
|
||||
export enum ConnectionOptionSpecialType {
|
||||
serverName = 0,
|
||||
databaseName = 1,
|
||||
authType = 2,
|
||||
userName = 3,
|
||||
password = 4,
|
||||
appName = 5
|
||||
serverName = 'serverName',
|
||||
databaseName = 'databaseName',
|
||||
authType = 'authType',
|
||||
userName = 'userName',
|
||||
password = 'password',
|
||||
appName = 'appName'
|
||||
}
|
||||
|
||||
export interface CategoryValue {
|
||||
@@ -306,7 +332,7 @@ declare module 'data' {
|
||||
hostVersion: string;
|
||||
}
|
||||
|
||||
export interface CapabilitiesProvider {
|
||||
export interface CapabilitiesProvider extends DataProvider {
|
||||
getServerCapabilities(client: DataProtocolClientCapabilities): Thenable<DataProtocolServerCapabilities>;
|
||||
}
|
||||
|
||||
@@ -387,7 +413,7 @@ declare module 'data' {
|
||||
objectMetadata: ObjectMetadata[];
|
||||
}
|
||||
|
||||
export interface MetadataProvider {
|
||||
export interface MetadataProvider extends DataProvider {
|
||||
getMetadata(connectionUri: string): Thenable<ProviderMetadata>;
|
||||
|
||||
getDatabases(connectionUri: string): Thenable<string[]>;
|
||||
@@ -419,7 +445,7 @@ declare module 'data' {
|
||||
targetDatabaseEngineType: string;
|
||||
}
|
||||
|
||||
export interface ScriptingProvider {
|
||||
export interface ScriptingProvider extends DataProvider {
|
||||
|
||||
scriptAsOperation(connectionUri: string, operation: ScriptOperation, metadata: ObjectMetadata, paramDetails: ScriptingParamDetails): Thenable<ScriptingResult>;
|
||||
|
||||
@@ -439,38 +465,6 @@ declare module 'data' {
|
||||
|
||||
operationId: string;
|
||||
}
|
||||
/**
|
||||
* Data Management Protocol main provider class that DMP extensions should implement.
|
||||
* This provider interface contains references to providers for the various capabilitiesProvider
|
||||
* that an extension can implement.
|
||||
*/
|
||||
export interface DataProtocolProvider {
|
||||
handle: number;
|
||||
|
||||
providerId: string;
|
||||
|
||||
capabilitiesProvider: CapabilitiesProvider;
|
||||
|
||||
connectionProvider: ConnectionProvider;
|
||||
|
||||
queryProvider: QueryProvider;
|
||||
|
||||
metadataProvider: MetadataProvider;
|
||||
|
||||
scriptingProvider: ScriptingProvider;
|
||||
|
||||
objectExplorerProvider: ObjectExplorerProvider;
|
||||
|
||||
adminServicesProvider: AdminServicesProvider;
|
||||
|
||||
disasterRecoveryProvider: DisasterRecoveryProvider;
|
||||
|
||||
taskServicesProvider: TaskServicesProvider;
|
||||
|
||||
fileBrowserProvider: FileBrowserProvider;
|
||||
|
||||
profilerProvider: ProfilerProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters to initialize a connection to a database
|
||||
@@ -509,10 +503,7 @@ declare module 'data' {
|
||||
flavor: string;
|
||||
}
|
||||
|
||||
export interface QueryProvider {
|
||||
handle: number;
|
||||
// TODO replace this temporary queryType field with a standard definition for supported platform
|
||||
queryType: string;
|
||||
export interface QueryProvider extends DataProvider {
|
||||
cancelQuery(ownerUri: string): Thenable<QueryCancelResult>;
|
||||
runQuery(ownerUri: string, selection: ISelectionData, runOptions?: ExecutionPlanOptions): Thenable<void>;
|
||||
runQueryStatement(ownerUri: string, line: number, column: number): Thenable<void>;
|
||||
@@ -673,6 +664,7 @@ declare module 'data' {
|
||||
export interface QueryExecuteParams {
|
||||
ownerUri: string;
|
||||
querySelection: ISelectionData;
|
||||
executionPlanOptions?: ExecutionPlanOptions;
|
||||
}
|
||||
|
||||
export interface QueryExecuteSubsetParams {
|
||||
@@ -694,6 +686,7 @@ declare module 'data' {
|
||||
}
|
||||
|
||||
export interface QueryExecuteSubsetResult {
|
||||
message: string;
|
||||
resultSubset: ResultSetSubset;
|
||||
}
|
||||
|
||||
@@ -760,12 +753,15 @@ declare module 'data' {
|
||||
export interface EditInitializeFiltering {
|
||||
LimitResults?: number;
|
||||
}
|
||||
|
||||
export interface EditInitializeParams extends IEditSessionOperationParams {
|
||||
filters: EditInitializeFiltering;
|
||||
objectName: string;
|
||||
schemaName: string;
|
||||
objectType: string;
|
||||
}
|
||||
|
||||
|
||||
export interface EditInitializeResult { }
|
||||
|
||||
// edit/revertCell ----------------------------------------------------------------------------
|
||||
@@ -849,7 +845,7 @@ declare module 'data' {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface ObjectExplorerProvider {
|
||||
export interface ObjectExplorerProvider extends DataProvider {
|
||||
createNewSession(connInfo: ConnectionInfo): Thenable<ObjectExplorerSessionResponse>;
|
||||
|
||||
expandNode(nodeInfo: ExpandNodeInfo): Thenable<boolean>;
|
||||
@@ -883,7 +879,7 @@ declare module 'data' {
|
||||
taskId: number;
|
||||
}
|
||||
|
||||
export interface AdminServicesProvider {
|
||||
export interface AdminServicesProvider extends DataProvider {
|
||||
createDatabase(connectionUri: string, database: DatabaseInfo): Thenable<CreateDatabaseResponse>;
|
||||
|
||||
createLogin(connectionUri: string, login: LoginInfo): Thenable<CreateLoginResponse>;
|
||||
@@ -941,7 +937,7 @@ declare module 'data' {
|
||||
duration: number;
|
||||
}
|
||||
|
||||
export interface TaskServicesProvider {
|
||||
export interface TaskServicesProvider extends DataProvider {
|
||||
getAllTasks(listTasksParams: ListTasksParams): Thenable<ListTasksResponse>;
|
||||
|
||||
cancelTask(cancelTaskParams: CancelTaskParams): Thenable<boolean>;
|
||||
@@ -964,9 +960,12 @@ declare module 'data' {
|
||||
taskId: number;
|
||||
}
|
||||
|
||||
export interface DisasterRecoveryProvider {
|
||||
export interface BackupProvider extends DataProvider {
|
||||
backup(connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: TaskExecutionMode): Thenable<BackupResponse>;
|
||||
getBackupConfigInfo(connectionUri: string): Thenable<BackupConfigInfo>;
|
||||
}
|
||||
|
||||
export interface RestoreProvider extends DataProvider {
|
||||
getRestorePlan(connectionUri: string, restoreInfo: RestoreInfo): Thenable<RestorePlanResponse>;
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: RestoreInfo): Thenable<boolean>;
|
||||
restore(connectionUri: string, restoreInfo: RestoreInfo): Thenable<RestoreResponse>;
|
||||
@@ -1029,7 +1028,7 @@ declare module 'data' {
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
export interface ProfilerProvider {
|
||||
export interface ProfilerProvider extends DataProvider {
|
||||
startSession(sessionId: string): Thenable<boolean>;
|
||||
stopSession(sessionId: string): Thenable<boolean>;
|
||||
pauseSession(sessionId: string): Thenable<boolean>;
|
||||
@@ -1081,7 +1080,7 @@ declare module 'data' {
|
||||
|
||||
// File browser interfaces -----------------------------------------------------------------------
|
||||
|
||||
export interface FileBrowserProvider {
|
||||
export interface FileBrowserProvider extends DataProvider {
|
||||
openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean): Thenable<boolean>;
|
||||
registerOnFileBrowserOpened(handler: (response: FileBrowserOpenedParams) => any);
|
||||
expandFolderNode(ownerUri: string, expandPath: string): Thenable<boolean>;
|
||||
|
||||
@@ -136,7 +136,7 @@ export interface IConnectionManagementService {
|
||||
|
||||
clearRecentConnectionsList(): void;
|
||||
|
||||
clearRecentConnection(connectionProfile: IConnectionProfile) : void;
|
||||
clearRecentConnection(connectionProfile: IConnectionProfile): void;
|
||||
|
||||
getActiveConnections(): ConnectionProfile[];
|
||||
|
||||
@@ -278,24 +278,6 @@ export interface IErrorMessageService {
|
||||
showDialog(severity: Severity, headerTitle: string, message: string, messageDetails?: string, actions?: IAction[]): void;
|
||||
}
|
||||
|
||||
export enum ServiceOptionType {
|
||||
string = 0,
|
||||
multistring = 1,
|
||||
password = 2,
|
||||
number = 3,
|
||||
category = 4,
|
||||
boolean = 5
|
||||
}
|
||||
|
||||
export enum ConnectionOptionSpecialType {
|
||||
serverName = 0,
|
||||
databaseName = 1,
|
||||
authType = 2,
|
||||
userName = 3,
|
||||
password = 4,
|
||||
appName = 5
|
||||
}
|
||||
|
||||
export enum RunQueryOnConnectionMode {
|
||||
none = 0,
|
||||
executeQuery = 1,
|
||||
|
||||
@@ -52,6 +52,11 @@ export class ConnectionStore {
|
||||
this._connectionConfig = new ConnectionConfig(this._configurationEditService,
|
||||
this._workspaceConfigurationService, this._capabilitiesService, cachedServerCapabilities);
|
||||
}
|
||||
if (_capabilitiesService) {
|
||||
_capabilitiesService.onProviderRegisteredEvent(e => {
|
||||
this.saveCachedServerCapabilities();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static get CRED_PREFIX(): string { return 'Microsoft.SqlTools'; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import data = require('data');
|
||||
import * as interfaces from 'sql/parts/connection/common/interfaces';
|
||||
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import * as Constants from 'sql/parts/connection/common/constants';
|
||||
|
||||
export class ProviderConnectionInfo implements data.ConnectionInfo {
|
||||
@@ -114,7 +114,7 @@ export class ProviderConnectionInfo implements data.ConnectionInfo {
|
||||
return isPasswordRequired;
|
||||
}
|
||||
|
||||
private getSpecialTypeOptionValue(type: number): string {
|
||||
private getSpecialTypeOptionValue(type: string): string {
|
||||
let name = this.getSpecialTypeOptionName(type);
|
||||
if (name) {
|
||||
return this.options[name];
|
||||
@@ -172,7 +172,7 @@ export class ProviderConnectionInfo implements data.ConnectionInfo {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public getSpecialTypeOptionName(type: number): string {
|
||||
public getSpecialTypeOptionName(type: string): string {
|
||||
if (this._serverCapabilities) {
|
||||
let optionMetadata = this._serverCapabilities.connectionProvider.options.find(o => o.specialValueType === type);
|
||||
return !!optionMetadata ? optionMetadata.name : undefined;
|
||||
@@ -181,7 +181,7 @@ export class ProviderConnectionInfo implements data.ConnectionInfo {
|
||||
}
|
||||
}
|
||||
|
||||
public setSpecialTypeOptionName(type: number, value: string): void {
|
||||
public setSpecialTypeOptionName(type: string, value: string): void {
|
||||
let name = this.getSpecialTypeOptionName(type);
|
||||
if (!!name) {
|
||||
this.options[name] = value;
|
||||
@@ -238,4 +238,3 @@ export class ProviderConnectionInfo implements data.ConnectionInfo {
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IConnectionManagementService, ConnectionOptionSpecialType } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IConnectionComponentCallbacks, IConnectionComponentController, IConnectionValidateResult } from 'sql/parts/connection/connectionDialog/connectionDialogService';
|
||||
import { ConnectionWidget } from 'sql/parts/connection/connectionDialog/connectionWidget';
|
||||
import { AdvancedPropertiesController } from 'sql/parts/connection/connectionDialog/advancedPropertiesController';
|
||||
@@ -15,6 +15,7 @@ import * as Constants from 'sql/parts/connection/common/constants';
|
||||
import data = require('data');
|
||||
import * as Utils from 'sql/parts/connection/common/utils';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ConnectionOptionSpecialType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export class ConnectionController implements IConnectionComponentController {
|
||||
private _container: HTMLElement;
|
||||
|
||||
@@ -291,8 +291,7 @@ export class ConnectionDialogWidget extends Modal {
|
||||
this.onConnectionClick({ payload: { origin: origin, originalEvent: eventish } }, element);
|
||||
}
|
||||
};
|
||||
let actionProvider = this._instantiationService.createInstance(RecentConnectionActionsProvider, this._instantiationService, this._connectionManagementService,
|
||||
this._messageService);
|
||||
let actionProvider = this._instantiationService.createInstance(RecentConnectionActionsProvider);
|
||||
let controller = new RecentConnectionTreeController(leftClick, actionProvider, this._connectionManagementService, this._contextMenuService);
|
||||
actionProvider.onRecentConnectionRemoved(() => {
|
||||
this.open(this._connectionManagementService.getRecentConnections().length > 0);
|
||||
|
||||
@@ -16,7 +16,7 @@ import * as DialogHelper from 'sql/base/browser/ui/modal/dialogHelper';
|
||||
import { IConnectionComponentCallbacks } from 'sql/parts/connection/connectionDialog/connectionDialogService';
|
||||
import * as lifecycle from 'vs/base/common/lifecycle';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { ConnectionOptionSpecialType } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { ConnectionOptionSpecialType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import * as Constants from 'sql/parts/connection/common/constants';
|
||||
import { ConnectionProfileGroup, IConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
@@ -87,7 +87,7 @@ export class ConnectionWidget {
|
||||
}
|
||||
|
||||
var authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||
if(authTypeOption) {
|
||||
if (authTypeOption) {
|
||||
if (OS === OperatingSystem.Windows) {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(Constants.integrated);
|
||||
} else {
|
||||
@@ -250,11 +250,11 @@ export class ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
private setConnectButton() : void {
|
||||
private setConnectButton(): void {
|
||||
let authDisplayName: string = this.getAuthTypeDisplayName(this.authenticationType);
|
||||
let authType: AuthenticationType = this.getMatchingAuthType(authDisplayName);
|
||||
let showUsernameAndPassword: boolean = true;
|
||||
if(authType) {
|
||||
if (authType) {
|
||||
showUsernameAndPassword = authType.showUsernameAndPassword;
|
||||
}
|
||||
showUsernameAndPassword ? this._callbacks.onSetConnectButton(!!this.serverName && !!this.userName) :
|
||||
@@ -366,7 +366,7 @@ export class ConnectionWidget {
|
||||
var displayName: string;
|
||||
var authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||
|
||||
if(authTypeOption) {
|
||||
if (authTypeOption) {
|
||||
authTypeOption.categoryValues.forEach(c => {
|
||||
if (c.name === authTypeName) {
|
||||
displayName = c.displayName;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { SplitView } from 'sql/base/browser/ui/splitview/splitview';
|
||||
import { attachButtonStyler, attachListBoxStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'sql/common/theme/styler';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import * as BackupConstants from 'sql/parts/disasterRecovery/backup/constants';
|
||||
import { IDisasterRecoveryService, IDisasterRecoveryUiService, TaskExecutionMode } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IBackupService, IBackupUiService, TaskExecutionMode } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import FileValidationConstants = require('sql/parts/fileBrowser/common/fileValidationServiceConstants');
|
||||
import { DashboardComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
||||
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
||||
@@ -140,8 +140,8 @@ export class BackupComponent {
|
||||
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
private _disasterRecoveryService: IDisasterRecoveryService;
|
||||
private _disasterRecoveryUiService: IDisasterRecoveryUiService;
|
||||
private _backupService: IBackupService;
|
||||
private _backupUiService: IBackupUiService;
|
||||
private _uri: string;
|
||||
private _toDispose: lifecycle.IDisposable[] = [];
|
||||
private _advancedHeaderSize = 32;
|
||||
@@ -198,9 +198,9 @@ export class BackupComponent {
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeDetectorRef: ChangeDetectorRef,
|
||||
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService,
|
||||
) {
|
||||
this._disasterRecoveryService = _bootstrapService.disasterRecoveryService;
|
||||
this._disasterRecoveryUiService = _bootstrapService.disasterRecoveryUiService;
|
||||
this._disasterRecoveryUiService.onShowBackupEvent((param) => this.onGetBackupConfigInfo(param));
|
||||
this._backupService = _bootstrapService.backupService;
|
||||
this._backupUiService = _bootstrapService.backupUiService;
|
||||
this._backupUiService.onShowBackupEvent((param) => this.onGetBackupConfigInfo(param));
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -315,12 +315,12 @@ export class BackupComponent {
|
||||
ngAfterViewInit() {
|
||||
// Set category view for advanced options. This should be defined in ngAfterViewInit so that it correctly calculates the text height after data binding.
|
||||
var splitview = new SplitView(this.advancedOptionElement.nativeElement);
|
||||
var advancedBodySize = DOM.getTotalHeight(this.advancedOptionBodyElement.nativeElement);
|
||||
var advancedBodySize = DOM.getTotalHeight(this.advancedOptionBodyElement.nativeElement);
|
||||
var categoryView = new CategoryView(this.advancedConfigurationLabel, this.advancedOptionBodyElement.nativeElement, true, advancedBodySize, this._advancedHeaderSize);
|
||||
splitview.addView(categoryView);
|
||||
splitview.layout(advancedBodySize + this._advancedHeaderSize);
|
||||
|
||||
this._disasterRecoveryUiService.onShowBackupDialog();
|
||||
this._backupUiService.onShowBackupDialog();
|
||||
}
|
||||
|
||||
private onGetBackupConfigInfo(param: DashboardComponentParams) {
|
||||
@@ -336,7 +336,7 @@ export class BackupComponent {
|
||||
this._uri = param.ownerUri;
|
||||
|
||||
// Get backup configuration info
|
||||
this._disasterRecoveryService.getBackupConfigInfo(this._uri).then(configInfo => {
|
||||
this._backupService.getBackupConfigInfo(this._uri).then(configInfo => {
|
||||
if (configInfo) {
|
||||
this.defaultNewBackupFolder = configInfo.defaultBackupFolder;
|
||||
this.recoveryModel = configInfo.recoveryModel;
|
||||
@@ -546,12 +546,12 @@ export class BackupComponent {
|
||||
* UI event handlers
|
||||
*/
|
||||
private onScript(): void {
|
||||
this._disasterRecoveryService.backup(this._uri, this.createBackupInfo(), TaskExecutionMode.script);
|
||||
this._backupService.backup(this._uri, this.createBackupInfo(), TaskExecutionMode.script);
|
||||
this.close();
|
||||
}
|
||||
|
||||
private onOk(): void {
|
||||
this._disasterRecoveryService.backup(this._uri, this.createBackupInfo(), TaskExecutionMode.executeAndScript);
|
||||
this._backupService.backup(this._uri, this.createBackupInfo(), TaskExecutionMode.executeAndScript);
|
||||
this.close();
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ export class BackupComponent {
|
||||
}
|
||||
|
||||
private close(): void {
|
||||
this._disasterRecoveryUiService.closeBackup();
|
||||
this._backupUiService.closeBackup();
|
||||
this.resetDialog();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import Event from 'vs/base/common/event';
|
||||
import data = require('data');
|
||||
@@ -20,12 +19,12 @@ export enum TaskExecutionMode {
|
||||
executeAndScript = 2,
|
||||
}
|
||||
|
||||
export const SERVICE_ID = 'disasterRecoveryService';
|
||||
export const UI_SERVICE_ID = 'disasterRecoveryUiService';
|
||||
export const SERVICE_ID = 'backupService';
|
||||
export const UI_SERVICE_ID = 'backupUiService';
|
||||
|
||||
export const IDisasterRecoveryUiService = createDecorator<IDisasterRecoveryUiService>(UI_SERVICE_ID);
|
||||
export const IBackupUiService = createDecorator<IBackupUiService>(UI_SERVICE_ID);
|
||||
|
||||
export interface IDisasterRecoveryUiService {
|
||||
export interface IBackupUiService {
|
||||
_serviceBrand: any;
|
||||
|
||||
/**
|
||||
@@ -49,9 +48,9 @@ export interface IDisasterRecoveryUiService {
|
||||
onShowBackupDialog();
|
||||
}
|
||||
|
||||
export const IDisasterRecoveryService = createDecorator<IDisasterRecoveryService>(SERVICE_ID);
|
||||
export const IBackupService = createDecorator<IBackupService>(SERVICE_ID);
|
||||
|
||||
export interface IDisasterRecoveryService {
|
||||
export interface IBackupService {
|
||||
_serviceBrand: any;
|
||||
|
||||
getBackupConfigInfo(connectionUri: string): Thenable<data.BackupConfigInfo>;
|
||||
@@ -64,31 +63,5 @@ export interface IDisasterRecoveryService {
|
||||
/**
|
||||
* Register a disaster recovery provider
|
||||
*/
|
||||
registerProvider(providerId: string, provider: data.DisasterRecoveryProvider): void;
|
||||
|
||||
/**
|
||||
* Restore a data source using a backup file or database
|
||||
*/
|
||||
restore(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse>;
|
||||
|
||||
/**
|
||||
* Gets restore plan to do the restore operation on a database
|
||||
*/
|
||||
getRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse>;
|
||||
|
||||
/**
|
||||
* Gets restore config Info
|
||||
*/
|
||||
getRestoreConfigInfo(connectionUri: string): Thenable<data.RestoreConfigInfo>;
|
||||
|
||||
/**
|
||||
* Cancel restore plan
|
||||
*/
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean>;
|
||||
registerProvider(providerId: string, provider: data.BackupProvider): void;
|
||||
}
|
||||
|
||||
export const IRestoreDialogController = createDecorator<IRestoreDialogController>('restoreDialogService');
|
||||
export interface IRestoreDialogController {
|
||||
_serviceBrand: any;
|
||||
showDialog(connection: IConnectionProfile): TPromise<void>;
|
||||
}
|
||||
@@ -4,25 +4,87 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import * as data from 'data';
|
||||
import * as Constants from 'sql/common/constants';
|
||||
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/common/telemetryUtilities';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IBackupService, TaskExecutionMode, IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import { BackupDialog } from 'sql/parts/disasterRecovery/backup/backupDialog';
|
||||
import { OptionsDialog } from 'sql/base/browser/ui/modal/optionsDialog';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { DashboardComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import * as data from 'data';
|
||||
|
||||
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { OptionsDialog } from 'sql/base/browser/ui/modal/optionsDialog';
|
||||
import { BackupDialog } from 'sql/parts/disasterRecovery/backup/backupDialog';
|
||||
import { IDisasterRecoveryService, IDisasterRecoveryUiService, TaskExecutionMode } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import ConnectionUtils = require('sql/parts/connection/common/utils');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as ConnectionUtils from 'sql/parts/connection/common/utils';
|
||||
import { ProviderConnectionInfo } from 'sql/parts/connection/common/providerConnectionInfo';
|
||||
import { DashboardComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
||||
import * as Utils from 'sql/parts/connection/common/utils';
|
||||
|
||||
export class DisasterRecoveryUiService implements IDisasterRecoveryUiService {
|
||||
export class BackupService implements IBackupService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
private _providers: { [handle: string]: data.BackupProvider; } = Object.create(null);
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database metadata needed to populate backup UI
|
||||
*/
|
||||
public getBackupConfigInfo(connectionUri: string): Thenable<data.BackupConfigInfo> {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri);
|
||||
if (providerId) {
|
||||
let provider = this._providers[providerId];
|
||||
if (provider) {
|
||||
return provider.getBackupConfigInfo(connectionUri);
|
||||
}
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backup a data source using the provided connection
|
||||
*/
|
||||
public backup(connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: TaskExecutionMode): Thenable<data.BackupResponse> {
|
||||
return new Promise<data.BackupResponse>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.BackupCreated, { provider: providerResult.providerName });
|
||||
providerResult.provider.backup(connectionUri, backupInfo, taskExecutionMode).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getProvider(connectionUri: string): { provider: data.BackupProvider, providerName: string } {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri);
|
||||
if (providerId) {
|
||||
return { provider: this._providers[providerId], providerName: providerId };
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a disaster recovery provider
|
||||
*/
|
||||
public registerProvider(providerId: string, provider: data.BackupProvider): void {
|
||||
this._providers[providerId] = provider;
|
||||
}
|
||||
}
|
||||
|
||||
export class BackupUiService implements IBackupUiService {
|
||||
public _serviceBrand: any;
|
||||
private _backupDialogs: { [providerName: string]: BackupDialog | OptionsDialog } = {};
|
||||
private _currentProvider: string;
|
||||
@@ -37,10 +99,10 @@ export class DisasterRecoveryUiService implements IDisasterRecoveryUiService {
|
||||
constructor( @IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IPartService private _partService: IPartService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IDisasterRecoveryService private _disasterRecoveryService: IDisasterRecoveryService,
|
||||
@IBackupService private _disasterRecoveryService: IBackupService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService) {
|
||||
this._onShowBackupEvent = new Emitter<DashboardComponentParams>();
|
||||
}
|
||||
this._onShowBackupEvent = new Emitter<DashboardComponentParams>();
|
||||
}
|
||||
|
||||
public showBackup(connection: IConnectionProfile): Promise<any> {
|
||||
let self = this;
|
||||
@@ -86,16 +148,16 @@ export class DisasterRecoveryUiService implements IDisasterRecoveryUiService {
|
||||
} else {
|
||||
let uri = this._connectionManagementService.getConnectionId(connection)
|
||||
+ ProviderConnectionInfo.idSeparator
|
||||
+ Utils.ConnectionUriBackupIdAttributeName
|
||||
+ ConnectionUtils.ConnectionUriBackupIdAttributeName
|
||||
+ ProviderConnectionInfo.nameValueSeparator
|
||||
+ DisasterRecoveryUiService._connectionUniqueId;
|
||||
+ BackupUiService._connectionUniqueId;
|
||||
|
||||
DisasterRecoveryUiService._connectionUniqueId++;
|
||||
BackupUiService._connectionUniqueId++;
|
||||
|
||||
// Create connection if needed
|
||||
if (!this._connectionManagementService.isConnected(uri)) {
|
||||
this._connectionManagementService.connect(connection, uri).then(() => {
|
||||
this._onShowBackupEvent.fire({connection: connection, ownerUri: uri});
|
||||
this._onShowBackupEvent.fire({ connection: connection, ownerUri: uri });
|
||||
});
|
||||
}
|
||||
(backupDialog as BackupDialog).open(connection);
|
||||
@@ -1,149 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import data = require('data');
|
||||
import { IDisasterRecoveryService, TaskExecutionMode } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import * as Constants from 'sql/common/constants';
|
||||
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/common/telemetryUtilities';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
export class DisasterRecoveryService implements IDisasterRecoveryService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
private _providers: { [handle: string]: data.DisasterRecoveryProvider; } = Object.create(null);
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database metadata needed to populate backup UI
|
||||
*/
|
||||
public getBackupConfigInfo(connectionUri: string): Thenable<data.BackupConfigInfo> {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri);
|
||||
if (providerId) {
|
||||
let provider = this._providers[providerId];
|
||||
if (provider) {
|
||||
return provider.getBackupConfigInfo(connectionUri);
|
||||
}
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backup a data source using the provided connection
|
||||
*/
|
||||
public backup(connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: TaskExecutionMode): Thenable<data.BackupResponse> {
|
||||
return new Promise<data.BackupResponse>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.BackupCreated, { provider: providerResult.providerName });
|
||||
providerResult.provider.backup(connectionUri, backupInfo, taskExecutionMode).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets restore config Info
|
||||
*/
|
||||
getRestoreConfigInfo(connectionUri: string): Thenable<data.RestoreConfigInfo> {
|
||||
return new Promise<data.RestoreConfigInfo>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
providerResult.provider.getRestoreConfigInfo(connectionUri).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a data source using a backup file or database
|
||||
*/
|
||||
restore(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse> {
|
||||
return new Promise<data.RestoreResponse>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.RestoreRequested, { provider: providerResult.providerName });
|
||||
providerResult.provider.restore(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getProvider(connectionUri: string): { provider: data.DisasterRecoveryProvider, providerName: string } {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri);
|
||||
if (providerId) {
|
||||
return { provider: this._providers[providerId], providerName: providerId };
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets restore plan to do the restore operation on a database
|
||||
*/
|
||||
getRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse> {
|
||||
return new Promise<data.RestorePlanResponse>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
providerResult.provider.getRestorePlan(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels a restore plan
|
||||
*/
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
providerResult.provider.cancelRestorePlan(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a disaster recovery provider
|
||||
*/
|
||||
public registerProvider(providerId: string, provider: data.DisasterRecoveryProvider): void {
|
||||
this._providers[providerId] = provider;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as data from 'data';
|
||||
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
|
||||
export const SERVICE_ID = 'restoreService';
|
||||
export const IRestoreService = createDecorator<IRestoreService>(SERVICE_ID);
|
||||
export { TaskExecutionMode } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
|
||||
export interface IRestoreService {
|
||||
_serviceBrand: any;
|
||||
|
||||
/**
|
||||
* Register a disaster recovery provider
|
||||
*/
|
||||
registerProvider(providerId: string, provider: data.RestoreProvider): void;
|
||||
|
||||
/**
|
||||
* Restore a data source using a backup file or database
|
||||
*/
|
||||
restore(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse>;
|
||||
|
||||
/**
|
||||
* Gets restore plan to do the restore operation on a database
|
||||
*/
|
||||
getRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse>;
|
||||
|
||||
/**
|
||||
* Gets restore config Info
|
||||
*/
|
||||
getRestoreConfigInfo(connectionUri: string): Thenable<data.RestoreConfigInfo>;
|
||||
|
||||
/**
|
||||
* Cancel restore plan
|
||||
*/
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean>;
|
||||
}
|
||||
|
||||
export const IRestoreDialogController = createDecorator<IRestoreDialogController>('restoreDialogService');
|
||||
export interface IRestoreDialogController {
|
||||
_serviceBrand: any;
|
||||
showDialog(connection: IConnectionProfile): TPromise<void>;
|
||||
}
|
||||
@@ -4,21 +4,128 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import * as data from 'data';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as Constants from 'sql/common/constants';
|
||||
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/common/telemetryUtilities';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as types from 'vs/base/common/types';
|
||||
|
||||
import { OptionsDialog } from 'sql/base/browser/ui/modal/optionsDialog';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import * as ConnectionConstants from 'sql/parts/connection/common/constants';
|
||||
import { ProviderConnectionInfo } from 'sql/parts/connection/common/providerConnectionInfo';
|
||||
import { IDisasterRecoveryService, IRestoreDialogController, TaskExecutionMode } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { MssqlRestoreInfo } from 'sql/parts/disasterRecovery/restore/mssqlRestoreInfo';
|
||||
import { RestoreDialog } from 'sql/parts/disasterRecovery/restore/restoreDialog';
|
||||
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { IRestoreService, IRestoreDialogController, TaskExecutionMode } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||
import { OptionsDialog } from 'sql/base/browser/ui/modal/optionsDialog';
|
||||
import { RestoreDialog } from 'sql/parts/disasterRecovery/restore/restoreDialog';
|
||||
import * as ConnectionConstants from 'sql/parts/connection/common/constants';
|
||||
import { MssqlRestoreInfo } from 'sql/parts/disasterRecovery/restore/mssqlRestoreInfo';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { ProviderConnectionInfo } from 'sql/parts/connection/common/providerConnectionInfo';
|
||||
import * as Utils from 'sql/parts/connection/common/utils';
|
||||
import * as data from 'data';
|
||||
|
||||
export class RestoreService implements IRestoreService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
private _providers: { [handle: string]: data.RestoreProvider; } = Object.create(null);
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets restore config Info
|
||||
*/
|
||||
getRestoreConfigInfo(connectionUri: string): Thenable<data.RestoreConfigInfo> {
|
||||
return new Promise<data.RestoreConfigInfo>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
providerResult.provider.getRestoreConfigInfo(connectionUri).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a data source using a backup file or database
|
||||
*/
|
||||
restore(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse> {
|
||||
return new Promise<data.RestoreResponse>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.RestoreRequested, { provider: providerResult.providerName });
|
||||
providerResult.provider.restore(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getProvider(connectionUri: string): { provider: data.RestoreProvider, providerName: string } {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri);
|
||||
if (providerId) {
|
||||
return { provider: this._providers[providerId], providerName: providerId };
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets restore plan to do the restore operation on a database
|
||||
*/
|
||||
getRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse> {
|
||||
return new Promise<data.RestorePlanResponse>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
providerResult.provider.getRestorePlan(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels a restore plan
|
||||
*/
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
let providerResult = this.getProvider(connectionUri);
|
||||
if (providerResult) {
|
||||
providerResult.provider.cancelRestorePlan(connectionUri, restoreInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
reject(Constants.InvalidProvider);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a disaster recovery provider
|
||||
*/
|
||||
public registerProvider(providerId: string, provider: data.RestoreProvider): void {
|
||||
this._providers[providerId] = provider;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class RestoreDialogController implements IRestoreDialogController {
|
||||
_serviceBrand: any;
|
||||
@@ -32,7 +139,7 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IDisasterRecoveryService private _disasterRecoveryService: IDisasterRecoveryService,
|
||||
@IRestoreService private _restoreService: IRestoreService,
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
@@ -46,14 +153,14 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
restoreOption.taskExecutionMode = TaskExecutionMode.executeAndScript;
|
||||
}
|
||||
|
||||
this._disasterRecoveryService.restore(this._ownerUri, restoreOption);
|
||||
this._restoreService.restore(this._ownerUri, restoreOption);
|
||||
let restoreDialog = this._restoreDialogs[this._currentProvider];
|
||||
restoreDialog.close();
|
||||
}
|
||||
|
||||
private handleMssqlOnValidateFile(overwriteTargetDatabase: boolean = false): void {
|
||||
let restoreDialog = this._restoreDialogs[this._currentProvider] as RestoreDialog;
|
||||
this._disasterRecoveryService.getRestorePlan(this._ownerUri, this.setRestoreOption(overwriteTargetDatabase)).then(restorePlanResponse => {
|
||||
this._restoreService.getRestorePlan(this._ownerUri, this.setRestoreOption(overwriteTargetDatabase)).then(restorePlanResponse => {
|
||||
this._sessionId = restorePlanResponse.sessionId;
|
||||
|
||||
if (restorePlanResponse.errorMessage) {
|
||||
@@ -88,7 +195,7 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
private getMssqlRestoreConfigInfo(): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let restoreDialog = this._restoreDialogs[this._currentProvider] as RestoreDialog;
|
||||
this._disasterRecoveryService.getRestoreConfigInfo(this._ownerUri).then(restoreConfigInfo => {
|
||||
this._restoreService.getRestoreConfigInfo(this._ownerUri).then(restoreConfigInfo => {
|
||||
restoreDialog.viewModel.updateOptionWithConfigInfo(restoreConfigInfo.configInfo);
|
||||
resolve();
|
||||
}, error => {
|
||||
@@ -150,7 +257,7 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
private handleOnCancel(): void {
|
||||
let restoreInfo = new MssqlRestoreInfo();
|
||||
restoreInfo.sessionId = this._sessionId;
|
||||
this._disasterRecoveryService.cancelRestorePlan(this._ownerUri, restoreInfo).then(() => {
|
||||
this._restoreService.cancelRestorePlan(this._ownerUri, restoreInfo).then(() => {
|
||||
this._connectionService.disconnect(this._ownerUri);
|
||||
});
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import * as DialogHelper from 'sql/base/browser/ui/modal/dialogHelper';
|
||||
import { Modal } from 'sql/base/browser/ui/modal/modal';
|
||||
import { attachButtonStyler, attachModalDialogStyler, attachTableStyler, attachInputBoxStyler, attachSelectBoxStyler, attachEditableDropdownStyler } from 'sql/common/theme/styler';
|
||||
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import { ServiceOptionType } from 'sql/parts/connection/common/connectionManagement';
|
||||
import * as BackupConstants from 'sql/parts/disasterRecovery/backup/constants';
|
||||
import { RestoreViewModel, RestoreOptionParam, SouceDatabaseNamesParam } from 'sql/parts/disasterRecovery/restore/restoreViewModel';
|
||||
import * as FileValidationConstants from 'sql/parts/fileBrowser/common/fileValidationServiceConstants';
|
||||
@@ -40,6 +39,7 @@ import { TabbedPanel, PanelTabIdentifier } from 'sql/base/browser/ui/panel/panel
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as data from 'data';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
interface FileListElement {
|
||||
logicalFileName: string;
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
'use strict';
|
||||
import * as data from 'data';
|
||||
import { ServiceOptionType } from 'sql/parts/connection/common/connectionManagement';
|
||||
import * as DialogHelper from 'sql/base/browser/ui/modal/dialogHelper';
|
||||
import * as types from 'vs/base/common/types';
|
||||
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export interface RestoreOptionsElement {
|
||||
optionMetadata: data.ServiceOption;
|
||||
|
||||
@@ -31,6 +31,7 @@ const columns = [
|
||||
];
|
||||
|
||||
export class ProfilerTestBackend implements data.ProfilerProvider {
|
||||
public readonly providerId = 'MSSQL';
|
||||
private index = 0;
|
||||
private timeOutMap = new Map<string, number>();
|
||||
private testData: Array<Array<string>> = new Array<Array<string>>();
|
||||
|
||||
@@ -15,7 +15,8 @@ import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { IQueryManagementService } from 'sql/parts/query/common/queryManagement';
|
||||
import { IAdminService } from 'sql/parts/admin/common/adminService';
|
||||
import { IDisasterRecoveryService, IDisasterRecoveryUiService, IRestoreDialogController } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IRestoreDialogController, IRestoreService } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||
import { IBackupService, IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import { IInsightsDialogService } from 'sql/parts/insights/common/interfaces';
|
||||
import { ISqlOAuthService } from 'sql/common/sqlOAuthService';
|
||||
import { IFileBrowserService, IFileBrowserDialogController } from 'sql/parts/fileBrowser/common/interfaces';
|
||||
@@ -57,8 +58,9 @@ export interface IBootstrapService {
|
||||
connectionDialogService: IConnectionDialogService;
|
||||
queryModelService: IQueryModelService;
|
||||
adminService: IAdminService;
|
||||
disasterRecoveryService: IDisasterRecoveryService;
|
||||
disasterRecoveryUiService: IDisasterRecoveryUiService;
|
||||
backupService: IBackupService;
|
||||
backupUiService: IBackupUiService;
|
||||
restoreService: IRestoreService;
|
||||
keybindingService: IKeybindingService;
|
||||
contextKeyService: IContextKeyService;
|
||||
contextMenuService: IContextMenuService;
|
||||
|
||||
@@ -16,7 +16,8 @@ import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
import { IQueryManagementService } from 'sql/parts/query/common/queryManagement';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { IAdminService } from 'sql/parts/admin/common/adminService';
|
||||
import { IDisasterRecoveryService, IDisasterRecoveryUiService, IRestoreDialogController } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IRestoreDialogController, IRestoreService } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||
import { IBackupService, IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import { IAngularEventingService } from 'sql/services/angularEventing/angularEventingService';
|
||||
import { IInsightsDialogService } from 'sql/parts/insights/common/interfaces';
|
||||
import { ISqlOAuthService } from 'sql/common/sqlOAuthService';
|
||||
@@ -67,9 +68,10 @@ export class BootstrapService implements IBootstrapService {
|
||||
@IAdminService public adminService: IAdminService,
|
||||
@IWorkbenchThemeService public themeService: IWorkbenchThemeService,
|
||||
@IWorkbenchEditorService public editorService: IWorkbenchEditorService,
|
||||
@IDisasterRecoveryService public disasterRecoveryService: IDisasterRecoveryService,
|
||||
@IDisasterRecoveryUiService public disasterRecoveryUiService: IDisasterRecoveryUiService,
|
||||
@IBackupService public backupService: IBackupService,
|
||||
@IBackupUiService public backupUiService: IBackupUiService,
|
||||
@IRestoreDialogController public restoreDialogService: IRestoreDialogController,
|
||||
@IRestoreService public restoreService: IRestoreService,
|
||||
@IConnectionDialogService public connectionDialogService: IConnectionDialogService,
|
||||
@IQueryModelService public queryModelService: IQueryModelService,
|
||||
@IKeybindingService public keybindingService: IKeybindingService,
|
||||
|
||||
@@ -16,15 +16,14 @@ export enum ServiceOptionType {
|
||||
}
|
||||
|
||||
export enum ConnectionOptionSpecialType {
|
||||
serverName = 0,
|
||||
databaseName = 1,
|
||||
authType = 2,
|
||||
userName = 3,
|
||||
password = 4,
|
||||
appName = 5
|
||||
serverName = 'serverName',
|
||||
databaseName = 'databaseName',
|
||||
authType = 'authType',
|
||||
userName = 'userName',
|
||||
password = 'password',
|
||||
appName = 'appName'
|
||||
}
|
||||
|
||||
|
||||
export enum MetadataType {
|
||||
Table = 0,
|
||||
View = 1,
|
||||
@@ -39,7 +38,6 @@ export enum EditRowState {
|
||||
dirtyUpdate = 3
|
||||
}
|
||||
|
||||
|
||||
export enum TaskStatus {
|
||||
notStarted = 0,
|
||||
inProgress = 1,
|
||||
@@ -63,4 +61,4 @@ export enum ScriptOperation {
|
||||
Delete = 4,
|
||||
Execute = 5,
|
||||
Alter = 6
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
private _proxy: MainThreadDataProtocolShape;
|
||||
|
||||
private static _handlePool: number = 0;
|
||||
private _adapter = new Map<number, data.DataProtocolProvider>();
|
||||
private _adapter = new Map<number, data.DataProvider>();
|
||||
|
||||
constructor(
|
||||
threadService: IThreadService
|
||||
@@ -40,71 +40,121 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
return ExtHostDataProtocol._handlePool++;
|
||||
}
|
||||
|
||||
private _runWithProvider<T>(handle: number, action: (p: data.DataProtocolProvider) => Thenable<T>): Thenable<T> {
|
||||
let provider = this._adapter.get(handle);
|
||||
return provider !== undefined
|
||||
? action(provider)
|
||||
: undefined;
|
||||
private _resolveProvider<P extends data.DataProvider>(handle: number): P {
|
||||
let provider = this._adapter.get(handle) as P;
|
||||
if (provider) {
|
||||
return provider;
|
||||
} else {
|
||||
throw new Error(`Unfound provider ${handle}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$registerProvider(provider: data.DataProtocolProvider): vscode.Disposable {
|
||||
private registerProvider(provider: data.DataProvider): vscode.Disposable {
|
||||
provider.handle = this._nextHandle();
|
||||
this._adapter.set(provider.handle, provider);
|
||||
|
||||
this._proxy.$registerProvider(provider.providerId, provider.handle);
|
||||
return this._createDisposable(provider.handle);
|
||||
};
|
||||
|
||||
$registerConnectionProvider(provider: data.ConnectionProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerConnectionProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerBackupProvider(provider: data.BackupProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerBackupProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerRestoreProvider(provider: data.RestoreProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerRestoreProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerScriptingProvider(provider: data.ScriptingProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerScriptingProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerQueryProvider(provider: data.QueryProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerQueryProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerMetadataProvider(provider: data.MetadataProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerMetadataProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerTaskServicesProvider(provider: data.TaskServicesProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerTaskServicesProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerFileBrowserProvider(provider: data.FileBrowserProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerFileBrowserProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerObjectExplorerProvider(provider: data.ObjectExplorerProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerObjectExplorerProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerProfilerProvider(provider: data.ProfilerProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerProfilerProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerAdminServicesProvider(provider: data.AdminServicesProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerAdminServicesProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
$registerCapabilitiesServiceProvider(provider: data.CapabilitiesProvider): vscode.Disposable {
|
||||
let rt = this.registerProvider(provider);
|
||||
this._proxy.$registerCapabilitiesServiceProvider(provider.providerId, provider.handle);
|
||||
return rt;
|
||||
}
|
||||
|
||||
// Capabilities Discovery handlers
|
||||
$getServerCapabilities(handle: number, client: data.DataProtocolClientCapabilities): Thenable<data.DataProtocolServerCapabilities> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.capabilitiesProvider ? provider.capabilitiesProvider.getServerCapabilities(client)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.CapabilitiesProvider>(handle).getServerCapabilities(client);
|
||||
}
|
||||
|
||||
// Connection Management handlers
|
||||
$connect(handle: number, connectionUri: string, connection: data.ConnectionInfo): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.connectionProvider ? provider.connectionProvider.connect(connectionUri, connection)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.ConnectionProvider>(handle).connect(connectionUri, connection);
|
||||
}
|
||||
|
||||
$disconnect(handle: number, connectionUri: string): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.connectionProvider ? provider.connectionProvider.disconnect(connectionUri)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.ConnectionProvider>(handle).disconnect(connectionUri);
|
||||
}
|
||||
|
||||
$cancelConnect(handle: number, connectionUri: string): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.connectionProvider ? provider.connectionProvider.cancelConnect(connectionUri)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.ConnectionProvider>(handle).cancelConnect(connectionUri);
|
||||
}
|
||||
|
||||
$changeDatabase(handle: number, connectionUri: string, newDatabase: string): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.connectionProvider ? provider.connectionProvider.changeDatabase(connectionUri, newDatabase)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.ConnectionProvider>(handle).changeDatabase(connectionUri, newDatabase);
|
||||
}
|
||||
|
||||
$listDatabases(handle: number, connectionUri: string): Thenable<data.ListDatabasesResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.connectionProvider ? provider.connectionProvider.listDatabases(connectionUri)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.ConnectionProvider>(handle).listDatabases(connectionUri);
|
||||
}
|
||||
|
||||
$rebuildIntelliSenseCache(handle: number, connectionUri: string): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.connectionProvider ? provider.connectionProvider.rebuildIntelliSenseCache(connectionUri)
|
||||
: undefined;
|
||||
});
|
||||
return this._resolveProvider<data.ConnectionProvider>(handle).rebuildIntelliSenseCache(connectionUri);
|
||||
}
|
||||
|
||||
$onConnectComplete(handle: number, connectionInfoSummary: data.ConnectionInfoSummary): void {
|
||||
@@ -127,45 +177,31 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
// Query Management handlers
|
||||
|
||||
$cancelQuery(handle: number, ownerUri: string): Thenable<data.QueryCancelResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.cancelQuery(ownerUri);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).cancelQuery(ownerUri);
|
||||
}
|
||||
|
||||
$runQuery(handle: number, ownerUri: string, selection: data.ISelectionData, runOptions?: data.ExecutionPlanOptions): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.runQuery(ownerUri, selection, runOptions);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).runQuery(ownerUri, selection, runOptions);
|
||||
}
|
||||
|
||||
$runQueryStatement(handle: number, ownerUri: string, line: number, column: number): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.runQueryStatement(ownerUri, line, column);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).runQueryStatement(ownerUri, line, column);
|
||||
}
|
||||
|
||||
$runQueryString(handle: number, ownerUri: string, queryString: string): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.runQueryString(ownerUri, queryString);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).runQueryString(ownerUri, queryString);
|
||||
}
|
||||
|
||||
$runQueryAndReturn(handle: number, ownerUri: string, queryString: string): Thenable<data.SimpleExecuteResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.runQueryAndReturn(ownerUri, queryString);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).runQueryAndReturn(ownerUri, queryString);
|
||||
}
|
||||
|
||||
$getQueryRows(handle: number, rowData: data.QueryExecuteSubsetParams): Thenable<data.QueryExecuteSubsetResult> {
|
||||
return this._runWithProvider(handle, (provider) => {
|
||||
return provider.queryProvider.getQueryRows(rowData);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).getQueryRows(rowData);
|
||||
}
|
||||
|
||||
$disposeQuery(handle: number, ownerUri: string): Thenable<void> {
|
||||
return this._runWithProvider(handle, (provider) => {
|
||||
return provider.queryProvider.disposeQuery(ownerUri);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).disposeQuery(ownerUri);
|
||||
}
|
||||
|
||||
$onQueryComplete(handle: number, result: data.QueryExecuteCompleteNotificationResult): void {
|
||||
@@ -185,64 +221,44 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
}
|
||||
|
||||
$saveResults(handle: number, requestParams: data.SaveResultsRequestParams): Thenable<data.SaveResultRequestResult> {
|
||||
return this._runWithProvider(handle, (provider) => {
|
||||
return provider.queryProvider.saveResults(requestParams);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).saveResults(requestParams);
|
||||
}
|
||||
|
||||
// Edit Data handlers
|
||||
$commitEdit(handle: number, ownerUri: string): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.commitEdit(ownerUri);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).commitEdit(ownerUri);
|
||||
}
|
||||
|
||||
$createRow(handle: number, ownerUri: string): Thenable<data.EditCreateRowResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.createRow(ownerUri);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).createRow(ownerUri);
|
||||
}
|
||||
|
||||
$deleteRow(handle: number, ownerUri: string, rowId: number): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.deleteRow(ownerUri, rowId);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).deleteRow(ownerUri, rowId);
|
||||
}
|
||||
|
||||
$disposeEdit(handle: number, ownerUri: string): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.disposeEdit(ownerUri);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).disposeEdit(ownerUri);
|
||||
}
|
||||
|
||||
$initializeEdit(handle: number, ownerUri: string, schemaName: string, objectName: string, objectType: string, rowLimit: number): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.initializeEdit(ownerUri, schemaName, objectName, objectType, rowLimit);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).initializeEdit(ownerUri, schemaName, objectName, objectType, rowLimit);
|
||||
}
|
||||
|
||||
$revertCell(handle: number, ownerUri: string, rowId: number, columnId: number): Thenable<data.EditRevertCellResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.revertCell(ownerUri, rowId, columnId);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).revertCell(ownerUri, rowId, columnId);
|
||||
}
|
||||
|
||||
$revertRow(handle: number, ownerUri: string, rowId: number): Thenable<void> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.revertRow(ownerUri, rowId);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).revertRow(ownerUri, rowId);
|
||||
}
|
||||
|
||||
$updateCell(handle: number, ownerUri: string, rowId: number, columnId: number, newValue: string): Thenable<data.EditUpdateCellResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.queryProvider.updateCell(ownerUri, rowId, columnId, newValue);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).updateCell(ownerUri, rowId, columnId, newValue);
|
||||
}
|
||||
|
||||
$getEditRows(handle: number, rowData: data.EditSubsetParams): Thenable<data.EditSubsetResult> {
|
||||
return this._runWithProvider(handle, (provider) => {
|
||||
return provider.queryProvider.getEditRows(rowData);
|
||||
});
|
||||
return this._resolveProvider<data.QueryProvider>(handle).getEditRows(rowData);
|
||||
}
|
||||
|
||||
$onEditSessionReady(handle: number, ownerUri: string, success: boolean, message: string): void {
|
||||
@@ -251,39 +267,36 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
|
||||
// Metadata handlers
|
||||
public $getMetadata(handle: number, connectionUri: string): Thenable<data.ProviderMetadata> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.metadataProvider ? provider.metadataProvider.getMetadata(connectionUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.MetadataProvider>(handle).getMetadata(connectionUri);
|
||||
}
|
||||
|
||||
public $getDatabases(handle: number, connectionUri: string): Thenable<string[]> {
|
||||
return this._resolveProvider<data.MetadataProvider>(handle).getDatabases(connectionUri);
|
||||
}
|
||||
|
||||
public $getTableInfo(handle: number, connectionUri: string, metadata: data.ObjectMetadata): Thenable<data.ColumnMetadata[]> {
|
||||
return this._resolveProvider<data.MetadataProvider>(handle).getTableInfo(connectionUri, metadata);
|
||||
}
|
||||
|
||||
public $getViewInfo(handle: number, connectionUri: string, metadata: data.ObjectMetadata): Thenable<data.ColumnMetadata[]> {
|
||||
return this._resolveProvider<data.MetadataProvider>(handle).getViewInfo(connectionUri, metadata);
|
||||
}
|
||||
|
||||
// Object Explorer Service
|
||||
public $createObjectExplorerSession(handle: number, connInfo: data.ConnectionInfo): Thenable<data.ObjectExplorerSessionResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.objectExplorerProvider ? provider.objectExplorerProvider.createNewSession(connInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.ObjectExplorerProvider>(handle).createNewSession(connInfo);
|
||||
}
|
||||
|
||||
public $expandObjectExplorerNode(handle: number, nodeInfo: data.ExpandNodeInfo): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.objectExplorerProvider ? provider.objectExplorerProvider.expandNode(nodeInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.ObjectExplorerProvider>(handle).expandNode(nodeInfo);
|
||||
}
|
||||
|
||||
public $refreshObjectExplorerNode(handle: number, nodeInfo: data.ExpandNodeInfo): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.objectExplorerProvider ? provider.objectExplorerProvider.refreshNode(nodeInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.ObjectExplorerProvider>(handle).refreshNode(nodeInfo);
|
||||
}
|
||||
|
||||
public $closeObjectExplorerSession(handle: number, closeSessionInfo: data.ObjectExplorerCloseSessionInfo): Thenable<data.ObjectExplorerCloseSessionResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.objectExplorerProvider ? provider.objectExplorerProvider.closeSession(closeSessionInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.ObjectExplorerProvider>(handle).closeSession(closeSessionInfo);
|
||||
}
|
||||
|
||||
public $onObjectExplorerSessionCreated(handle: number, response: data.ObjectExplorerSession): void {
|
||||
@@ -296,17 +309,11 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
|
||||
// Task Service
|
||||
public $getAllTasks(handle: number, listTasksParams: data.ListTasksParams): Thenable<data.ListTasksResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.taskServicesProvider ? provider.taskServicesProvider.getAllTasks(listTasksParams)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.TaskServicesProvider>(handle).getAllTasks(listTasksParams);
|
||||
}
|
||||
|
||||
public $cancelTask(handle: number, cancelTaskParams: data.CancelTaskParams): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.taskServicesProvider ? provider.taskServicesProvider.cancelTask(cancelTaskParams)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.TaskServicesProvider>(handle).cancelTask(cancelTaskParams);
|
||||
}
|
||||
|
||||
public $onTaskStatusChanged(handle: number, response: data.TaskProgressInfo): void {
|
||||
@@ -317,34 +324,10 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
this._proxy.$onTaskCreated(handle, response);
|
||||
}
|
||||
|
||||
public $getDatabases(handle: number, connectionUri: string): Thenable<string[]> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.metadataProvider ? provider.metadataProvider.getDatabases(connectionUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
public $getTableInfo(handle: number, connectionUri: string, metadata: data.ObjectMetadata): Thenable<data.ColumnMetadata[]> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.metadataProvider ? provider.metadataProvider.getTableInfo(connectionUri, metadata)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
public $getViewInfo(handle: number, connectionUri: string, metadata: data.ObjectMetadata): Thenable<data.ColumnMetadata[]> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.metadataProvider ? provider.metadataProvider.getViewInfo(connectionUri, metadata)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
// Scripting handlers
|
||||
|
||||
public $scriptAsOperation(handle: number, connectionUri: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): Thenable<data.ScriptingResult> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.scriptingProvider ? provider.scriptingProvider.scriptAsOperation(connectionUri, operation, metadata, paramDetails)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.ScriptingProvider>(handle).scriptAsOperation(connectionUri, operation, metadata, paramDetails);
|
||||
}
|
||||
|
||||
public $onScriptingComplete(handle: number, scriptingCompleteResult: data.ScriptingCompleteResult): void {
|
||||
@@ -355,110 +338,77 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
* Create a new database on the provided connection
|
||||
*/
|
||||
public $createDatabase(handle: number, connectionUri: string, database: data.DatabaseInfo): Thenable<data.CreateDatabaseResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.adminServicesProvider ? provider.adminServicesProvider.createDatabase(connectionUri, database)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.AdminServicesProvider>(handle).createDatabase(connectionUri, database);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new database on the provided connection
|
||||
*/
|
||||
public $getDefaultDatabaseInfo(handle: number, connectionUri: string): Thenable<data.DatabaseInfo> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.adminServicesProvider ? provider.adminServicesProvider.getDefaultDatabaseInfo(connectionUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.AdminServicesProvider>(handle).getDefaultDatabaseInfo(connectionUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the info on a database
|
||||
*/
|
||||
public $getDatabaseInfo(handle: number, connectionUri: string): Thenable<data.DatabaseInfo> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.adminServicesProvider ? provider.adminServicesProvider.getDatabaseInfo(connectionUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.AdminServicesProvider>(handle).getDatabaseInfo(connectionUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new login on the provided connection
|
||||
*/
|
||||
public $createLogin(handle: number, connectionUri: string, login: data.LoginInfo): Thenable<data.CreateLoginResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.adminServicesProvider ? provider.adminServicesProvider.createLogin(connectionUri, login)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.AdminServicesProvider>(handle).createLogin(connectionUri, login);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backup a database
|
||||
*/
|
||||
public $backup(handle: number, connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: data.TaskExecutionMode): Thenable<data.BackupResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.disasterRecoveryProvider ? provider.disasterRecoveryProvider.backup(connectionUri, backupInfo, taskExecutionMode)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.BackupProvider>(handle).backup(connectionUri, backupInfo, taskExecutionMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new database on the provided connection
|
||||
*/
|
||||
public $getBackupConfigInfo(handle: number, connectionUri: string): Thenable<data.BackupConfigInfo> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.disasterRecoveryProvider ? provider.disasterRecoveryProvider.getBackupConfigInfo(connectionUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.BackupProvider>(handle).getBackupConfigInfo(connectionUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores a database
|
||||
*/
|
||||
public $restore(handle: number, connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.disasterRecoveryProvider ? provider.disasterRecoveryProvider.restore(connectionUri, restoreInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.RestoreProvider>(handle).restore(connectionUri, restoreInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a plan for restoring a database
|
||||
*/
|
||||
public $getRestorePlan(handle: number, connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.disasterRecoveryProvider ? provider.disasterRecoveryProvider.getRestorePlan(connectionUri, restoreInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.RestoreProvider>(handle).getRestorePlan(connectionUri, restoreInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* cancels a restore plan
|
||||
*/
|
||||
public $cancelRestorePlan(handle: number, connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.disasterRecoveryProvider ? provider.disasterRecoveryProvider.cancelRestorePlan(connectionUri, restoreInfo)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.RestoreProvider>(handle).cancelRestorePlan(connectionUri, restoreInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets restore config Info
|
||||
*/
|
||||
public $getRestoreConfigInfo(handle: number, connectionUri: string): Thenable<data.RestoreConfigInfo> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.disasterRecoveryProvider ? provider.disasterRecoveryProvider.getRestoreConfigInfo(connectionUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.RestoreProvider>(handle).getRestoreConfigInfo(connectionUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a file browser
|
||||
*/
|
||||
public $openFileBrowser(handle: number, ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.fileBrowserProvider ? provider.fileBrowserProvider.openFileBrowser(ownerUri, expandPath, fileFilters, changeFilter)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.FileBrowserProvider>(handle).openFileBrowser(ownerUri, expandPath, fileFilters, changeFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,10 +422,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
* Expand a folder node
|
||||
*/
|
||||
public $expandFolderNode(handle: number, ownerUri: string, expandPath: string): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.fileBrowserProvider ? provider.fileBrowserProvider.expandFolderNode(ownerUri, expandPath)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.FileBrowserProvider>(handle).expandFolderNode(ownerUri, expandPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -489,10 +436,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
* Validate selected file path
|
||||
*/
|
||||
public $validateFilePaths(handle: number, ownerUri: string, serviceType: string, selectedFiles: string[]): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.fileBrowserProvider ? provider.fileBrowserProvider.validateFilePaths(ownerUri, serviceType, selectedFiles)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.FileBrowserProvider>(handle).validateFilePaths(ownerUri, serviceType, selectedFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,10 +450,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
* Close file browser
|
||||
*/
|
||||
public $closeFileBrowser(handle: number, ownerUri: string): Thenable<data.FileBrowserCloseResponse> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.fileBrowserProvider ? provider.fileBrowserProvider.closeFileBrowser(ownerUri)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
return this._resolveProvider<data.FileBrowserProvider>(handle).closeFileBrowser(ownerUri);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -519,21 +460,15 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
/**
|
||||
* Start a profiler session
|
||||
*/
|
||||
public $startSession(handle: number, sessionId: string): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.profilerProvider ? provider.profilerProvider.startSession(sessionId)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
public $startSession(handle: number, sessionId: string): Thenable<boolean> {
|
||||
return this._resolveProvider<data.ProfilerProvider>(handle).startSession(sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop a profiler session
|
||||
*/
|
||||
public $stopSession(handle: number, sessionId: string): Thenable<boolean> {
|
||||
return this._runWithProvider(handle, provider => {
|
||||
return provider.profilerProvider ? provider.profilerProvider.stopSession(sessionId)
|
||||
: Promise.resolve(undefined);
|
||||
});
|
||||
public $stopSession(handle: number, sessionId: string): Thenable<boolean> {
|
||||
return this._resolveProvider<data.ProfilerProvider>(handle).stopSession(sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,8 @@ import { IMetadataService } from 'sql/services/metadata/metadataService';
|
||||
import { IObjectExplorerService } from 'sql/parts/registeredServer/common/objectExplorerService';
|
||||
import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
import { IAdminService } from 'sql/parts/admin/common/adminService';
|
||||
import { IDisasterRecoveryService } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IBackupService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import { IRestoreService } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||
import { ITaskService } from 'sql/parts/taskHistory/common/taskService';
|
||||
import { IProfilerService } from 'sql/parts/profiler/service/interfaces';
|
||||
import { ISerializationService } from 'sql/services/serialization/serializationService';
|
||||
@@ -47,7 +48,8 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@IScriptingService private _scriptingService: IScriptingService,
|
||||
@IAdminService private _adminService: IAdminService,
|
||||
@IDisasterRecoveryService private _disasterRecoveryService: IDisasterRecoveryService,
|
||||
@IBackupService private _backupService: IBackupService,
|
||||
@IRestoreService private _restoreService: IRestoreService,
|
||||
@ITaskService private _taskService: ITaskService,
|
||||
@IProfilerService private _profilerService: IProfilerService,
|
||||
@ISerializationService private _serializationService: ISerializationService,
|
||||
@@ -66,10 +68,8 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
}
|
||||
|
||||
public $registerProvider(providerId: string, handle: number): TPromise<any> {
|
||||
let self = this;
|
||||
|
||||
// register connection management provider
|
||||
public $registerConnectionProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._connectionManagementService.registerProvider(providerId, <data.ConnectionProvider>{
|
||||
connect(connectionUri: string, connectionInfo: data.ConnectionInfo): Thenable<boolean> {
|
||||
return self._proxy.$connect(handle, connectionUri, connectionInfo);
|
||||
@@ -91,13 +91,11 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
}
|
||||
});
|
||||
|
||||
this._capabilitiesService.registerProvider(<data.CapabilitiesProvider>{
|
||||
getServerCapabilities(client: data.DataProtocolClientCapabilities): Thenable<data.DataProtocolServerCapabilities> {
|
||||
return self._proxy.$getServerCapabilities(handle, client);
|
||||
}
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// register query provider
|
||||
public $registerQueryProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._queryManagementService.addQueryRequestHandler(providerId, {
|
||||
cancelQuery(ownerUri: string): Thenable<data.QueryCancelResult> {
|
||||
return self._proxy.$cancelQuery(handle, ownerUri);
|
||||
@@ -161,6 +159,45 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerBackupProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._backupService.registerProvider(providerId, <data.BackupProvider>{
|
||||
backup(connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: data.TaskExecutionMode): Thenable<data.BackupResponse> {
|
||||
return self._proxy.$backup(handle, connectionUri, backupInfo, taskExecutionMode);
|
||||
},
|
||||
getBackupConfigInfo(connectionUri: string): Thenable<data.BackupConfigInfo> {
|
||||
return self._proxy.$getBackupConfigInfo(handle, connectionUri);
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerRestoreProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._restoreService.registerProvider(providerId, <data.RestoreProvider>{
|
||||
getRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse> {
|
||||
return self._proxy.$getRestorePlan(handle, connectionUri, restoreInfo);
|
||||
},
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean> {
|
||||
return self._proxy.$cancelRestorePlan(handle, connectionUri, restoreInfo);
|
||||
},
|
||||
restore(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse> {
|
||||
return self._proxy.$restore(handle, connectionUri, restoreInfo);
|
||||
},
|
||||
getRestoreConfigInfo(connectionUri: string): Thenable<data.RestoreConfigInfo> {
|
||||
return self._proxy.$getRestoreConfigInfo(handle, connectionUri);
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerMetadataProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._metadataService.registerProvider(providerId, <data.MetadataProvider>{
|
||||
getMetadata(connectionUri: string): Thenable<data.ProviderMetadata> {
|
||||
return self._proxy.$getMetadata(handle, connectionUri);
|
||||
@@ -176,6 +213,11 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerObjectExplorerProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._objectExplorerService.registerProvider(providerId, <data.ObjectExplorerProvider>{
|
||||
createNewSession(connection: data.ConnectionInfo): Thenable<data.ObjectExplorerSessionResponse> {
|
||||
return self._proxy.$createObjectExplorerSession(handle, connection);
|
||||
@@ -191,6 +233,11 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerTaskServicesProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._taskService.registerProvider(providerId, <data.TaskServicesProvider>{
|
||||
getAllTasks(listTasksParams: data.ListTasksParams): Thenable<data.ListTasksResponse> {
|
||||
return self._proxy.$getAllTasks(handle, listTasksParams);
|
||||
@@ -200,48 +247,22 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerScriptingProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._scriptingService.registerProvider(providerId, <data.ScriptingProvider>{
|
||||
scriptAsOperation(connectionUri: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): Thenable<data.ScriptingResult> {
|
||||
return self._proxy.$scriptAsOperation(handle, connectionUri, operation, metadata, paramDetails);
|
||||
}
|
||||
});
|
||||
|
||||
this._adminService.registerProvider(providerId, <data.AdminServicesProvider>{
|
||||
createDatabase(connectionUri: string, database: data.DatabaseInfo): Thenable<data.CreateDatabaseResponse> {
|
||||
return self._proxy.$createDatabase(handle, connectionUri, database);
|
||||
},
|
||||
getDefaultDatabaseInfo(connectionUri: string): Thenable<data.DatabaseInfo> {
|
||||
return self._proxy.$getDefaultDatabaseInfo(handle, connectionUri);
|
||||
},
|
||||
getDatabaseInfo(connectionUri: string): Thenable<data.DatabaseInfo> {
|
||||
return self._proxy.$getDatabaseInfo(handle, connectionUri);
|
||||
},
|
||||
createLogin(connectionUri: string, login: data.LoginInfo): Thenable<data.CreateLoginResponse> {
|
||||
return self._proxy.$createLogin(handle, connectionUri, login);
|
||||
}
|
||||
});
|
||||
|
||||
this._disasterRecoveryService.registerProvider(providerId, <data.DisasterRecoveryProvider>{
|
||||
backup(connectionUri: string, backupInfo: { [key: string]: any }, taskExecutionMode: data.TaskExecutionMode): Thenable<data.BackupResponse> {
|
||||
return self._proxy.$backup(handle, connectionUri, backupInfo, taskExecutionMode);
|
||||
},
|
||||
getBackupConfigInfo(connectionUri: string): Thenable<data.BackupConfigInfo> {
|
||||
return self._proxy.$getBackupConfigInfo(handle, connectionUri);
|
||||
},
|
||||
getRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestorePlanResponse> {
|
||||
return self._proxy.$getRestorePlan(handle, connectionUri, restoreInfo);
|
||||
},
|
||||
cancelRestorePlan(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<boolean> {
|
||||
return self._proxy.$cancelRestorePlan(handle, connectionUri, restoreInfo);
|
||||
},
|
||||
restore(connectionUri: string, restoreInfo: data.RestoreInfo): Thenable<data.RestoreResponse> {
|
||||
return self._proxy.$restore(handle, connectionUri, restoreInfo);
|
||||
},
|
||||
getRestoreConfigInfo(connectionUri: string): Thenable<data.RestoreConfigInfo> {
|
||||
return self._proxy.$getRestoreConfigInfo(handle, connectionUri);
|
||||
}
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerFileBrowserProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._fileBrowserService.registerProvider(providerId, <data.FileBrowserProvider>{
|
||||
openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean): Thenable<boolean> {
|
||||
return self._proxy.$openFileBrowser(handle, ownerUri, expandPath, fileFilters, changeFilter);
|
||||
@@ -257,6 +278,11 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerProfilerProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._profilerService.registerProvider(providerId, <data.ProfilerProvider>{
|
||||
startSession(sessionId: string): Thenable<boolean> {
|
||||
return self._proxy.$startSession(handle, sessionId);
|
||||
@@ -278,6 +304,37 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerAdminServicesProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._adminService.registerProvider(providerId, <data.AdminServicesProvider>{
|
||||
createDatabase(connectionUri: string, database: data.DatabaseInfo): Thenable<data.CreateDatabaseResponse> {
|
||||
return self._proxy.$createDatabase(handle, connectionUri, database);
|
||||
},
|
||||
getDefaultDatabaseInfo(connectionUri: string): Thenable<data.DatabaseInfo> {
|
||||
return self._proxy.$getDefaultDatabaseInfo(handle, connectionUri);
|
||||
},
|
||||
getDatabaseInfo(connectionUri: string): Thenable<data.DatabaseInfo> {
|
||||
return self._proxy.$getDatabaseInfo(handle, connectionUri);
|
||||
},
|
||||
createLogin(connectionUri: string, login: data.LoginInfo): Thenable<data.CreateLoginResponse> {
|
||||
return self._proxy.$createLogin(handle, connectionUri, login);
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $registerCapabilitiesServiceProvider(providerId: string, handle: number): TPromise<any> {
|
||||
const self = this;
|
||||
this._capabilitiesService.registerProvider(<data.CapabilitiesProvider>{
|
||||
getServerCapabilities(client: data.DataProtocolClientCapabilities): Thenable<data.DataProtocolServerCapabilities> {
|
||||
return self._proxy.$getServerCapabilities(handle, client);
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Connection Management handlers
|
||||
public $onConnectionComplete(handle: number, connectionInfoSummary: data.ConnectionInfoSummary): void {
|
||||
this._connectionManagementService.onConnectionComplete(handle, connectionInfoSummary);
|
||||
|
||||
@@ -22,7 +22,7 @@ import { ExtHostDataProtocol } from 'sql/workbench/api/node/extHostDataProtocol'
|
||||
import { ExtHostSerializationProvider } from 'sql/workbench/api/node/extHostSerializationProvider';
|
||||
import { ExtHostResourceProvider } from 'sql/workbench/api/node/extHostResourceProvider';
|
||||
import { ExtHostThreadService } from 'vs/workbench/services/thread/node/extHostThreadService';
|
||||
import * as sqlExtHostTypes from 'sql/workbench/api/node/sqlExtHostTypes';
|
||||
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration';
|
||||
|
||||
@@ -95,92 +95,141 @@ export function createApiFactory(
|
||||
}
|
||||
};
|
||||
|
||||
let registerConnectionProvider = (provider: data.ConnectionProvider): vscode.Disposable => {
|
||||
// Connection callbacks
|
||||
provider.registerOnConnectionComplete((connSummary: data.ConnectionInfoSummary) => {
|
||||
extHostDataProvider.$onConnectComplete(provider.handle, connSummary);
|
||||
});
|
||||
|
||||
provider.registerOnIntelliSenseCacheComplete((connectionUri: string) => {
|
||||
extHostDataProvider.$onIntelliSenseCacheComplete(provider.handle, connectionUri);
|
||||
});
|
||||
|
||||
provider.registerOnConnectionChanged((changedConnInfo: data.ChangedConnectionInfo) => {
|
||||
extHostDataProvider.$onConnectionChanged(provider.handle, changedConnInfo);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerConnectionProvider(provider);
|
||||
};
|
||||
|
||||
let registerQueryProvider = (provider: data.QueryProvider): vscode.Disposable => {
|
||||
provider.registerOnQueryComplete((result: data.QueryExecuteCompleteNotificationResult) => {
|
||||
extHostDataProvider.$onQueryComplete(provider.handle, result);
|
||||
});
|
||||
|
||||
provider.registerOnBatchStart((batchInfo: data.QueryExecuteBatchNotificationParams) => {
|
||||
extHostDataProvider.$onBatchStart(provider.handle, batchInfo);
|
||||
});
|
||||
|
||||
provider.registerOnBatchComplete((batchInfo: data.QueryExecuteBatchNotificationParams) => {
|
||||
extHostDataProvider.$onBatchComplete(provider.handle, batchInfo);
|
||||
});
|
||||
|
||||
provider.registerOnResultSetComplete((resultSetInfo: data.QueryExecuteResultSetCompleteNotificationParams) => {
|
||||
extHostDataProvider.$onResultSetComplete(provider.handle, resultSetInfo);
|
||||
});
|
||||
|
||||
provider.registerOnMessage((message: data.QueryExecuteMessageParams) => {
|
||||
extHostDataProvider.$onQueryMessage(provider.handle, message);
|
||||
});
|
||||
|
||||
provider.registerOnEditSessionReady((ownerUri: string, success: boolean, message: string) => {
|
||||
extHostDataProvider.$onEditSessionReady(provider.handle, ownerUri, success, message);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerQueryProvider(provider);
|
||||
};
|
||||
|
||||
let registerObjectExplorerProvider = (provider: data.ObjectExplorerProvider): vscode.Disposable => {
|
||||
provider.registerOnSessionCreated((response: data.ObjectExplorerSession) => {
|
||||
extHostDataProvider.$onObjectExplorerSessionCreated(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.registerOnExpandCompleted((response: data.ObjectExplorerExpandInfo) => {
|
||||
extHostDataProvider.$onObjectExplorerNodeExpanded(provider.handle, response);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerObjectExplorerProvider(provider);
|
||||
};
|
||||
|
||||
let registerTaskServicesProvider = (provider: data.TaskServicesProvider): vscode.Disposable => {
|
||||
provider.registerOnTaskCreated((response: data.TaskInfo) => {
|
||||
extHostDataProvider.$onTaskCreated(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.registerOnTaskStatusChanged((response: data.TaskProgressInfo) => {
|
||||
extHostDataProvider.$onTaskStatusChanged(provider.handle, response);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerTaskServicesProvider(provider);
|
||||
};
|
||||
|
||||
let registerFileBrowserProvider = (provider: data.FileBrowserProvider): vscode.Disposable => {
|
||||
provider.registerOnFileBrowserOpened((response: data.FileBrowserOpenedParams) => {
|
||||
extHostDataProvider.$onFileBrowserOpened(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.registerOnFolderNodeExpanded((response: data.FileBrowserExpandedParams) => {
|
||||
extHostDataProvider.$onFolderNodeExpanded(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.registerOnFilePathsValidated((response: data.FileBrowserValidatedParams) => {
|
||||
extHostDataProvider.$onFilePathsValidated(provider.handle, response);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerFileBrowserProvider(provider);
|
||||
};
|
||||
|
||||
let registerScriptingProvider = (provider: data.ScriptingProvider): vscode.Disposable => {
|
||||
provider.registerOnScriptingComplete((response: data.ScriptingCompleteResult) => {
|
||||
extHostDataProvider.$onScriptingComplete(provider.handle, response);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerScriptingProvider(provider);
|
||||
};
|
||||
|
||||
let registerProfilerProvider = (provider: data.ProfilerProvider): vscode.Disposable => {
|
||||
provider.registerOnSessionEventsAvailable((response: data.ProfilerSessionEvents) => {
|
||||
extHostDataProvider.$onSessionEventsAvailable(provider.handle, response);
|
||||
});
|
||||
|
||||
return extHostDataProvider.$registerProfilerProvider(provider);
|
||||
};
|
||||
|
||||
let registerBackupProvider = (provider: data.BackupProvider): vscode.Disposable => {
|
||||
return extHostDataProvider.$registerBackupProvider(provider);
|
||||
};
|
||||
|
||||
let registerRestoreProvider = (provider: data.RestoreProvider): vscode.Disposable => {
|
||||
return extHostDataProvider.$registerRestoreProvider(provider);
|
||||
};
|
||||
|
||||
let registerMetadataProvider = (provider: data.MetadataProvider): vscode.Disposable => {
|
||||
return extHostDataProvider.$registerMetadataProvider(provider);
|
||||
};
|
||||
|
||||
let registerCapabilitiesServiceProvider = (provider: data.CapabilitiesProvider): vscode.Disposable => {
|
||||
return extHostDataProvider.$registerCapabilitiesServiceProvider(provider);
|
||||
};
|
||||
|
||||
let registerAdminServicesProvider = (provider: data.AdminServicesProvider): vscode.Disposable => {
|
||||
return extHostDataProvider.$registerAdminServicesProvider(provider);
|
||||
};
|
||||
|
||||
// namespace: dataprotocol
|
||||
const dataprotocol: typeof data.dataprotocol = {
|
||||
registerProvider(provider: data.DataProtocolProvider): vscode.Disposable {
|
||||
// Connection callbacks
|
||||
provider.connectionProvider.registerOnConnectionComplete((connSummary: data.ConnectionInfoSummary) => {
|
||||
extHostDataProvider.$onConnectComplete(provider.handle, connSummary);
|
||||
});
|
||||
|
||||
provider.connectionProvider.registerOnIntelliSenseCacheComplete((connectionUri: string) => {
|
||||
extHostDataProvider.$onIntelliSenseCacheComplete(provider.handle, connectionUri);
|
||||
});
|
||||
|
||||
provider.connectionProvider.registerOnConnectionChanged((changedConnInfo: data.ChangedConnectionInfo) => {
|
||||
extHostDataProvider.$onConnectionChanged(provider.handle, changedConnInfo);
|
||||
});
|
||||
|
||||
// Query callbacks
|
||||
provider.queryProvider.registerOnQueryComplete((result: data.QueryExecuteCompleteNotificationResult) => {
|
||||
extHostDataProvider.$onQueryComplete(provider.handle, result);
|
||||
});
|
||||
|
||||
provider.queryProvider.registerOnBatchStart((batchInfo: data.QueryExecuteBatchNotificationParams) => {
|
||||
extHostDataProvider.$onBatchStart(provider.handle, batchInfo);
|
||||
});
|
||||
|
||||
provider.queryProvider.registerOnBatchComplete((batchInfo: data.QueryExecuteBatchNotificationParams) => {
|
||||
extHostDataProvider.$onBatchComplete(provider.handle, batchInfo);
|
||||
});
|
||||
|
||||
provider.queryProvider.registerOnResultSetComplete((resultSetInfo: data.QueryExecuteResultSetCompleteNotificationParams) => {
|
||||
extHostDataProvider.$onResultSetComplete(provider.handle, resultSetInfo);
|
||||
});
|
||||
|
||||
provider.queryProvider.registerOnMessage((message: data.QueryExecuteMessageParams) => {
|
||||
extHostDataProvider.$onQueryMessage(provider.handle, message);
|
||||
});
|
||||
|
||||
//OE callbacks
|
||||
provider.objectExplorerProvider.registerOnSessionCreated((response: data.ObjectExplorerSession) => {
|
||||
extHostDataProvider.$onObjectExplorerSessionCreated(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.objectExplorerProvider.registerOnExpandCompleted((response: data.ObjectExplorerExpandInfo) => {
|
||||
extHostDataProvider.$onObjectExplorerNodeExpanded(provider.handle, response);
|
||||
});
|
||||
|
||||
//Tasks callbacks
|
||||
provider.taskServicesProvider.registerOnTaskCreated((response: data.TaskInfo) => {
|
||||
extHostDataProvider.$onTaskCreated(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.taskServicesProvider.registerOnTaskStatusChanged((response: data.TaskProgressInfo) => {
|
||||
extHostDataProvider.$onTaskStatusChanged(provider.handle, response);
|
||||
});
|
||||
|
||||
// Edit Data callbacks
|
||||
provider.queryProvider.registerOnEditSessionReady((ownerUri: string, success: boolean, message: string) => {
|
||||
extHostDataProvider.$onEditSessionReady(provider.handle, ownerUri, success, message);
|
||||
});
|
||||
|
||||
// File browser callbacks
|
||||
provider.fileBrowserProvider.registerOnFileBrowserOpened((response: data.FileBrowserOpenedParams) => {
|
||||
extHostDataProvider.$onFileBrowserOpened(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.fileBrowserProvider.registerOnFolderNodeExpanded((response: data.FileBrowserExpandedParams) => {
|
||||
extHostDataProvider.$onFolderNodeExpanded(provider.handle, response);
|
||||
});
|
||||
|
||||
provider.fileBrowserProvider.registerOnFilePathsValidated((response: data.FileBrowserValidatedParams) => {
|
||||
extHostDataProvider.$onFilePathsValidated(provider.handle, response);
|
||||
});
|
||||
|
||||
// Scripting callbacks
|
||||
provider.scriptingProvider.registerOnScriptingComplete((response: data.ScriptingCompleteResult) => {
|
||||
extHostDataProvider.$onScriptingComplete(provider.handle, response);
|
||||
});
|
||||
|
||||
// Profiler callbacks
|
||||
provider.profilerProvider.registerOnSessionEventsAvailable((response: data.ProfilerSessionEvents) => {
|
||||
extHostDataProvider.$onSessionEventsAvailable(provider.handle, response);
|
||||
});
|
||||
|
||||
// Complete registration
|
||||
return extHostDataProvider.$registerProvider(provider);
|
||||
},
|
||||
registerBackupProvider,
|
||||
registerConnectionProvider,
|
||||
registerFileBrowserProvider,
|
||||
registerMetadataProvider,
|
||||
registerObjectExplorerProvider,
|
||||
registerProfilerProvider,
|
||||
registerRestoreProvider,
|
||||
registerScriptingProvider,
|
||||
registerTaskServicesProvider,
|
||||
registerQueryProvider,
|
||||
registerAdminServicesProvider,
|
||||
registerCapabilitiesServiceProvider,
|
||||
onDidChangeLanguageFlavor(listener: (e: data.DidChangeLanguageFlavorParams) => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) {
|
||||
return extHostDataProvider.onDidChangeLanguageFlavor(listener, thisArgs, disposables);
|
||||
}
|
||||
|
||||
@@ -352,7 +352,18 @@ export abstract class MainThreadResourceProviderShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadDataProtocolShape {
|
||||
$registerProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerConnectionProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerBackupProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerRestoreProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerScriptingProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerQueryProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerProfilerProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerObjectExplorerProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerMetadataProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerTaskServicesProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerFileBrowserProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerCapabilitiesServiceProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerAdminServicesProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$unregisterProvider(handle: number): TPromise<any> { throw ni(); }
|
||||
$onConnectionComplete(handle: number, connectionInfoSummary: data.ConnectionInfoSummary): void { throw ni(); }
|
||||
$onIntelliSenseCacheComplete(handle: number, connectionUri: string): void { throw ni(); }
|
||||
|
||||
@@ -9,7 +9,8 @@ import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IInsightsConfig } from 'sql/parts/dashboard/widgets/insights/interfaces';
|
||||
import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
import { IDisasterRecoveryUiService, IRestoreDialogController } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IRestoreDialogController } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||
import { IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import { IAngularEventingService, AngularEventType } from 'sql/services/angularEventing/angularEventingService';
|
||||
import { IInsightsDialogService } from 'sql/parts/insights/common/interfaces';
|
||||
import { IAdminService } from 'sql/parts/admin/common/adminService';
|
||||
@@ -284,7 +285,7 @@ export class BackupAction extends TaskAction {
|
||||
|
||||
constructor(
|
||||
id: string, label: string, icon: string,
|
||||
@IDisasterRecoveryUiService protected _disasterRecoveryService: IDisasterRecoveryUiService
|
||||
@IBackupUiService protected _backupUiService: IBackupUiService
|
||||
) {
|
||||
super(id, label, icon);
|
||||
}
|
||||
@@ -293,7 +294,7 @@ export class BackupAction extends TaskAction {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
TaskUtilities.showBackup(
|
||||
actionContext.profile,
|
||||
this._disasterRecoveryService,
|
||||
this._backupUiService,
|
||||
).then(
|
||||
result => {
|
||||
resolve(true);
|
||||
|
||||
@@ -14,7 +14,8 @@ import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
|
||||
import { IAdminService } from 'sql/parts/admin/common/adminService';
|
||||
import { IDisasterRecoveryUiService, IRestoreDialogController } from 'sql/parts/disasterRecovery/common/interfaces';
|
||||
import { IRestoreDialogController } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||
import { IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||
import { IInsightsConfig } from 'sql/parts/dashboard/widgets/insights/interfaces';
|
||||
import { IInsightsDialogService } from 'sql/parts/insights/common/interfaces';
|
||||
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
|
||||
@@ -314,9 +315,9 @@ export function showCreateLogin(uri: string, connection: IConnectionProfile, adm
|
||||
});
|
||||
}
|
||||
|
||||
export function showBackup(connection: IConnectionProfile, disasterRecoveryUiService: IDisasterRecoveryUiService): Promise<void> {
|
||||
export function showBackup(connection: IConnectionProfile, backupUiService: IBackupUiService): Promise<void> {
|
||||
return new Promise<void>((resolve) => {
|
||||
disasterRecoveryUiService.showBackup(connection);
|
||||
backupUiService.showBackup(connection);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user