SQL Operations Studio Public Preview 1 (0.23) release source code

This commit is contained in:
Karl Burtram
2017-11-09 14:30:27 -08:00
parent b88ecb8d93
commit 3cdac41339
8829 changed files with 759707 additions and 286 deletions

View File

@@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------------------------
* 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 'vs/css!sql/media/icons/common-icons';
import 'vs/css!./media/errorMessageDialog';
import { Modal } from 'sql/base/browser/ui/modal/modal';
import * as TelemetryKeys from 'sql/common/telemetryKeys';
import { attachModalDialogStyler } from 'sql/common/theme/styler';
import { Builder } from 'vs/base/browser/builder';
import Severity from 'vs/base/common/severity';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { IPartService } from 'vs/workbench/services/part/common/partService';
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 { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
export class ErrorMessageDialog extends Modal {
private _body: HTMLElement;
private _severity: Severity;
private _message: string;
private _onOk = new Emitter<void>();
public onOk: Event<void> = this._onOk.event;
constructor(
@IThemeService private _themeService: IThemeService,
@IClipboardService private _clipboardService: IClipboardService,
@IPartService partService: IPartService,
@ITelemetryService telemetryService: ITelemetryService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super('', TelemetryKeys.ErrorMessage, partService, telemetryService, contextKeyService, { isFlyout: false, hasTitleIcon: true });
}
protected renderBody(container: HTMLElement) {
new Builder(container).div({ 'class': 'error-dialog' }, (bodyBuilder) => {
this._body = bodyBuilder.getHTMLElement();;
});
}
public render() {
super.render();
attachModalDialogStyler(this, this._themeService);
let copyButton = this.addFooterButton('Copy to Clipboard', () => this._clipboardService.writeText(this._message), 'left');
copyButton.icon = 'icon scriptToClipboard';
attachButtonStyler(copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND });
let okButton = this.addFooterButton('OK', () => this.ok());
attachButtonStyler(okButton, this._themeService);
}
protected layout(height?: number): void {
// Nothing to re-layout
}
private updateDialogBody(): void {
let builder = new Builder(this._body).empty();
builder.div({ class: 'error-message' }, (errorContainer) => {
errorContainer.innerHtml(this._message);
});
}
private updateIconTitle(): void {
switch (this._severity) {
case Severity.Error:
this.titleIconClassName = 'icon error';
break;
case Severity.Warning:
this.titleIconClassName = 'icon warning';
break;
case Severity.Info:
this.titleIconClassName = 'icon info';
break;
}
}
/* espace key */
protected onClose() {
this.ok();
}
/* enter key */
protected onAccept() {
this.ok();
}
public ok(): void {
this._onOk.fire();
this.close();
}
public close() {
this.hide();
}
public open(severity: Severity, headerTitle: string, message: string) {
this._severity = severity;
this._message = message;
this.title = headerTitle;
this.updateIconTitle();
this.updateDialogBody();
this.show();
}
public dispose(): void {
}
}

View File

@@ -0,0 +1,57 @@
/*---------------------------------------------------------------------------------------------
* 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 { localize } from 'vs/nls';
import Severity from 'vs/base/common/severity';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
import { ErrorMessageDialog } from 'sql/workbench/errorMessageDialog/errorMessageDialog';
export class ErrorMessageService implements IErrorMessageService {
_serviceBrand: any;
private _errorDialog: ErrorMessageDialog;
private handleOnOk(): void {
}
constructor(
@IInstantiationService private _instantiationService: IInstantiationService
) { }
public showDialog(severity: Severity, headerTitle: string, message: string): void {
this.doShowDialog(severity, headerTitle, message);
}
private doShowDialog(severity: Severity, headerTitle: string, message: string): void {
if (!this._errorDialog) {
this._errorDialog = this._instantiationService.createInstance(ErrorMessageDialog);
this._errorDialog.onOk(() => this.handleOnOk());
this._errorDialog.render();
}
let title = headerTitle ? headerTitle : this.getDefaultTitle(severity);
return this._errorDialog.open(severity, title, message);
}
private getDefaultTitle(severity: Severity) {
let defaultTitle: string;
switch (severity) {
case Severity.Error:
defaultTitle = localize('error', 'Error');
break;
case Severity.Warning:
defaultTitle = localize('warning', 'Warning');
break;
case Severity.Info:
defaultTitle = localize('info', 'Info');
}
return defaultTitle;
}
}

View File

@@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.error-dialog {
padding: 15px;
overflow: auto;
height: 200px;
}
.error-dialog .icon.error, .error-dialog .icon.warning , .error-dialog .icon.info {
width: 20px;
height: 20px;
float: left;
margin-right: 10px;
}