mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -10,11 +10,13 @@ import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IMessageService, IConfirmation, Severity } from 'vs/platform/message/common/message';
|
||||
|
||||
import { error } from 'sql/base/common/log';
|
||||
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
|
||||
import { IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IConfirmationService, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
/**
|
||||
* Actions to add a new account
|
||||
@@ -79,7 +81,8 @@ export class RemoveAccountAction extends Action {
|
||||
|
||||
constructor(
|
||||
private _account: sqlops.Account,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@IConfirmationService private _confirmationService: IConfirmationService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IErrorMessageService private _errorMessageService: IErrorMessageService,
|
||||
@IAccountManagementService private _accountManagementService: IAccountManagementService
|
||||
) {
|
||||
@@ -97,23 +100,26 @@ export class RemoveAccountAction extends Action {
|
||||
type: 'question'
|
||||
};
|
||||
|
||||
let confirmPromise: boolean = this._messageService.confirm(confirm);
|
||||
if (!confirmPromise) {
|
||||
return TPromise.as(false);
|
||||
} else {
|
||||
return new TPromise((resolve, reject) => {
|
||||
self._accountManagementService.removeAccount(self._account.key)
|
||||
.then(
|
||||
(result) => { resolve(result); },
|
||||
(err) => {
|
||||
// Must handle here as this is an independent action
|
||||
self._errorMessageService.showDialog(Severity.Error,
|
||||
localize('removeAccountFailed', 'Failed to remove account'), err);
|
||||
resolve(false);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
return this._confirmationService.confirm(confirm).then(result => {
|
||||
if (!result) {
|
||||
return TPromise.as(false);
|
||||
} else {
|
||||
return new TPromise((resolve, reject) => {
|
||||
self._accountManagementService.removeAccount(self._account.key)
|
||||
.then(
|
||||
(result) => { resolve(result); },
|
||||
(err) => {
|
||||
// Must handle here as this is an independent action
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: localize('removeAccountFailed', 'Failed to remove account')
|
||||
});
|
||||
resolve(false);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { localize } from 'vs/nls';
|
||||
import { join } from 'path';
|
||||
|
||||
@@ -7,10 +7,11 @@ import nls = require('vs/nls');
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
/**
|
||||
* Workbench action to clear the recent connnections list
|
||||
@@ -24,7 +25,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
id: string,
|
||||
label: string,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService
|
||||
) {
|
||||
super(id, label);
|
||||
@@ -36,7 +37,13 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
return self.promptToClearRecentConnectionsList().then(result => {
|
||||
if (result) {
|
||||
self._connectionManagementService.clearRecentConnectionsList();
|
||||
self._messageService.show(Severity.Info, nls.localize('ClearedRecentConnections', 'Recent connections list cleared'));
|
||||
|
||||
const actions: INotificationActions = { primary: [ ] };
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: nls.localize('ClearedRecentConnections', 'Recent connections list cleared'),
|
||||
actions
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -203,7 +203,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
}
|
||||
|
||||
private handleShowUiComponent(input: OnShowUIResponse) {
|
||||
this._currentProviderType = input.selectedProviderType;
|
||||
if (input.selectedProviderType) {
|
||||
this._currentProviderType = input.selectedProviderType;
|
||||
}
|
||||
this._model.providerName = this.getCurrentProviderName();
|
||||
|
||||
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
|
||||
|
||||
@@ -30,12 +30,13 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, IConfirmation } from 'vs/platform/message/common/message';
|
||||
import { IConfirmationService, IChoiceService, IConfirmation, IConfirmationResult, Choice } from 'vs/platform/dialogs/common/dialogs';
|
||||
import * as styler from 'vs/platform/theme/common/styler';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
|
||||
|
||||
export interface OnShowUIResponse {
|
||||
selectedProviderType: string;
|
||||
@@ -89,7 +90,8 @@ export class ConnectionDialogWidget extends Modal {
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IMessageService private _messageService: IMessageService
|
||||
@IConfirmationService private _confirmationService: IConfirmationService,
|
||||
@IContextViewService private _contextViewService: IContextViewService
|
||||
) {
|
||||
super(localize('connection', 'Connection'), TelemetryKeys.Connection, _partService, telemetryService, contextKeyService, { hasSpinner: true, hasErrors: true });
|
||||
}
|
||||
@@ -99,7 +101,7 @@ export class ConnectionDialogWidget extends Modal {
|
||||
container.appendChild(connectionContainer.getHTMLElement());
|
||||
|
||||
this._bodyBuilder = new Builder(connectionContainer.getHTMLElement());
|
||||
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType);
|
||||
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType, this._contextViewService);
|
||||
|
||||
// Recent connection tab
|
||||
let recentConnectionTab = $('.connection-recent-tab');
|
||||
@@ -264,35 +266,15 @@ export class ConnectionDialogWidget extends Modal {
|
||||
type: 'question'
|
||||
};
|
||||
|
||||
// @SQLTODO
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
let confirmed: boolean = this._messageService.confirm(confirm);
|
||||
if (confirmed) {
|
||||
this._connectionManagementService.clearRecentConnectionsList();
|
||||
this.open(false);
|
||||
}
|
||||
resolve(confirmed);
|
||||
this._confirmationService.confirm(confirm).then((confirmed) => {
|
||||
if (confirmed) {
|
||||
this._connectionManagementService.clearRecentConnectionsList();
|
||||
this.open(false);
|
||||
}
|
||||
resolve(confirmed);
|
||||
});
|
||||
});
|
||||
|
||||
//this._messageService.confirm(confirm).then(confirmation => {
|
||||
// if (!confirmation.confirmed) {
|
||||
// return TPromise.as(false);
|
||||
// } else {
|
||||
// this._connectionManagementService.clearRecentConnectionsList();
|
||||
// this.open(false);
|
||||
// return TPromise.as(true);
|
||||
// }
|
||||
// });
|
||||
|
||||
// return this._messageService.confirm(confirm).then(confirmation => {
|
||||
// if (!confirmation.confirmed) {
|
||||
// return TPromise.as(false);
|
||||
// } else {
|
||||
// this._connectionManagementService.clearRecentConnectionsList();
|
||||
// this.open(false);
|
||||
// return TPromise.as(true);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
private createRecentConnectionList(): void {
|
||||
|
||||
@@ -97,14 +97,14 @@ export class ConnectionWidget {
|
||||
} else {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(Constants.sqlLogin);
|
||||
}
|
||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue);
|
||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService);
|
||||
}
|
||||
this._providerName = providerName;
|
||||
}
|
||||
|
||||
public createConnectionWidget(container: HTMLElement): void {
|
||||
this._serverGroupOptions = [this.DefaultServerGroup];
|
||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name);
|
||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService);
|
||||
this._previousGroupOption = this._serverGroupSelectBox.value;
|
||||
this._builder = $().div({ class: 'connection-table' }, (modelTableContent) => {
|
||||
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
|
||||
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import mouse = require('vs/base/browser/mouseEvent');
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
|
||||
@@ -27,7 +26,6 @@ export class RecentConnectionActionsProvider extends ContributableActionProvider
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Severity } from 'vs/platform/message/common/message';
|
||||
import { error } from 'sql/base/common/log';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insightRegistry';
|
||||
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
|
||||
|
||||
@@ -27,7 +27,6 @@ import { AngularDisposable } from 'sql/base/common/lifecycle';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { Severity } from 'vs/platform/message/common/message';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as nls from 'vs/nls';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
@@ -39,6 +38,7 @@ import * as objects from 'vs/base/common/objects';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
|
||||
|
||||
@@ -97,7 +97,10 @@ export abstract class DashboardPage extends AngularDisposable {
|
||||
protected init() {
|
||||
this.dashboardService.dashboardContextKey.set(this.context);
|
||||
if (!this.dashboardService.connectionManagementService.connectionInfo) {
|
||||
this.dashboardService.messageService.show(Severity.Warning, nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard'));
|
||||
this.dashboardService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard')
|
||||
});
|
||||
} else {
|
||||
let tempWidgets = this.dashboardService.getSettings<Array<WidgetConfig>>([this.context, 'widgets'].join('.'));
|
||||
this._widgetConfigLocation = 'default';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { localize } from 'vs/nls';
|
||||
import * as types from 'vs/base/common/types';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { localize } from 'vs/nls';
|
||||
import { join } from 'path';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
import { join } from 'path';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'vs/css!./webviewContent';
|
||||
import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef, ElementRef } from '@angular/core';
|
||||
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import Webview from 'vs/workbench/parts/html/browser/webview';
|
||||
import { Webview } from 'vs/workbench/parts/html/browser/webview';
|
||||
import { Parts } from 'vs/workbench/services/part/common/partService';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
@@ -80,7 +80,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
public setHtml(html: string): void {
|
||||
this._html = html;
|
||||
if (this._webview) {
|
||||
this._webview.contents = [html];
|
||||
this._webview.contents = html;
|
||||
this._webview.layout();
|
||||
}
|
||||
}
|
||||
@@ -102,21 +102,24 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
|
||||
this._webview = new Webview(this._el.nativeElement,
|
||||
this._dashboardService.partService.getContainer(Parts.EDITOR_PART),
|
||||
this._dashboardService.themeService,
|
||||
this._dashboardService.environmentService,
|
||||
this._dashboardService.contextViewService,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true,
|
||||
hideFind: true
|
||||
enableWrappedPostMessage: true
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
this._onMessageDisposable = this._webview.onMessage(e => {
|
||||
this._onMessage.fire(e);
|
||||
});
|
||||
this._webview.style(this._dashboardService.themeService.getTheme());
|
||||
if (this._html) {
|
||||
this._webview.contents = [this._html];
|
||||
this._webview.contents = this._html;
|
||||
}
|
||||
this._webview.layout();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationEditingService, IConfigurationValue } from 'vs/workbench/services/configuration/node/configurationEditingService';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
@@ -46,6 +45,8 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
const DASHBOARD_SETTINGS = 'dashboard';
|
||||
|
||||
@@ -131,7 +132,7 @@ export class DashboardServiceInterface extends AngularDisposable {
|
||||
private _configService = this._bootstrapService.configurationService;
|
||||
private _insightsDialogService = this._bootstrapService.insightsDialogService;
|
||||
private _contextViewService = this._bootstrapService.contextViewService;
|
||||
private _messageService = this._bootstrapService.messageService;
|
||||
private _notificationService = this._bootstrapService.notificationService;
|
||||
private _workspaceContextService = this._bootstrapService.workspaceContextService;
|
||||
private _storageService = this._bootstrapService.storageService;
|
||||
private _capabilitiesService = this._bootstrapService.capabilitiesService;
|
||||
@@ -140,6 +141,7 @@ export class DashboardServiceInterface extends AngularDisposable {
|
||||
private _dashboardWebviewService = this._bootstrapService.dashboardWebviewService;
|
||||
private _partService = this._bootstrapService.partService;
|
||||
private _angularEventingService = this._bootstrapService.angularEventingService;
|
||||
private _environmentService = this._bootstrapService.environmentService;
|
||||
|
||||
/* Special Services */
|
||||
private _metadataService: SingleConnectionMetadataService;
|
||||
@@ -177,8 +179,8 @@ export class DashboardServiceInterface extends AngularDisposable {
|
||||
super();
|
||||
}
|
||||
|
||||
public get messageService(): IMessageService {
|
||||
return this._messageService;
|
||||
public get notificationService(): INotificationService {
|
||||
return this._notificationService;
|
||||
}
|
||||
|
||||
public get configurationEditingService(): ConfigurationEditingService {
|
||||
@@ -229,6 +231,10 @@ export class DashboardServiceInterface extends AngularDisposable {
|
||||
return this._queryManagementService;
|
||||
}
|
||||
|
||||
public get environmentService(): IEnvironmentService {
|
||||
return this._environmentService;
|
||||
}
|
||||
|
||||
public get contextViewService(): IContextViewService {
|
||||
return this._contextViewService;
|
||||
}
|
||||
@@ -329,11 +335,17 @@ export class DashboardServiceInterface extends AngularDisposable {
|
||||
this._router.navigate(['database-dashboard']);
|
||||
}
|
||||
} else {
|
||||
this.messageService.show(Severity.Error, nls.localize('dashboard.changeDatabaseFailure', "Failed to change database"));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('dashboard.changeDatabaseFailure', "Failed to change database")
|
||||
});
|
||||
}
|
||||
},
|
||||
() => {
|
||||
this.messageService.show(Severity.Error, nls.localize('dashboard.changeDatabaseFailure', "Failed to change database"));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('dashboard.changeDatabaseFailure', "Failed to change database")
|
||||
});
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Extensions as InsightExtensions, IInsightRegistry } from 'sql/platform/
|
||||
import { IInsightsConfig } from './interfaces';
|
||||
import { insightsContribution, insightsSchema } from 'sql/parts/dashboard/widgets/insights/insightsWidgetSchemas';
|
||||
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
|
||||
const insightRegistry = Registry.as<IInsightRegistry>(InsightExtensions.InsightContribution);
|
||||
|
||||
@@ -127,8 +127,10 @@ export class TasksWidget extends DashboardWidget implements IDashboardWidget, On
|
||||
let label = $('div').safeInnerHtml(types.isString(action.title) ? action.title : action.title.value);
|
||||
let tile = $('div.task-tile').style('height', this._size + 'px').style('width', this._size + 'px');
|
||||
let innerTile = $('div');
|
||||
if (action.iconClass) {
|
||||
let icon = $('span.icon').addClass(action.iconClass);
|
||||
|
||||
// @SQLTODO - iconPath shouldn't be used as a CSS class
|
||||
if (action.iconPath && action.iconPath.dark) {
|
||||
let icon = $('span.icon').addClass(action.iconPath.dark);
|
||||
innerTile.append(icon);
|
||||
}
|
||||
innerTile.append(label);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Component, Inject, forwardRef, ChangeDetectorRef, OnInit, ViewChild, ElementRef } from '@angular/core';
|
||||
|
||||
import Webview from 'vs/workbench/parts/html/browser/webview';
|
||||
import { Webview } from 'vs/workbench/parts/html/browser/webview';
|
||||
import { Parts } from 'vs/workbench/services/part/common/partService';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -58,7 +58,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
public setHtml(html: string): void {
|
||||
this._html = html;
|
||||
if (this._webview) {
|
||||
this._webview.contents = [html];
|
||||
this._webview.contents = html;
|
||||
this._webview.layout();
|
||||
}
|
||||
}
|
||||
@@ -96,15 +96,17 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
if (this._onMessageDisposable) {
|
||||
this._onMessageDisposable.dispose();
|
||||
}
|
||||
this._webview = new Webview(this._el.nativeElement,
|
||||
this._webview = new Webview(
|
||||
this._el.nativeElement,
|
||||
this._dashboardService.partService.getContainer(Parts.EDITOR_PART),
|
||||
this._dashboardService.themeService,
|
||||
this._dashboardService.environmentService,
|
||||
this._dashboardService.contextViewService,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true,
|
||||
hideFind: true
|
||||
enableWrappedPostMessage: true
|
||||
}
|
||||
);
|
||||
this._onMessageDisposable = this._webview.onMessage(e => {
|
||||
@@ -112,7 +114,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
});
|
||||
this._webview.style(this._dashboardService.themeService.getTheme());
|
||||
if (this._html) {
|
||||
this._webview.contents = [this._html];
|
||||
this._webview.contents = this._html;
|
||||
}
|
||||
this._webview.layout();
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ export class BackupComponent {
|
||||
|
||||
this.recoveryBox = new InputBox(this.recoveryModelElement.nativeElement, this._bootstrapService.contextViewService, { placeholder: this.recoveryModel });
|
||||
// Set backup type
|
||||
this.backupTypeSelectBox = new SelectBox([], '');
|
||||
this.backupTypeSelectBox = new SelectBox([], '', this._bootstrapService.contextViewService);
|
||||
this.backupTypeSelectBox.render(this.backupTypeElement.nativeElement);
|
||||
|
||||
// Set copy-only check box
|
||||
@@ -264,13 +264,13 @@ export class BackupComponent {
|
||||
this.removePathButton.title = localize('removeFile', 'Remove files');
|
||||
|
||||
// Set compression
|
||||
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0]);
|
||||
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0], this._bootstrapService.contextViewService);
|
||||
this.compressionSelectBox.render(this.compressionElement.nativeElement);
|
||||
|
||||
// Set encryption
|
||||
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0]);
|
||||
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0], this._bootstrapService.contextViewService);
|
||||
this.algorithmSelectBox.render(this.encryptionAlgorithmElement.nativeElement);
|
||||
this.encryptorSelectBox = new SelectBox([], '');
|
||||
this.encryptorSelectBox = new SelectBox([], '', this._bootstrapService.contextViewService);
|
||||
this.encryptorSelectBox.render(this.encryptorElement.nativeElement);
|
||||
|
||||
// Set media
|
||||
|
||||
@@ -519,7 +519,7 @@ export class RestoreDialog extends Modal {
|
||||
});
|
||||
|
||||
inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => {
|
||||
selectBox = new SelectBox(options, selectedOption, inputCellContainer.getHTMLElement(), this._contextViewService);
|
||||
selectBox = new SelectBox(options, selectedOption, this._contextViewService, inputCellContainer.getHTMLElement());
|
||||
selectBox.render(inputCellContainer.getHTMLElement());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
|
||||
import { IConnectionManagementService, IConnectableInput, INewConnectionParams } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { EditSessionReadyParams } from 'sqlops';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import nls = require('vs/nls');
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
/**
|
||||
* Input for the EditDataEditor. This input is simply a wrapper around a QueryResultsInput for the QueryResultsEditor
|
||||
@@ -35,7 +36,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
constructor(private _uri: URI, private _schemaName, private _tableName,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IMessageService private _messageService: IMessageService
|
||||
@INotificationService private notificationService: INotificationService
|
||||
) {
|
||||
super();
|
||||
this._visible = false;
|
||||
@@ -116,7 +117,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
} else {
|
||||
this._refreshButtonEnabled = false;
|
||||
this._stopButtonEnabled = false;
|
||||
this._messageService.show(Severity.Error, result.message);
|
||||
|
||||
this.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: result.message
|
||||
});
|
||||
}
|
||||
this._editorInitializing.fire(false);
|
||||
this._updateTaskbar.fire(this);
|
||||
@@ -128,7 +133,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
|
||||
public onConnectReject(error?: string): void {
|
||||
if (error) {
|
||||
this._messageService.show(Severity.Error, nls.localize('connectionFailure', 'Edit Data Session Failed To Connect'));
|
||||
|
||||
this.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('connectionFailure', 'Edit Data Session Failed To Connect')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { EditDataEditor } from 'sql/parts/editData/editor/editDataEditor';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import nls = require('vs/nls');
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
const $ = dom.$;
|
||||
|
||||
/**
|
||||
@@ -65,7 +67,7 @@ export class RefreshTableAction extends EditDataAction {
|
||||
constructor(editor: EditDataEditor,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IConnectionManagementService _connectionManagementService: IConnectionManagementService,
|
||||
@IMessageService private _messageService: IMessageService
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
) {
|
||||
super(editor, RefreshTableAction.ID, RefreshTableAction.EnabledClass, _connectionManagementService);
|
||||
this.label = nls.localize('editData.refresh', 'Refresh');
|
||||
@@ -77,7 +79,10 @@ export class RefreshTableAction extends EditDataAction {
|
||||
this._queryModelService.disposeEdit(input.uri).then((result) => {
|
||||
this._queryModelService.initializeEdit(input.uri, input.schemaName, input.tableName, input.objectType, input.rowLimit);
|
||||
}, error => {
|
||||
this._messageService.show(Severity.Error, nls.localize('disposeEditFailure', 'Dispose Edit Failed With Error: ') + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('disposeEditFailure', 'Dispose Edit Failed With Error: ') + error
|
||||
});
|
||||
});
|
||||
}
|
||||
return TPromise.as(null);
|
||||
@@ -147,12 +152,14 @@ export class ChangeMaxRowsActionItem extends EventEmitter implements IActionItem
|
||||
private _options: string[];
|
||||
private _currentOptionsIndex: number;
|
||||
|
||||
constructor(private _editor: EditDataEditor) {
|
||||
constructor(
|
||||
private _editor: EditDataEditor,
|
||||
@IContextViewService contextViewService: IContextViewService) {
|
||||
super();
|
||||
this._options = ['200', '1000', '10000'];
|
||||
this._currentOptionsIndex = 0;
|
||||
this.toDispose = [];
|
||||
this.selectBox = new SelectBox([], -1);
|
||||
this.selectBox = new SelectBox([], -1, contextViewService);
|
||||
this._registerListeners();
|
||||
this._refreshOptions();
|
||||
this.defaultRowCount = Number(this._options[this._currentOptionsIndex]);
|
||||
|
||||
@@ -96,7 +96,7 @@ export class FileBrowserDialog extends Modal {
|
||||
let pathBuilder = DialogHelper.appendRow(tableContainer, pathLabel, 'file-input-label', 'file-input-box');
|
||||
this._filePathInputBox = new InputBox(pathBuilder.getHTMLElement(), this._contextViewService);
|
||||
|
||||
this._fileFilterSelectBox = new SelectBox(['*'], '*');
|
||||
this._fileFilterSelectBox = new SelectBox(['*'], '*', this._contextViewService);
|
||||
let filterLabel = localize('fileFilter', 'Files of type');
|
||||
let filterBuilder = DialogHelper.appendRow(tableContainer, filterLabel, 'file-input-label', 'file-input-box');
|
||||
DialogHelper.appendInputSelectBox(filterBuilder, this._fileFilterSelectBox);
|
||||
|
||||
@@ -109,7 +109,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
|
||||
this._initActionBar();
|
||||
|
||||
// Init chart type dropdown
|
||||
this.chartTypesSelectBox = new SelectBox(insightRegistry.getAllIds(), this.getDefaultChartType());
|
||||
this.chartTypesSelectBox = new SelectBox(insightRegistry.getAllIds(), this.getDefaultChartType(), this._bootstrapService.contextViewService);
|
||||
this.chartTypesSelectBox.render(this.chartTypesElement.nativeElement);
|
||||
this.chartTypesSelectBox.onDidSelect(selected => this.onChartChanged());
|
||||
this._disposables.push(attachSelectBoxStyler(this.chartTypesSelectBox, this._bootstrapService.themeService));
|
||||
@@ -129,7 +129,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
|
||||
});
|
||||
|
||||
// Init legend dropdown
|
||||
this.legendSelectBox = new SelectBox(this.legendOptions, this._chartConfig.legendPosition);
|
||||
this.legendSelectBox = new SelectBox(this.legendOptions, this._chartConfig.legendPosition, this._bootstrapService.contextViewService);
|
||||
this.legendSelectBox.render(this.legendElement.nativeElement);
|
||||
this.legendSelectBox.onDidSelect(selected => this.onLegendChanged());
|
||||
this._disposables.push(attachSelectBoxStyler(this.legendSelectBox, this._bootstrapService.themeService));
|
||||
@@ -209,35 +209,37 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
|
||||
}
|
||||
|
||||
public saveChart(): void {
|
||||
let filePath = this.promptForFilepath();
|
||||
let data = this._chartComponent.getCanvasData();
|
||||
if (!data) {
|
||||
this.showError(this.chartNotFoundError);
|
||||
return;
|
||||
}
|
||||
if (filePath) {
|
||||
let buffer = this.decodeBase64Image(data);
|
||||
pfs.writeFile(filePath, buffer).then(undefined, (err) => {
|
||||
if (err) {
|
||||
this.showError(err.message);
|
||||
} else {
|
||||
let fileUri = URI.from({ scheme: PathUtilities.FILE_SCHEMA, path: filePath });
|
||||
this._bootstrapService.windowsService.openExternal(fileUri.toString());
|
||||
this._bootstrapService.messageService.show(Severity.Info, nls.localize('chartSaved', 'Saved Chart to path: {0}', filePath));
|
||||
}
|
||||
});
|
||||
}
|
||||
this.promptForFilepath().then(filePath => {
|
||||
let data = this._chartComponent.getCanvasData();
|
||||
if (!data) {
|
||||
this.showError(this.chartNotFoundError);
|
||||
return;
|
||||
}
|
||||
if (filePath) {
|
||||
let buffer = this.decodeBase64Image(data);
|
||||
pfs.writeFile(filePath, buffer).then(undefined, (err) => {
|
||||
if (err) {
|
||||
this.showError(err.message);
|
||||
} else {
|
||||
let fileUri = URI.from({ scheme: PathUtilities.FILE_SCHEMA, path: filePath });
|
||||
this._bootstrapService.windowsService.openExternal(fileUri.toString());
|
||||
this._bootstrapService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('chartSaved', 'Saved Chart to path: {0}', filePath)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private promptForFilepath(): string {
|
||||
private promptForFilepath(): Thenable<string> {
|
||||
let filepathPlaceHolder = PathUtilities.resolveCurrentDirectory(this.getActiveUriString(), PathUtilities.getRootPath(this._bootstrapService.workspaceContextService));
|
||||
filepathPlaceHolder = paths.join(filepathPlaceHolder, 'chart.png');
|
||||
|
||||
let filePath: string = this._bootstrapService.windowService.showSaveDialog({
|
||||
return this._bootstrapService.windowService.showSaveDialog({
|
||||
title: nls.localize('chartViewer.saveAsFileTitle', 'Choose Results File'),
|
||||
defaultPath: paths.normalize(filepathPlaceHolder, true)
|
||||
});
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private decodeBase64Image(data: string): Buffer {
|
||||
@@ -282,7 +284,10 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
|
||||
}
|
||||
|
||||
private showError(errorMsg: string) {
|
||||
this._bootstrapService.messageService.show(Severity.Error, errorMsg);
|
||||
this._bootstrapService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: errorMsg
|
||||
});
|
||||
}
|
||||
|
||||
private getGridItemConfig(): NgGridItemConfig {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
export interface IChartViewActionContext {
|
||||
copyChart(): void;
|
||||
@@ -23,7 +23,7 @@ export class ChartViewActionBase extends Action {
|
||||
id: string,
|
||||
label: string,
|
||||
enabledClass: string,
|
||||
protected messageService: IMessageService
|
||||
protected notificationService: INotificationService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
@@ -51,7 +51,10 @@ export class ChartViewActionBase extends Action {
|
||||
protected doRun(context: IChartViewActionContext, runAction: Function): TPromise<boolean> {
|
||||
if (!context) {
|
||||
// TODO implement support for finding chart view in active window
|
||||
this.messageService.show(Severity.Error, nls.localize('chartContextRequired', 'Chart View context is required to run this action'));
|
||||
this.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('chartContextRequired', 'Chart View context is required to run this action')
|
||||
});
|
||||
return TPromise.as(false);
|
||||
}
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
@@ -66,9 +69,9 @@ export class CreateInsightAction extends ChartViewActionBase {
|
||||
public static ID = 'chartview.createInsight';
|
||||
public static LABEL = nls.localize('createInsightLabel', "Create Insight");
|
||||
|
||||
constructor(@IMessageService messageService: IMessageService
|
||||
constructor(@INotificationService notificationService: INotificationService
|
||||
) {
|
||||
super(CreateInsightAction.ID, CreateInsightAction.LABEL, 'createInsight', messageService);
|
||||
super(CreateInsightAction.ID, CreateInsightAction.LABEL, 'createInsight', notificationService);
|
||||
}
|
||||
|
||||
public run(context: IChartViewActionContext): TPromise<boolean> {
|
||||
@@ -80,9 +83,9 @@ export class CopyAction extends ChartViewActionBase {
|
||||
public static ID = 'chartview.copy';
|
||||
public static LABEL = nls.localize('copyChartLabel', "Copy as image");
|
||||
|
||||
constructor(@IMessageService messageService: IMessageService
|
||||
constructor(@INotificationService notificationService: INotificationService
|
||||
) {
|
||||
super(CopyAction.ID, CopyAction.LABEL, 'copyImage', messageService);
|
||||
super(CopyAction.ID, CopyAction.LABEL, 'copyImage', notificationService);
|
||||
}
|
||||
|
||||
public run(context: IChartViewActionContext): TPromise<boolean> {
|
||||
@@ -94,9 +97,9 @@ export class SaveImageAction extends ChartViewActionBase {
|
||||
public static ID = 'chartview.saveImage';
|
||||
public static LABEL = nls.localize('saveImageLabel', "Save as image");
|
||||
|
||||
constructor(@IMessageService messageService: IMessageService
|
||||
constructor(@INotificationService notificationService: INotificationService
|
||||
) {
|
||||
super(SaveImageAction.ID, SaveImageAction.LABEL, 'saveAsImage', messageService);
|
||||
super(SaveImageAction.ID, SaveImageAction.LABEL, 'saveAsImage', notificationService);
|
||||
}
|
||||
|
||||
public run(context: IChartViewActionContext): TPromise<boolean> {
|
||||
|
||||
@@ -17,9 +17,9 @@ import Severity from 'vs/base/common/severity';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export class InsightsDialogController {
|
||||
private _queryRunner: QueryRunner;
|
||||
@@ -30,7 +30,7 @@ export class InsightsDialogController {
|
||||
|
||||
constructor(
|
||||
private _model: IInsightsDialogModel,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IErrorMessageService private _errorMessageService: IErrorMessageService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@@ -41,7 +41,10 @@ export class InsightsDialogController {
|
||||
// execute string
|
||||
if (typeof input === 'object') {
|
||||
if (connectionProfile === undefined) {
|
||||
this._messageService.show(Severity.Error, nls.localize("insightsInputError", "No Connection Profile was passed to insights flyout"));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize("insightsInputError", "No Connection Profile was passed to insights flyout")
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (types.isStringArray(input.query)) {
|
||||
@@ -88,14 +91,20 @@ export class InsightsDialogController {
|
||||
}).then(() => resolve());
|
||||
},
|
||||
error => {
|
||||
this._messageService.show(Severity.Error, nls.localize("insightsFileError", "There was an error reading the query file: ") + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize("insightsFileError", "There was an error reading the query file: ") + error
|
||||
});
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
error('Error reading details Query: ', input);
|
||||
this._messageService.show(Severity.Error, nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile"));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile")
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
|
||||
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { IJobManagementService } from '../common/interfaces';
|
||||
@@ -23,6 +22,8 @@ import { JobHistoryController, JobHistoryDataSource,
|
||||
import { JobStepsViewComponent } from 'sql/parts/jobManagement/views/jobStepsView.component';
|
||||
import { JobStepsViewRow } from './jobStepsViewTree';
|
||||
import { localize } from 'vs/nls';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
export const DASHBOARD_SELECTOR: string = 'jobhistory-component';
|
||||
|
||||
@@ -50,7 +51,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
||||
private _stepRows: JobStepsViewRow[] = [];
|
||||
private _showSteps: boolean = false;
|
||||
private _runStatus: string = undefined;
|
||||
private _messageService: IMessageService;
|
||||
private _notificationService: INotificationService;
|
||||
|
||||
constructor(
|
||||
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
|
||||
@@ -61,7 +62,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
||||
) {
|
||||
super();
|
||||
this._jobManagementService = bootstrapService.jobManagementService;
|
||||
this._messageService = bootstrapService.messageService;
|
||||
this._notificationService = bootstrapService.notificationService;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -157,17 +158,26 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
||||
switch (action) {
|
||||
case ('run'):
|
||||
var startMsg = localize('jobSuccessfullyStarted', 'The job was successfully started.');
|
||||
this._messageService.show(Severity.Info, startMsg);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: startMsg
|
||||
});
|
||||
break;
|
||||
case ('stop'):
|
||||
var stopMsg = localize('jobSuccessfullyStopped', 'The job was successfully stopped.');
|
||||
this._messageService.show(Severity.Info, stopMsg);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: stopMsg
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this._messageService.show(Severity.Error, result.errorMessage);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: result.errorMessage
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -235,7 +235,11 @@ export class NewProfilerAction extends Task {
|
||||
private _connectionProfile: ConnectionProfile;
|
||||
|
||||
constructor() {
|
||||
super({ id: NewProfilerAction.ID, title: NewProfilerAction.LABEL, iconClass: NewProfilerAction.ICON });
|
||||
super({
|
||||
id: NewProfilerAction.ID,
|
||||
title: NewProfilerAction.LABEL,
|
||||
iconPath: { dark: NewProfilerAction.ICON, light: NewProfilerAction.ICON }
|
||||
});
|
||||
}
|
||||
|
||||
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
|
||||
|
||||
@@ -25,6 +25,7 @@ import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
|
||||
class EventItem {
|
||||
|
||||
@@ -314,7 +315,8 @@ export class ProfilerColumnEditorDialog extends Modal {
|
||||
@IPartService _partService: IPartService,
|
||||
@IThemeService private _themeService: IThemeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextViewService private _contextViewService: IContextViewService
|
||||
) {
|
||||
super(nls.localize('profilerColumnDialog.profiler', 'Profiler'), TelemetryKeys.Profiler, _partService, telemetryService, contextKeyService);
|
||||
}
|
||||
@@ -329,7 +331,7 @@ export class ProfilerColumnEditorDialog extends Modal {
|
||||
protected renderBody(container: HTMLElement): void {
|
||||
let builder = new Builder(container);
|
||||
builder.div({}, b => {
|
||||
this._selectBox = new SelectBox(this._options, 0);
|
||||
this._selectBox = new SelectBox(this._options, 0, this._contextViewService);
|
||||
this._selectBox.render(b.getHTMLElement());
|
||||
this._register(this._selectBox.onDidSelect(e => {
|
||||
this._selectedValue = e.index;
|
||||
|
||||
@@ -28,11 +28,11 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
|
||||
import { ProfilerResourceEditor } from './profilerResourceEditor';
|
||||
import { SplitView, View, Orientation, IViewOptions } from 'sql/base/browser/ui/splitview/splitview';
|
||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -97,7 +97,7 @@ export interface IDetailData {
|
||||
export class ProfilerEditor extends BaseEditor {
|
||||
public static ID: string = 'workbench.editor.profiler';
|
||||
private _editor: ProfilerResourceEditor;
|
||||
private _editorModel: IModel;
|
||||
private _editorModel: ITextModel;
|
||||
private _editorInput: UntitledEditorInput;
|
||||
private _splitView: SplitView;
|
||||
private _container: HTMLElement;
|
||||
@@ -189,7 +189,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
this._autoscrollAction = this._instantiationService.createInstance(Actions.ProfilerAutoScroll, Actions.ProfilerAutoScroll.ID, Actions.ProfilerAutoScroll.LABEL);
|
||||
|
||||
this._sessionTemplates = this._profilerService.getSessionTemplates();
|
||||
this._sessionTemplateSelector = new SelectBox(this._sessionTemplates.map(i => i.name), 'Standard');
|
||||
this._sessionTemplateSelector = new SelectBox(this._sessionTemplates.map(i => i.name), 'Standard', this._contextViewService);
|
||||
this._register(this._sessionTemplateSelector.onDidSelect(e => {
|
||||
if (this.input) {
|
||||
this.input.sessionTemplate = this._sessionTemplates.find(i => i.name === e.selected);
|
||||
@@ -304,7 +304,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
editorContainer.className = 'profiler-editor';
|
||||
this._editor.create(new Builder(editorContainer));
|
||||
this._editor.setVisible(true);
|
||||
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: UNTITLED_SCHEMA }), false, 'sql', '', '');
|
||||
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: Schemas.untitled }), false, 'sql', '', '');
|
||||
this._editor.setInput(this._editorInput, undefined);
|
||||
this._editorInput.resolve().then(model => this._editorModel = model.textEditorModel);
|
||||
return editorContainer;
|
||||
|
||||
@@ -11,7 +11,6 @@ import { IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import errors = require('vs/base/common/errors');
|
||||
@@ -23,6 +22,8 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
|
||||
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
|
||||
|
||||
import { DidChangeLanguageFlavorParams } from 'sqlops';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export interface ISqlProviderEntry extends IPickOpenEntry {
|
||||
providerId: string;
|
||||
@@ -173,7 +174,7 @@ export class ChangeFlavorAction extends Action {
|
||||
actionLabel: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
super(actionId, actionLabel);
|
||||
@@ -213,7 +214,11 @@ export class ChangeFlavorAction extends Action {
|
||||
}
|
||||
|
||||
private _showMessage(sev: Severity, message: string): TPromise<any> {
|
||||
this._messageService.show(sev, message);
|
||||
this._notificationService.notify({
|
||||
severity: sev,
|
||||
message: message
|
||||
});
|
||||
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> { return this._sql.resolve(); }
|
||||
public save(): TPromise<boolean> { return this._sql.save(); }
|
||||
public isDirty(): boolean { return this._sql.isDirty(); }
|
||||
public confirmSave(): ConfirmResult { return this._sql.confirmSave(); }
|
||||
public confirmSave(): TPromise<ConfirmResult> { return this._sql.confirmSave(); }
|
||||
public getResource(): URI { return this._sql.getResource(); }
|
||||
public getEncoding(): string { return this._sql.getEncoding(); }
|
||||
public suggestFileName(): string { return this._sql.suggestFileName(); }
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ISaveRequest, SaveFormat } from 'sql/parts/grid/common/interfaces';
|
||||
import * as PathUtilities from 'sql/common/pathUtilities';
|
||||
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IOutputService, IOutputChannel, IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/parts/output/common/output';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -21,13 +20,16 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as pretty from 'pretty-data';
|
||||
|
||||
import { ISlickRange } from 'angular2-slickgrid';
|
||||
import * as path from 'path';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
let prevSavePath: string;
|
||||
|
||||
@@ -43,7 +45,6 @@ export class ResultSerializer {
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@IOutputService private _outputService: IOutputService,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
|
||||
@@ -51,7 +52,8 @@ export class ResultSerializer {
|
||||
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
|
||||
@IWindowsService private _windowsService: IWindowsService,
|
||||
@IWindowService private _windowService: IWindowService,
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
|
||||
@INotificationService private _notificationService: INotificationService
|
||||
) { }
|
||||
|
||||
/**
|
||||
@@ -62,11 +64,12 @@ export class ResultSerializer {
|
||||
this._uri = uri;
|
||||
|
||||
// prompt for filepath
|
||||
let filePath = self.promptForFilepath(saveRequest);
|
||||
if (filePath) {
|
||||
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
return self.promptForFilepath(saveRequest).then(filePath => {
|
||||
if (filePath) {
|
||||
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +106,7 @@ export class ResultSerializer {
|
||||
private getUntitledFileUri(columnName: string): URI {
|
||||
let fileName = columnName;
|
||||
|
||||
let uri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
|
||||
let uri: URI = URI.from({ scheme: Schemas.untitled, path: fileName });
|
||||
|
||||
// If the current filename is taken, try another up to a max number
|
||||
if (this._untitledEditorService.exists(uri)) {
|
||||
@@ -111,7 +114,7 @@ export class ResultSerializer {
|
||||
while (i < ResultSerializer.MAX_FILENAMES
|
||||
&& this._untitledEditorService.exists(uri)) {
|
||||
fileName = [columnName, i.toString()].join('-');
|
||||
uri = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
|
||||
uri = URI.from({ scheme: Schemas.untitled, path: fileName });
|
||||
i++;
|
||||
}
|
||||
if (this._untitledEditorService.exists(uri)) {
|
||||
@@ -140,16 +143,16 @@ export class ResultSerializer {
|
||||
this.outputChannel.append(message);
|
||||
}
|
||||
|
||||
private promptForFilepath(saveRequest: ISaveRequest): string {
|
||||
private promptForFilepath(saveRequest: ISaveRequest): Thenable<string> {
|
||||
let filepathPlaceHolder = (prevSavePath) ? prevSavePath : PathUtilities.resolveCurrentDirectory(this._uri, this.rootPath);
|
||||
filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(saveRequest));
|
||||
|
||||
let filePath: string = this._windowService.showSaveDialog({
|
||||
return this._windowService.showSaveDialog({
|
||||
title: nls.localize('resultsSerializer.saveAsFileTitle', 'Choose Results File'),
|
||||
defaultPath: paths.normalize(filepathPlaceHolder, true)
|
||||
}).then(filePath => {
|
||||
prevSavePath = filePath;
|
||||
return Promise.resolve(filePath);
|
||||
});
|
||||
prevSavePath = filePath;
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private getResultsDefaultFilename(saveRequest: ISaveRequest): string {
|
||||
@@ -249,10 +252,16 @@ export class ResultSerializer {
|
||||
// send message to the sqlserverclient for converting results to the requested format and saving to filepath
|
||||
return this._queryManagementService.saveResults(saveResultsParams).then(result => {
|
||||
if (result.messages) {
|
||||
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + result.messages);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: LocalizedConstants.msgSaveFailed + result.messages
|
||||
});
|
||||
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + result.messages);
|
||||
} else {
|
||||
this._messageService.show(Severity.Info, LocalizedConstants.msgSaveSucceeded + this._filePath);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: LocalizedConstants.msgSaveSucceeded + this._filePath
|
||||
});
|
||||
this.logToOutputChannel(LocalizedConstants.msgSaveSucceeded + filePath);
|
||||
this.openSavedFile(this._filePath, format);
|
||||
}
|
||||
@@ -260,7 +269,10 @@ export class ResultSerializer {
|
||||
// Telemetry.sendTelemetryEvent('SavedResults', { 'type': format });
|
||||
|
||||
}, error => {
|
||||
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: LocalizedConstants.msgSaveFailed + error
|
||||
});
|
||||
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + error);
|
||||
});
|
||||
}
|
||||
@@ -280,7 +292,10 @@ export class ResultSerializer {
|
||||
this._editorService.openEditor({ resource: uri }).then((result) => {
|
||||
|
||||
}, (error: any) => {
|
||||
this._messageService.show(Severity.Error, error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: error
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -296,7 +311,10 @@ export class ResultSerializer {
|
||||
(success) => {
|
||||
},
|
||||
(error: any) => {
|
||||
this._messageService.show(Severity.Error, error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: error
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
import { ISelectionData } from 'sqlops';
|
||||
@@ -24,6 +23,8 @@ import {
|
||||
} from 'sql/parts/connection/common/connectionManagement';
|
||||
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
/**
|
||||
* Action class that query-based Actions will extend. This base class automatically handles activating and
|
||||
@@ -436,7 +437,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
|
||||
private _editor: QueryEditor,
|
||||
private _action: ListDatabasesAction,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IContextViewService contextViewProvider: IContextViewService,
|
||||
@IThemeService themeService: IThemeService
|
||||
) {
|
||||
@@ -514,14 +515,19 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
|
||||
result => {
|
||||
if (!result) {
|
||||
this.resetDatabaseName();
|
||||
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failed', "Failed to change database"));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('changeDatabase.failed', "Failed to change database")
|
||||
});
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.resetDatabaseName();
|
||||
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error));
|
||||
}
|
||||
);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private getCurrentDatabaseName() {
|
||||
|
||||
@@ -21,11 +21,12 @@ import * as nls from 'vs/nls';
|
||||
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService, Severity } from 'vs/platform/message/common/message';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
const selectionSnippetMaxLen = 100;
|
||||
|
||||
@@ -76,7 +77,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
// CONSTRUCTOR /////////////////////////////////////////////////////////
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IMessageService private _messageService: IMessageService
|
||||
@INotificationService private _notificationService: INotificationService
|
||||
) {
|
||||
this._queryInfoMap = new Map<string, QueryInfo>();
|
||||
this._onRunQueryStart = new Emitter<string>();
|
||||
@@ -179,7 +180,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
}
|
||||
|
||||
public showCommitError(error: string): void {
|
||||
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error
|
||||
});
|
||||
}
|
||||
|
||||
public isRunningQuery(uri: string): boolean {
|
||||
@@ -330,7 +334,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
queryRunner.cancelQuery().then(success => undefined, error => {
|
||||
// On error, show error message and notify that the query is complete so that buttons and other status indicators
|
||||
// can be correct
|
||||
this._messageService.show(Severity.Error, strings.format(LocalizedConstants.msgCancelQueryFailed, error));
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: strings.format(LocalizedConstants.msgCancelQueryFailed, error)
|
||||
});
|
||||
this._fireQueryEvent(queryRunner.uri, 'complete', 0);
|
||||
});
|
||||
|
||||
@@ -427,7 +434,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.updateCell(ownerUri, rowId, columnId, newValue).then((result) => result, error => {
|
||||
this._messageService.show(Severity.Error, nls.localize('updateCellFailed', 'Update cell failed: ') + error.message);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('updateCellFailed', 'Update cell failed: ') + error.message
|
||||
});
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
@@ -439,7 +449,10 @@ export class QueryModelService implements IQueryModelService {
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.commitEdit(ownerUri).then(() => { }, error => {
|
||||
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error.message);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error.message
|
||||
});
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IQueryManagementService } from 'sql/parts/query/common/queryManagement'
|
||||
import { ISlickRange } from 'angular2-slickgrid';
|
||||
import * as Utils from 'sql/parts/connection/common/utils';
|
||||
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import * as nls from 'vs/nls';
|
||||
@@ -21,6 +20,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export interface IEditSessionReadyEvent {
|
||||
ownerUri: string;
|
||||
@@ -66,7 +66,7 @@ export default class QueryRunner {
|
||||
public uri: string,
|
||||
public title: string,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
|
||||
@IClipboardService private _clipboardService: IClipboardService
|
||||
) { }
|
||||
@@ -288,7 +288,10 @@ export default class QueryRunner {
|
||||
self._queryManagementService.getQueryRows(rowData).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
self._messageService.show(Severity.Error, nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error));
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error)
|
||||
});
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@@ -312,8 +315,10 @@ export default class QueryRunner {
|
||||
|
||||
// TODO issue #228 add statusview callbacks here
|
||||
this._isExecuting = false;
|
||||
|
||||
this._messageService.show(Severity.Error, nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -334,13 +339,19 @@ export default class QueryRunner {
|
||||
self._queryManagementService.getEditRows(rowData).then(result => {
|
||||
if (!result.hasOwnProperty('rowCount')) {
|
||||
let error = `Nothing returned from subset query`;
|
||||
self._messageService.show(Severity.Error, error);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: error
|
||||
});
|
||||
reject(error);
|
||||
}
|
||||
resolve(result);
|
||||
}, error => {
|
||||
let errorMessage = nls.localize('query.moreRowsFailedError', 'Something went wrong getting more rows:');
|
||||
self._messageService.show(Severity.Error, `${errorMessage} ${error}`);
|
||||
self._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: `${errorMessage} ${error}`
|
||||
});
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,20 +14,21 @@ import { sqlModeId, untitledFilePrefix, getSupportedInputResource } from 'sql/pa
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
|
||||
import { IMode } from 'vs/editor/common/modes';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditor, IEditorInput, Position } from 'vs/platform/editor/common/editor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorGroup } from 'vs/workbench/common/editor';
|
||||
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import nls = require('vs/nls');
|
||||
import URI from 'vs/base/common/uri';
|
||||
import paths = require('vs/base/common/paths');
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -52,20 +53,20 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
private static editorService: IWorkbenchEditorService;
|
||||
private static instantiationService: IInstantiationService;
|
||||
private static editorGroupService: IEditorGroupService;
|
||||
private static messageService: IMessageService;
|
||||
private static notificationService: INotificationService;
|
||||
|
||||
constructor(
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IMessageService private _messageService: IMessageService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
) {
|
||||
QueryEditorService.editorService = _editorService;
|
||||
QueryEditorService.instantiationService = _instantiationService;
|
||||
QueryEditorService.editorGroupService = _editorGroupService;
|
||||
QueryEditorService.messageService = _messageService;
|
||||
QueryEditorService.notificationService = _notificationService;
|
||||
}
|
||||
|
||||
////// Public functions
|
||||
@@ -78,7 +79,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
try {
|
||||
// Create file path and file URI
|
||||
let filePath = this.createUntitledSqlFilePath();
|
||||
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
|
||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||
|
||||
// Create a sql document pane with accoutrements
|
||||
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
|
||||
@@ -126,7 +127,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
// Create file path and file URI
|
||||
let objectName = schemaName ? schemaName + '.' + tableName : tableName;
|
||||
let filePath = this.createEditDataFileName(objectName);
|
||||
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
|
||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||
|
||||
// Create an EditDataInput for editing
|
||||
let editDataInput: EditDataInput = this._instantiationService.createInstance(EditDataInput, docUri, schemaName, tableName);
|
||||
@@ -192,7 +193,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
* In all other cases (when SQL is involved in the language change and the editor is not dirty),
|
||||
* returns a promise that will resolve when the old editor has been replaced by a new editor.
|
||||
*/
|
||||
public static sqlLanguageModeCheck(model: IModel, mode: IMode, editor: IEditor): Promise<IModel> {
|
||||
public static sqlLanguageModeCheck(model: ITextModel, mode: IMode, editor: IEditor): Promise<ITextModel> {
|
||||
if (!model || !mode || !editor) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -211,16 +212,22 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
}
|
||||
|
||||
let uri: URI = QueryEditorService._getEditorChangeUri(editor.input, changingToSql);
|
||||
if(uri.scheme === UNTITLED_SCHEMA && editor.input instanceof QueryInput)
|
||||
if(uri.scheme === Schemas.untitled && editor.input instanceof QueryInput)
|
||||
{
|
||||
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE);
|
||||
QueryEditorService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE
|
||||
});
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// Return undefined to notify the calling funciton to not perform the language change
|
||||
// TODO change this - tracked by issue #727
|
||||
if (editor.input.isDirty()) {
|
||||
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_ERROR_MESSAGE);
|
||||
QueryEditorService.notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: QueryEditorService.CHANGE_ERROR_MESSAGE
|
||||
});
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -232,7 +239,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
options.pinned = group.isPinned(index);
|
||||
|
||||
// Return a promise that will resovle when the old editor has been replaced by a new editor
|
||||
return new Promise<IModel>((resolve, reject) => {
|
||||
return new Promise<ITextModel>((resolve, reject) => {
|
||||
let newEditorInput = QueryEditorService._getNewEditorInput(changingToSql, editor.input, uri);
|
||||
|
||||
// Override queryEditorCheck to not open this file in a QueryEditor
|
||||
@@ -344,7 +351,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
/**
|
||||
* Handle all cleanup actions that need to wait until the editor is fully open.
|
||||
*/
|
||||
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): IModel {
|
||||
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): ITextModel {
|
||||
|
||||
// Reset the editor pin state
|
||||
// TODO: change this so it happens automatically in openEditor in sqlLanguageModeCheck. Performing this here
|
||||
|
||||
@@ -148,18 +148,18 @@ export class ServerGroupDialog extends Modal {
|
||||
this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
|
||||
} else if (this.isFocusOnColors()) {
|
||||
this._addServerButton.enabled ? this._addServerButton.focus() : this._closeButton.focus();
|
||||
} else if (document.activeElement === this._addServerButton.getElement()) {
|
||||
} else if (document.activeElement === this._addServerButton.element) {
|
||||
this._closeButton.focus();
|
||||
}
|
||||
else if (document.activeElement === this._closeButton.getElement()) {
|
||||
else if (document.activeElement === this._closeButton.element) {
|
||||
this._groupNameInputBox.focus();
|
||||
}
|
||||
}
|
||||
|
||||
private focusPrevious(): void {
|
||||
if (document.activeElement === this._closeButton.getElement()) {
|
||||
if (document.activeElement === this._closeButton.element) {
|
||||
this._addServerButton.enabled ? this._addServerButton.focus() : this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
|
||||
} else if (document.activeElement === this._addServerButton.getElement()) {
|
||||
} else if (document.activeElement === this._addServerButton.element) {
|
||||
this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
|
||||
} else if (this.isFocusOnColors()) {
|
||||
this._groupDescriptionInputBox.focus();
|
||||
|
||||
@@ -17,7 +17,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IConnectionsViewlet, IConnectionManagementService, VIEWLET_ID } from 'sql/parts/connection/common/connectionManagement';
|
||||
@@ -27,6 +26,8 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { ClearSearchAction, AddServerAction, AddServerGroupAction, ActiveConnectionsFilterAction } from 'sql/parts/registeredServer/viewlet/connectionTreeAction';
|
||||
import { warn } from 'sql/base/common/log';
|
||||
import { IObjectExplorerService } from 'sql/parts/registeredServer/common/objectExplorerService';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
||||
|
||||
@@ -49,10 +50,12 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
||||
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IViewletService private viewletService: IViewletService,
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService,
|
||||
@IPartService partService: IPartService
|
||||
) {
|
||||
super(VIEWLET_ID, telemetryService, _themeService);
|
||||
|
||||
super(VIEWLET_ID, partService, telemetryService, _themeService);
|
||||
this._searchDelayer = new ThrottledDelayer(500);
|
||||
|
||||
this._clearSearchAction = this._instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
|
||||
@@ -71,7 +74,10 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
|
||||
if (isPromiseCanceledError(err)) {
|
||||
return;
|
||||
}
|
||||
this.messageService.show(Severity.Error, err);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: err
|
||||
});
|
||||
}
|
||||
|
||||
public create(parent: Builder): TPromise<void> {
|
||||
|
||||
@@ -10,10 +10,10 @@ import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IChoiceService } from 'vs/platform/message/common/message';
|
||||
import { localize } from 'vs/nls';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
export const SERVICE_ID = 'taskHistoryService';
|
||||
export const ITaskService = createDecorator<ITaskService>(SERVICE_ID);
|
||||
|
||||
@@ -14,12 +14,13 @@ import { toggleClass } from 'vs/base/browser/dom';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { TaskHistoryView } from 'sql/parts/taskHistory/viewlet/taskHistoryView';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export const VIEWLET_ID = 'workbench.view.taskHistory';
|
||||
|
||||
@@ -35,16 +36,20 @@ export class TaskHistoryViewlet extends Viewlet {
|
||||
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IViewletService private viewletService: IViewletService,
|
||||
@IMessageService private messageService: IMessageService
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IPartService partService: IPartService
|
||||
) {
|
||||
super(VIEWLET_ID, telemetryService, themeService);
|
||||
super(VIEWLET_ID, partService, telemetryService, themeService);
|
||||
}
|
||||
|
||||
private onError(err: any): void {
|
||||
if (isPromiseCanceledError(err)) {
|
||||
return;
|
||||
}
|
||||
this.messageService.show(Severity.Error, err);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: err
|
||||
});
|
||||
}
|
||||
|
||||
public create(parent: Builder): TPromise<void> {
|
||||
|
||||
Reference in New Issue
Block a user