mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-21 11:01:38 -05:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2b6f6844d | ||
|
|
e9ef95ef1f | ||
|
|
10eeb5374f | ||
|
|
332951bc8e | ||
|
|
4daf3280ff | ||
|
|
87bb2c74d9 | ||
|
|
ba011853a0 | ||
|
|
461a158ac3 | ||
|
|
85f59f1103 | ||
|
|
335b9f445f | ||
|
|
7cda45c904 | ||
|
|
4159fdc1a3 | ||
|
|
190da30979 | ||
|
|
ed9c74b900 | ||
|
|
6783766c33 | ||
|
|
b27018b379 | ||
|
|
021d07e04a | ||
|
|
bf0baec392 | ||
|
|
923cbac400 | ||
|
|
ab938f2536 | ||
|
|
a55b1804e9 |
@@ -61,6 +61,7 @@ Type: filesandordirs; Name: "{app}\_"
|
|||||||
|
|
||||||
[Tasks]
|
[Tasks]
|
||||||
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
|
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
|
||||||
|
Name: "associatewithfiles"; Description: "{cm:AssociateWithFiles,{#NameShort}}"; GroupDescription: "{cm:Other}"; Flags: unchecked
|
||||||
Name: "addtopath"; Description: "{cm:AddToPath}"; GroupDescription: "{cm:Other}"
|
Name: "addtopath"; Description: "{cm:AddToPath}"; GroupDescription: "{cm:Other}"
|
||||||
Name: "runcode"; Description: "{cm:RunAfter,{#NameShort}}"; GroupDescription: "{cm:Other}"; Check: WizardSilent
|
Name: "runcode"; Description: "{cm:RunAfter,{#NameShort}}"; GroupDescription: "{cm:Other}"; Check: WizardSilent
|
||||||
|
|
||||||
@@ -82,6 +83,13 @@ Root: HKCR; Subkey: "{#RegValueName}SourceFile\DefaultIcon"; ValueType: string;
|
|||||||
Root: HKCR; Subkey: "{#RegValueName}SourceFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""
|
Root: HKCR; Subkey: "{#RegValueName}SourceFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""
|
||||||
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
|
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
|
||||||
|
|
||||||
|
Root: HKCU; Subkey: "Software\Classes\.sql\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles
|
||||||
|
Root: HKCU; Subkey: "Software\Classes\.sql\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.sql"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles
|
||||||
|
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,SQL}"; Flags: uninsdeletekey; Tasks: associatewithfiles
|
||||||
|
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql"; ValueType: string; ValueName: "AppUserModelID"; ValueData: "{#AppUserId}"; Flags: uninsdeletekey; Tasks: associatewithfiles
|
||||||
|
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\code_file.ico"; Tasks: associatewithfiles
|
||||||
|
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
// Don't allow installing conflicting architectures
|
// Don't allow installing conflicting architectures
|
||||||
function InitializeSetup(): Boolean;
|
function InitializeSetup(): Boolean;
|
||||||
|
|||||||
@@ -143,13 +143,16 @@ export class JobStepDialog {
|
|||||||
width: '80px',
|
width: '80px',
|
||||||
isFile: true
|
isFile: true
|
||||||
}).component();
|
}).component();
|
||||||
this.openButton.enabled = false;
|
|
||||||
this.parseButton = view.modelBuilder.button()
|
this.parseButton = view.modelBuilder.button()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
label: this.ParseCommandText,
|
label: this.ParseCommandText,
|
||||||
width: '80px',
|
width: '80px',
|
||||||
isFile: false
|
isFile: false
|
||||||
}).component();
|
}).component();
|
||||||
|
this.openButton.onDidClick(e => {
|
||||||
|
let queryContent = e;
|
||||||
|
this.commandTextBox.value = queryContent;
|
||||||
|
});
|
||||||
this.parseButton.onDidClick(e => {
|
this.parseButton.onDidClick(e => {
|
||||||
if (this.commandTextBox.value) {
|
if (this.commandTextBox.value) {
|
||||||
queryProvider.parseSyntax(this.ownerUri, this.commandTextBox.value).then(result => {
|
queryProvider.parseSyntax(this.ownerUri, this.commandTextBox.value).then(result => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "1.5.0-alpha.12",
|
"version": "1.5.0-alpha.14",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-netcoreapp2.1.zip",
|
"Windows_86": "win-x86-netcoreapp2.1.zip",
|
||||||
"Windows_64": "win-x64-netcoreapp2.1.zip",
|
"Windows_64": "win-x64-netcoreapp2.1.zip",
|
||||||
|
|||||||
@@ -12,8 +12,9 @@
|
|||||||
["{", "}"],
|
["{", "}"],
|
||||||
["[", "]"],
|
["[", "]"],
|
||||||
["(", ")"],
|
["(", ")"],
|
||||||
["\"", "\""],
|
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
||||||
["'", "'"]
|
{ "open": "N'", "close": "'", "notIn": ["string", "comment"] },
|
||||||
|
{ "open": "'", "close": "'", "notIn": ["string", "comment"] }
|
||||||
],
|
],
|
||||||
"surroundingPairs": [
|
"surroundingPairs": [
|
||||||
["{", "}"],
|
["{", "}"],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sqlops",
|
"name": "sqlops",
|
||||||
"version": "0.32.1",
|
"version": "0.32.2",
|
||||||
"distro": "8c3e97e3425cc9814496472ab73e076de2ba99ee",
|
"distro": "8c3e97e3425cc9814496472ab73e076de2ba99ee",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Microsoft Corporation"
|
"name": "Microsoft Corporation"
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
"getmac": "1.0.7",
|
"getmac": "1.0.7",
|
||||||
"graceful-fs": "4.1.11",
|
"graceful-fs": "4.1.11",
|
||||||
"html-query-plan": "git://github.com/anthonydresser/html-query-plan.git#2.4",
|
"html-query-plan": "git://github.com/anthonydresser/html-query-plan.git#2.4",
|
||||||
"http-proxy-agent": "0.2.7",
|
"http-proxy-agent": "^2.1.0",
|
||||||
"https-proxy-agent": "0.3.6",
|
"https-proxy-agent": "^2.2.1",
|
||||||
"iconv-lite": "0.4.19",
|
"iconv-lite": "0.4.19",
|
||||||
"jquery": "3.1.0",
|
"jquery": "3.1.0",
|
||||||
"jschardet": "1.6.0",
|
"jschardet": "1.6.0",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"gettingStartedUrl": "https://go.microsoft.com/fwlink/?linkid=862039",
|
"gettingStartedUrl": "https://go.microsoft.com/fwlink/?linkid=862039",
|
||||||
"releaseNotesUrl": "https://go.microsoft.com/fwlink/?linkid=875578",
|
"releaseNotesUrl": "https://go.microsoft.com/fwlink/?linkid=875578",
|
||||||
"documentationUrl": "https://go.microsoft.com/fwlink/?linkid=862277",
|
"documentationUrl": "https://go.microsoft.com/fwlink/?linkid=862277",
|
||||||
|
"vscodeVersion": "1.23.1",
|
||||||
"commit": "9ca6200018fc206d67a47229f991901a8a453781",
|
"commit": "9ca6200018fc206d67a47229f991901a8a453781",
|
||||||
"date": "2017-12-15T12:00:00.000Z",
|
"date": "2017-12-15T12:00:00.000Z",
|
||||||
"recommendedExtensions": [
|
"recommendedExtensions": [
|
||||||
@@ -42,4 +43,4 @@
|
|||||||
"extensionsGallery": {
|
"extensionsGallery": {
|
||||||
"serviceUrl": "https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery.json"
|
"serviceUrl": "https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ export default class MainController implements vscode.Disposable {
|
|||||||
page1.registerContent(async (view) => {
|
page1.registerContent(async (view) => {
|
||||||
await this.getTabContent(view, customButton1, customButton2, 800);
|
await this.getTabContent(view, customButton1, customButton2, 800);
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
wizard.registerOperation({
|
wizard.registerOperation({
|
||||||
displayName: 'test task',
|
displayName: 'test task',
|
||||||
description: 'task description',
|
description: 'task description',
|
||||||
@@ -311,7 +312,7 @@ export default class MainController implements vscode.Disposable {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
op.updateStatus(sqlops.TaskStatus.Succeeded);
|
op.updateStatus(sqlops.TaskStatus.Succeeded);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});*/
|
||||||
wizard.pages = [page1, page2];
|
wizard.pages = [page1, page2];
|
||||||
wizard.open();
|
wizard.open();
|
||||||
}
|
}
|
||||||
@@ -354,15 +355,32 @@ export default class MainController implements vscode.Disposable {
|
|||||||
webview2.message = count;
|
webview2.message = count;
|
||||||
});
|
});
|
||||||
|
|
||||||
let flexModel = view.modelBuilder.flexContainer()
|
let editor1 = view.modelBuilder.editor()
|
||||||
.withLayout({
|
.withProperties({
|
||||||
flexFlow: 'column',
|
content: 'select * from sys.tables'
|
||||||
alignItems: 'flex-start',
|
})
|
||||||
height: 500
|
|
||||||
}).withItems([
|
|
||||||
webview1, webview2
|
|
||||||
], { flex: '1 1 50%' })
|
|
||||||
.component();
|
.component();
|
||||||
|
|
||||||
|
let editor2 = view.modelBuilder.editor()
|
||||||
|
.withProperties({
|
||||||
|
content: 'print("Hello World !")',
|
||||||
|
languageMode: 'python'
|
||||||
|
})
|
||||||
|
.component();
|
||||||
|
|
||||||
|
let flexModel = view.modelBuilder.flexContainer().component();
|
||||||
|
flexModel.addItem(editor1, { flex: '1' });
|
||||||
|
flexModel.addItem(editor2, { flex: '1' });
|
||||||
|
flexModel.setLayout({
|
||||||
|
flexFlow: 'column',
|
||||||
|
alignItems: 'stretch',
|
||||||
|
height: '100%'
|
||||||
|
});
|
||||||
|
|
||||||
|
view.onClosed((params) => {
|
||||||
|
vscode.window.showInformationMessage('editor1: language: ' + editor1.languageMode + ' Content1: ' + editor1.content);
|
||||||
|
vscode.window.showInformationMessage('editor2: language: ' + editor2.languageMode + ' Content2: ' + editor2.content);
|
||||||
|
});
|
||||||
await view.initializeModel(flexModel);
|
await view.initializeModel(flexModel);
|
||||||
});
|
});
|
||||||
editor.openEditor();
|
editor.openEditor();
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* 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 {
|
||||||
|
Component, Inject, forwardRef, ElementRef, OnInit, Input,
|
||||||
|
Output, OnChanges, SimpleChanges, EventEmitter
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { Dropdown, IDropdownOptions } from 'sql/base/browser/ui/editableDropdown/dropdown';
|
||||||
|
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
||||||
|
|
||||||
|
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||||
|
import { attachEditableDropdownStyler } from 'sql/common/theme/styler';
|
||||||
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'editable-select-box',
|
||||||
|
template: ''
|
||||||
|
})
|
||||||
|
export class EditableDropDown extends AngularDisposable implements OnInit, OnChanges {
|
||||||
|
private _selectbox: Dropdown;
|
||||||
|
|
||||||
|
@Input() options: string[];
|
||||||
|
@Input() selectedOption: string;
|
||||||
|
@Input() onlyEmitOnChange = false;
|
||||||
|
|
||||||
|
@Output() onDidSelect = new EventEmitter<string>();
|
||||||
|
|
||||||
|
private _previousVal: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
||||||
|
@Inject(IThemeService) private themeService: IThemeService,
|
||||||
|
@Inject(IContextViewService) private contextViewService: IContextViewService
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
let dropdownOptions: IDropdownOptions = {
|
||||||
|
values: [],
|
||||||
|
strictSelection: false,
|
||||||
|
placeholder: '',
|
||||||
|
maxHeight: 125,
|
||||||
|
ariaLabel: '',
|
||||||
|
actionLabel: ''
|
||||||
|
};
|
||||||
|
this._selectbox = new Dropdown(this._el.nativeElement, this.contextViewService, this.themeService, dropdownOptions);
|
||||||
|
this._selectbox.values = this.options;
|
||||||
|
this._selectbox.value = this.selectedOption;
|
||||||
|
|
||||||
|
this._selectbox.onValueChange(e => {
|
||||||
|
if (this.onlyEmitOnChange) {
|
||||||
|
if (this._previousVal !== e) {
|
||||||
|
this.onDidSelect.emit(e);
|
||||||
|
this._previousVal = e;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.onDidSelect.emit(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this._register(attachEditableDropdownStyler(this._selectbox, this.themeService));
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
public get value(): string {
|
||||||
|
return this._selectbox.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ export interface IFindPosition {
|
|||||||
row: number;
|
row: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function defaultSort<T>(args: Slick.OnSortEventArgs<T>, data: Array<T>): Array<T> {
|
function defaultSort<T>(args: Slick.OnSortEventArgs<T>, data: Array<T>): Array<T> {
|
||||||
let field = args.sortCol.field;
|
let field = args.sortCol.field;
|
||||||
let sign = args.sortAsc ? 1 : -1;
|
let sign = args.sortAsc ? 1 : -1;
|
||||||
return data.sort((a, b) => (a[field] === b[field] ? 0 : (a[field] > b[field] ? 1 : -1)) * sign);
|
return data.sort((a, b) => (a[field] === b[field] ? 0 : (a[field] > b[field] ? 1 : -1)) * sign);
|
||||||
|
|||||||
@@ -152,10 +152,12 @@ export interface IConnectionManagementService {
|
|||||||
|
|
||||||
getAdvancedProperties(): sqlops.ConnectionOption[];
|
getAdvancedProperties(): sqlops.ConnectionOption[];
|
||||||
|
|
||||||
getConnectionId(connectionProfile: IConnectionProfile): string;
|
getConnectionUri(connectionProfile: IConnectionProfile): string;
|
||||||
|
|
||||||
getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string;
|
getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string;
|
||||||
|
|
||||||
|
getConnectionUriFromId(connectionId: string): string;
|
||||||
|
|
||||||
isConnected(fileUri: string): boolean;
|
isConnected(fileUri: string): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -648,6 +648,15 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
return this._connectionStatusManager.getActiveConnectionProfiles();
|
return this._connectionStatusManager.getActiveConnectionProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getConnectionUriFromId(connectionId: string): string {
|
||||||
|
let connection = this.getActiveConnections().find(connection => connection.id === connectionId);
|
||||||
|
if (connection) {
|
||||||
|
return this.getConnectionUri(connection);
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
|
public saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
|
||||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.AddServerGroup);
|
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.AddServerGroup);
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
@@ -704,7 +713,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConnectionId(connectionProfile: IConnectionProfile): string {
|
public getConnectionUri(connectionProfile: IConnectionProfile): string {
|
||||||
return this._connectionStatusManager.getOriginalOwnerUri(Utils.generateUri(connectionProfile));
|
return this._connectionStatusManager.getOriginalOwnerUri(Utils.generateUri(connectionProfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +725,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
*/
|
*/
|
||||||
public getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string {
|
public getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string {
|
||||||
if (this._connectionStatusManager.isDefaultTypeUri(uri)) {
|
if (this._connectionStatusManager.isDefaultTypeUri(uri)) {
|
||||||
return this.getConnectionId(connectionProfile);
|
return this.getConnectionUri(connectionProfile);
|
||||||
} else {
|
} else {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export class ConnectionController implements IConnectionComponentController {
|
|||||||
tempProfile.password = password;
|
tempProfile.password = password;
|
||||||
tempProfile.groupFullName = '';
|
tempProfile.groupFullName = '';
|
||||||
tempProfile.saveProfile = false;
|
tempProfile.saveProfile = false;
|
||||||
let uri = this._connectionManagementService.getConnectionId(tempProfile);
|
let uri = this._connectionManagementService.getConnectionUri(tempProfile);
|
||||||
return new Promise<string[]>((resolve, reject) => {
|
return new Promise<string[]>((resolve, reject) => {
|
||||||
if (this._databaseCache.has(uri)) {
|
if (this._databaseCache.has(uri)) {
|
||||||
let cachedDatabases: string[] = this._databaseCache.get(uri);
|
let cachedDatabases: string[] = this._databaseCache.get(uri);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
border-top-color: transparent;
|
border-top-color: transparent;
|
||||||
height: calc(100% - 350px);
|
height: calc(100% - 350px);
|
||||||
display: block;
|
display: block;
|
||||||
|
min-height: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.connection-recent, .connection-saved {
|
.connection-recent, .connection-saved {
|
||||||
|
|||||||
@@ -57,13 +57,14 @@ import { OperatorsViewComponent } from 'sql/parts/jobManagement/views/operatorsV
|
|||||||
import { ProxiesViewComponent } from 'sql/parts/jobManagement/views/proxiesView.component';
|
import { ProxiesViewComponent } from 'sql/parts/jobManagement/views/proxiesView.component';
|
||||||
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
||||||
|
import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editabledropdown.component';
|
||||||
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
||||||
|
|
||||||
let baseComponents = [DashboardHomeContainer, DashboardComponent, DashboardWidgetWrapper, DashboardWebviewContainer,
|
let baseComponents = [DashboardHomeContainer, DashboardComponent, DashboardWidgetWrapper, DashboardWebviewContainer,
|
||||||
DashboardWidgetContainer, DashboardGridContainer, DashboardErrorContainer, DashboardNavSection, ModelViewContent, WebviewContent, WidgetContent,
|
DashboardWidgetContainer, DashboardGridContainer, DashboardErrorContainer, DashboardNavSection, ModelViewContent, WebviewContent, WidgetContent,
|
||||||
ComponentHostDirective, BreadcrumbComponent, ControlHostContent, DashboardControlHostContainer,
|
ComponentHostDirective, BreadcrumbComponent, ControlHostContent, DashboardControlHostContainer,
|
||||||
JobsViewComponent, AgentViewComponent, JobHistoryComponent, JobStepsViewComponent, AlertsViewComponent, ProxiesViewComponent, OperatorsViewComponent,
|
JobsViewComponent, AgentViewComponent, JobHistoryComponent, JobStepsViewComponent, AlertsViewComponent, ProxiesViewComponent, OperatorsViewComponent,
|
||||||
DashboardModelViewContainer, ModelComponentWrapper, Checkbox, SelectBox, InputBox,];
|
DashboardModelViewContainer, ModelComponentWrapper, Checkbox, EditableDropDown, SelectBox, InputBox,];
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
import { PanelModule } from 'sql/base/browser/ui/panel/panel.module';
|
import { PanelModule } from 'sql/base/browser/ui/panel/panel.module';
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const properties: IJSONSchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
yAxisMin: {
|
yAxisMin: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: nls.localize('yAxisMin', "Minumum value of the y axis")
|
description: nls.localize('yAxisMin', "Minimum value of the y axis")
|
||||||
},
|
},
|
||||||
yAxisMax: {
|
yAxisMax: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
@@ -28,7 +28,7 @@ const properties: IJSONSchema = {
|
|||||||
},
|
},
|
||||||
xAxisMin: {
|
xAxisMin: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: nls.localize('xAxisMin', "Minumum value of the x axis")
|
description: nls.localize('xAxisMin', "Minimum value of the x axis")
|
||||||
},
|
},
|
||||||
xAxisMax: {
|
xAxisMax: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ export class BackupUiService implements IBackupUiService {
|
|||||||
|
|
||||||
let backupOptions = this.getOptions(this._currentProvider);
|
let backupOptions = this.getOptions(this._currentProvider);
|
||||||
return new TPromise<void>(() => {
|
return new TPromise<void>(() => {
|
||||||
let uri = this._connectionManagementService.getConnectionId(connection)
|
let uri = this._connectionManagementService.getConnectionUri(connection)
|
||||||
+ ProviderConnectionInfo.idSeparator
|
+ ProviderConnectionInfo.idSeparator
|
||||||
+ ConnectionUtils.ConnectionUriBackupIdAttributeName
|
+ ConnectionUtils.ConnectionUriBackupIdAttributeName
|
||||||
+ ProviderConnectionInfo.nameValueSeparator
|
+ ProviderConnectionInfo.nameValueSeparator
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ export class RestoreDialogController implements IRestoreDialogController {
|
|||||||
return new TPromise<void>((resolve, reject) => {
|
return new TPromise<void>((resolve, reject) => {
|
||||||
let result: void;
|
let result: void;
|
||||||
|
|
||||||
this._ownerUri = this._connectionService.getConnectionId(connection)
|
this._ownerUri = this._connectionService.getConnectionUri(connection)
|
||||||
+ ProviderConnectionInfo.idSeparator
|
+ ProviderConnectionInfo.idSeparator
|
||||||
+ Utils.ConnectionUriRestoreIdAttributeName
|
+ Utils.ConnectionUriRestoreIdAttributeName
|
||||||
+ ProviderConnectionInfo.nameValueSeparator
|
+ ProviderConnectionInfo.nameValueSeparator
|
||||||
|
|||||||
@@ -236,21 +236,25 @@ export abstract class GridParentComponent {
|
|||||||
this.messagesFocussedContextKey.set(false);
|
this.messagesFocussedContextKey.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getSelection(index?: number): ISlickRange[] {
|
||||||
|
let selection = this.slickgrids.toArray()[index || this.activeGrid].getSelectedRanges();
|
||||||
|
selection = selection.map(c => { return <ISlickRange>{ fromCell: c.fromCell - 1, toCell: c.toCell - 1, toRow: c.toRow, fromRow: c.fromRow }; });
|
||||||
|
return selection;
|
||||||
|
}
|
||||||
|
|
||||||
private copySelection(): void {
|
private copySelection(): void {
|
||||||
let messageText = this.getMessageText();
|
let messageText = this.getMessageText();
|
||||||
if (messageText.length > 0) {
|
if (messageText.length > 0) {
|
||||||
this.clipboardService.writeText(messageText);
|
this.clipboardService.writeText(messageText);
|
||||||
} else {
|
} else {
|
||||||
let activeGrid = this.activeGrid;
|
let activeGrid = this.activeGrid;
|
||||||
let selection = this.slickgrids.toArray()[activeGrid].getSelectedRanges();
|
this.dataService.copyResults(this.getSelection(activeGrid), this.renderedDataSets[activeGrid].batchId, this.renderedDataSets[activeGrid].resultId);
|
||||||
this.dataService.copyResults(selection, this.renderedDataSets[activeGrid].batchId, this.renderedDataSets[activeGrid].resultId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private copyWithHeaders(): void {
|
private copyWithHeaders(): void {
|
||||||
let activeGrid = this.activeGrid;
|
let activeGrid = this.activeGrid;
|
||||||
let selection = this.slickgrids.toArray()[activeGrid].getSelectedRanges();
|
this.dataService.copyResults(this.getSelection(activeGrid), this.renderedDataSets[activeGrid].batchId,
|
||||||
this.dataService.copyResults(selection, this.renderedDataSets[activeGrid].batchId,
|
|
||||||
this.renderedDataSets[activeGrid].resultId, true);
|
this.renderedDataSets[activeGrid].resultId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,8 +368,7 @@ export abstract class GridParentComponent {
|
|||||||
let activeGrid = this.activeGrid;
|
let activeGrid = this.activeGrid;
|
||||||
let batchId = this.renderedDataSets[activeGrid].batchId;
|
let batchId = this.renderedDataSets[activeGrid].batchId;
|
||||||
let resultId = this.renderedDataSets[activeGrid].resultId;
|
let resultId = this.renderedDataSets[activeGrid].resultId;
|
||||||
let selection = this.slickgrids.toArray()[activeGrid].getSelectedRanges();
|
this.dataService.sendSaveRequest({ batchIndex: batchId, resultSetNumber: resultId, format: format, selection: this.getSelection(activeGrid) });
|
||||||
this.dataService.sendSaveRequest({ batchIndex: batchId, resultSetNumber: resultId, format: format, selection: selection });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _keybindingFor(action: IAction): ResolvedKeybinding {
|
protected _keybindingFor(action: IAction): ResolvedKeybinding {
|
||||||
@@ -377,7 +380,7 @@ export abstract class GridParentComponent {
|
|||||||
let slick: any = this.slickgrids.toArray()[index];
|
let slick: any = this.slickgrids.toArray()[index];
|
||||||
let grid = slick._grid;
|
let grid = slick._grid;
|
||||||
|
|
||||||
let selection = this.slickgrids.toArray()[index].getSelectedRanges();
|
let selection = this.getSelection(index);
|
||||||
|
|
||||||
if (selection && selection.length === 0) {
|
if (selection && selection.length === 0) {
|
||||||
let cell = (grid as Slick.Grid<any>).getCellFromEvent(event);
|
let cell = (grid as Slick.Grid<any>).getCellFromEvent(event);
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
<span> {{LocalizedConstants.resultPaneLabel}} </span>
|
<span> {{LocalizedConstants.resultPaneLabel}} </span>
|
||||||
<span class="queryResultsShortCut"> {{resultShortcut}} </span>
|
<span class="queryResultsShortCut"> {{resultShortcut}} </span>
|
||||||
</div>
|
</div>
|
||||||
<div id="results" *ngIf="renderedDataSets.length > 0" class="results vertBox scrollable"
|
<div #resultsScrollBox id="results" *ngIf="renderedDataSets.length > 0" class="results vertBox scrollable"
|
||||||
(onScroll)="onScroll($event)" [scrollEnabled]="scrollEnabled" [class.hidden]="!resultActive"
|
(onScroll)="onScroll($event)" [scrollEnabled]="scrollEnabled" [class.hidden]="!resultActive"
|
||||||
(focusin)="onGridFocus()" (focusout)="onGridFocusout()">
|
(focusin)="onGridFocus()" (focusout)="onGridFocusout()">
|
||||||
<div class="boxRow content horzBox slickgrid" *ngFor="let dataSet of renderedDataSets; let i = index"
|
<div class="boxRow content horzBox slickgrid" *ngFor="let dataSet of renderedDataSets; let i = index"
|
||||||
[style.max-height]="dataSet.maxHeight" [style.min-height]="dataSet.minHeight">
|
[style.max-height]="dataSet.maxHeight" [style.min-height]="dataSet.minHeight">
|
||||||
<slick-grid #slickgrid id="slickgrid_{{i}}" [columnDefinitions]="dataSet.columnDefinitions"
|
<slick-grid #slickgrid id="slickgrid_{{i}}" [columnDefinitions]="dataSet.columnDefinitions"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
ElementRef, QueryList, ChangeDetectorRef, OnInit, OnDestroy, Component, Inject,
|
ElementRef, QueryList, ChangeDetectorRef, OnInit, OnDestroy, Component, Inject,
|
||||||
ViewChildren, forwardRef, EventEmitter, Input, ViewChild
|
ViewChildren, forwardRef, EventEmitter, Input, ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { IGridDataRow, SlickGrid, VirtualizedCollection } from 'angular2-slickgrid';
|
import { IGridDataRow, SlickGrid, VirtualizedCollection, ISlickRange } from 'angular2-slickgrid';
|
||||||
|
|
||||||
import * as LocalizedConstants from 'sql/parts/query/common/localizedConstants';
|
import * as LocalizedConstants from 'sql/parts/query/common/localizedConstants';
|
||||||
import * as Services from 'sql/parts/grid/services/sharedServices';
|
import * as Services from 'sql/parts/grid/services/sharedServices';
|
||||||
@@ -91,7 +91,7 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
icon: () => { return 'saveCsv'; },
|
icon: () => { return 'saveCsv'; },
|
||||||
hoverText: () => { return LocalizedConstants.saveCSVLabel; },
|
hoverText: () => { return LocalizedConstants.saveCSVLabel; },
|
||||||
functionality: (batchId, resultId, index) => {
|
functionality: (batchId, resultId, index) => {
|
||||||
let selection = this.slickgrids.toArray()[index].getSelectedRanges();
|
let selection = this.getSelection(index);
|
||||||
if (selection.length <= 1) {
|
if (selection.length <= 1) {
|
||||||
this.handleContextClick({ type: 'savecsv', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
this.handleContextClick({ type: 'savecsv', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
||||||
} else {
|
} else {
|
||||||
@@ -104,7 +104,7 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
icon: () => { return 'saveJson'; },
|
icon: () => { return 'saveJson'; },
|
||||||
hoverText: () => { return LocalizedConstants.saveJSONLabel; },
|
hoverText: () => { return LocalizedConstants.saveJSONLabel; },
|
||||||
functionality: (batchId, resultId, index) => {
|
functionality: (batchId, resultId, index) => {
|
||||||
let selection = this.slickgrids.toArray()[index].getSelectedRanges();
|
let selection = this.getSelection(index);
|
||||||
if (selection.length <= 1) {
|
if (selection.length <= 1) {
|
||||||
this.handleContextClick({ type: 'savejson', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
this.handleContextClick({ type: 'savejson', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
||||||
} else {
|
} else {
|
||||||
@@ -117,7 +117,7 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
icon: () => { return 'saveExcel'; },
|
icon: () => { return 'saveExcel'; },
|
||||||
hoverText: () => { return LocalizedConstants.saveExcelLabel; },
|
hoverText: () => { return LocalizedConstants.saveExcelLabel; },
|
||||||
functionality: (batchId, resultId, index) => {
|
functionality: (batchId, resultId, index) => {
|
||||||
let selection = this.slickgrids.toArray()[index].getSelectedRanges();
|
let selection = this.getSelection(index);
|
||||||
if (selection.length <= 1) {
|
if (selection.length <= 1) {
|
||||||
this.handleContextClick({ type: 'saveexcel', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
this.handleContextClick({ type: 'saveexcel', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
||||||
} else {
|
} else {
|
||||||
@@ -161,6 +161,13 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
public showChartRequested: EventEmitter<IGridDataSet> = new EventEmitter<IGridDataSet>();
|
public showChartRequested: EventEmitter<IGridDataSet> = new EventEmitter<IGridDataSet>();
|
||||||
public goToNextQueryOutputTabRequested: EventEmitter<void> = new EventEmitter<void>();
|
public goToNextQueryOutputTabRequested: EventEmitter<void> = new EventEmitter<void>();
|
||||||
|
|
||||||
|
private savedViewState: {
|
||||||
|
gridSelections: ISlickRange[][];
|
||||||
|
resultsScroll: number;
|
||||||
|
messagePaneScroll: number;
|
||||||
|
slickGridScrolls: { vertical: number; horizontal: number }[];
|
||||||
|
};
|
||||||
|
|
||||||
@Input() public queryParameters: IQueryComponentParams;
|
@Input() public queryParameters: IQueryComponentParams;
|
||||||
|
|
||||||
@ViewChildren('slickgrid') slickgrids: QueryList<SlickGrid>;
|
@ViewChildren('slickgrid') slickgrids: QueryList<SlickGrid>;
|
||||||
@@ -168,6 +175,8 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
@ViewChild('resultsPane', { read: ElementRef }) private _resultsPane: ElementRef;
|
@ViewChild('resultsPane', { read: ElementRef }) private _resultsPane: ElementRef;
|
||||||
@ViewChild('queryLink', { read: ElementRef }) private _queryLinkElement: ElementRef;
|
@ViewChild('queryLink', { read: ElementRef }) private _queryLinkElement: ElementRef;
|
||||||
@ViewChild('messagesContainer', { read: ElementRef }) private _messagesContainer: ElementRef;
|
@ViewChild('messagesContainer', { read: ElementRef }) private _messagesContainer: ElementRef;
|
||||||
|
@ViewChild('resultsScrollBox', { read: ElementRef }) private _resultsScrollBox: ElementRef;
|
||||||
|
@ViewChildren('slickgrid', { read: ElementRef }) private _slickgridElements: QueryList<ElementRef>;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef,
|
||||||
@@ -225,6 +234,10 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
}
|
}
|
||||||
self._cd.detectChanges();
|
self._cd.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.queryParameters.onSaveViewState(() => this.saveViewState());
|
||||||
|
this.queryParameters.onRestoreViewState(() => this.restoreViewState());
|
||||||
|
|
||||||
this.dataService.onAngularLoaded();
|
this.dataService.onAngularLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,6 +664,43 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private saveViewState(): void {
|
||||||
|
let gridSelections = this.slickgrids.map(grid => grid.getSelectedRanges());
|
||||||
|
let resultsScrollElement = (this._resultsScrollBox.nativeElement as HTMLElement);
|
||||||
|
let resultsScroll = resultsScrollElement.scrollTop;
|
||||||
|
let messagePaneScroll = (this._messagesContainer.nativeElement as HTMLElement).scrollTop;
|
||||||
|
let slickGridScrolls = this._slickgridElements.map(element => {
|
||||||
|
// Get the slick grid's viewport element and save its scroll position
|
||||||
|
let scrollElement = (element.nativeElement as HTMLElement).children[0].children[3];
|
||||||
|
return {
|
||||||
|
vertical: scrollElement.scrollTop,
|
||||||
|
horizontal: scrollElement.scrollLeft
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.savedViewState = {
|
||||||
|
gridSelections,
|
||||||
|
messagePaneScroll,
|
||||||
|
resultsScroll,
|
||||||
|
slickGridScrolls
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private restoreViewState(): void {
|
||||||
|
if (this.savedViewState) {
|
||||||
|
this.slickgrids.forEach((grid, index) => grid.selection = this.savedViewState.gridSelections[index]);
|
||||||
|
(this._resultsScrollBox.nativeElement as HTMLElement).scrollTop = this.savedViewState.resultsScroll;
|
||||||
|
(this._messagesContainer.nativeElement as HTMLElement).scrollTop = this.savedViewState.messagePaneScroll;
|
||||||
|
this._slickgridElements.forEach((element, index) => {
|
||||||
|
let scrollElement = (element.nativeElement as HTMLElement).children[0].children[3];
|
||||||
|
let savedScroll = this.savedViewState.slickGridScrolls[index];
|
||||||
|
scrollElement.scrollTop = savedScroll.vertical;
|
||||||
|
scrollElement.scrollLeft = savedScroll.horizontal;
|
||||||
|
});
|
||||||
|
this.savedViewState = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
layout() {
|
layout() {
|
||||||
this.resizeGrids();
|
this.resizeGrids();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { Color } from 'vs/base/common/color';
|
|||||||
<div>
|
<div>
|
||||||
<label for={{this.label}}>
|
<label for={{this.label}}>
|
||||||
<div #input style="width: 100%">
|
<div #input style="width: 100%">
|
||||||
<input *ngIf="this.isFile === true" id={{this.label}} type="file" style="display: none">
|
<input #fileInput *ngIf="this.isFile === true" id={{this.label}} type="file" accept=".sql" style="display: none">
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,17 +39,16 @@ export default class ButtonComponent extends ComponentWithIconBase implements IC
|
|||||||
private _button: Button;
|
private _button: Button;
|
||||||
|
|
||||||
@ViewChild('input', { read: ElementRef }) private _inputContainer: ElementRef;
|
@ViewChild('input', { read: ElementRef }) private _inputContainer: ElementRef;
|
||||||
|
@ViewChild('fileInput', { read: ElementRef }) private _fileInputContainer: ElementRef;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService
|
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService
|
||||||
) {
|
) {
|
||||||
super(changeRef);
|
super(changeRef);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.baseInit();
|
this.baseInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
@@ -61,10 +60,27 @@ export default class ButtonComponent extends ComponentWithIconBase implements IC
|
|||||||
buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND, buttonForeground: SIDE_BAR_TITLE_FOREGROUND
|
buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND, buttonForeground: SIDE_BAR_TITLE_FOREGROUND
|
||||||
}));
|
}));
|
||||||
this._register(this._button.onDidClick(e => {
|
this._register(this._button.onDidClick(e => {
|
||||||
this._onEventEmitter.fire({
|
if (this._fileInputContainer) {
|
||||||
eventType: ComponentEventType.onDidClick,
|
const self = this;
|
||||||
args: e
|
this._fileInputContainer.nativeElement.onchange = () => {
|
||||||
});
|
let file = self._fileInputContainer.nativeElement.files[0];
|
||||||
|
let reader = new FileReader();
|
||||||
|
reader.onload = (e) => {
|
||||||
|
let text = (<FileReader>e.target).result;
|
||||||
|
self.fileContent = text;
|
||||||
|
self._onEventEmitter.fire({
|
||||||
|
eventType: ComponentEventType.onDidClick,
|
||||||
|
args: self.fileContent
|
||||||
|
});
|
||||||
|
};
|
||||||
|
reader.readAsText(file);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this._onEventEmitter.fire({
|
||||||
|
eventType: ComponentEventType.onDidClick,
|
||||||
|
args: e
|
||||||
|
});
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,6 +149,18 @@ export default class ButtonComponent extends ComponentWithIconBase implements IC
|
|||||||
this.setPropertyFromUI<sqlops.ButtonProperties, boolean>(this.setFileProperties, newValue);
|
this.setPropertyFromUI<sqlops.ButtonProperties, boolean>(this.setFileProperties, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get fileContent(): string {
|
||||||
|
return this.getPropertyOrDefault<sqlops.ButtonProperties, string>((props) => props.fileContent, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
private set fileContent(newValue: string) {
|
||||||
|
this.setPropertyFromUI<sqlops.ButtonProperties, string>(this.setFileContentProperties, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private setFileContentProperties(properties: sqlops.ButtonProperties, fileContent: string) : void {
|
||||||
|
properties.fileContent = fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
private setValueProperties(properties: sqlops.ButtonProperties, label: string): void {
|
private setValueProperties(properties: sqlops.ButtonProperties, label: string): void {
|
||||||
properties.label = label;
|
properties.label = label;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import TableComponent from './table.component';
|
|||||||
import TextComponent from './text.component';
|
import TextComponent from './text.component';
|
||||||
import LoadingComponent from './loadingComponent.component';
|
import LoadingComponent from './loadingComponent.component';
|
||||||
import FileBrowserTreeComponent from './fileBrowserTree.component';
|
import FileBrowserTreeComponent from './fileBrowserTree.component';
|
||||||
|
import EditorComponent from './editor.component';
|
||||||
import { registerComponentType } from 'sql/platform/dashboard/common/modelComponentRegistry';
|
import { registerComponentType } from 'sql/platform/dashboard/common/modelComponentRegistry';
|
||||||
import { ModelComponentTypes } from 'sql/workbench/api/common/sqlExtHostTypes';
|
import { ModelComponentTypes } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||||
|
|
||||||
@@ -74,3 +75,6 @@ registerComponentType(LOADING_COMPONENT, ModelComponentTypes.LoadingComponent, L
|
|||||||
|
|
||||||
export const FILEBROWSERTREE_COMPONENT = 'filebrowsertree-component';
|
export const FILEBROWSERTREE_COMPONENT = 'filebrowsertree-component';
|
||||||
registerComponentType(FILEBROWSERTREE_COMPONENT, ModelComponentTypes.FileBrowserTree, FileBrowserTreeComponent);
|
registerComponentType(FILEBROWSERTREE_COMPONENT, ModelComponentTypes.FileBrowserTree, FileBrowserTreeComponent);
|
||||||
|
|
||||||
|
export const EDITOR_COMPONENT = 'editor-component';
|
||||||
|
registerComponentType(EDITOR_COMPONENT, ModelComponentTypes.Editor, EditorComponent);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
|
|||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
||||||
|
import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editabledropdown.component';
|
||||||
import { ISelectData } from 'vs/base/browser/ui/selectBox/selectBox';
|
import { ISelectData } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||||
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
@@ -24,29 +25,38 @@ import * as nls from 'vs/nls';
|
|||||||
export enum DeclarativeDataType {
|
export enum DeclarativeDataType {
|
||||||
string = 'string',
|
string = 'string',
|
||||||
category = 'category',
|
category = 'category',
|
||||||
boolean = 'boolean'
|
boolean = 'boolean',
|
||||||
|
editableCategory = 'editableCategory'
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-declarativeTable',
|
selector: 'modelview-declarativeTable',
|
||||||
template: `
|
template: `
|
||||||
<table role=grid aria-labelledby="ID_REF" #container *ngIf="columns" class="declarative-table">
|
<table role=grid aria-labelledby="ID_REF" #container *ngIf="columns" class="declarative-table">
|
||||||
|
<thead>
|
||||||
|
<tr style="display:block;">
|
||||||
<ng-container *ngFor="let column of columns;let h = index">
|
<ng-container *ngFor="let column of columns;let h = index">
|
||||||
<th class="declarative-table-header" tabindex="-1" role="button" aria-sort="none">{{column.displayName}}</th>
|
<td class="declarative-table-header" tabindex="-1" [style.width]="getColumnWidth(h)" role="button" aria-sort="none">{{column.displayName}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
<ng-container *ngIf="data">
|
<ng-container *ngIf="data">
|
||||||
|
<tbody style="display: block; width:100%; overflow-y: scroll" [style.height]="getHeight()">
|
||||||
<ng-container *ngFor="let row of data;let r = index">
|
<ng-container *ngFor="let row of data;let r = index">
|
||||||
<tr class="declarative-table-row">
|
<tr class="declarative-table-row">
|
||||||
<ng-container *ngFor="let cellData of row;let c = index">
|
<ng-container *ngFor="let cellData of row;let c = index">
|
||||||
<td class="declarative-table-cell" tabindex="-1" role="button" [style.width]="getColumnWidth(c)">
|
<td class="declarative-table-cell" tabindex="-1" role="button" [style.width]="getColumnWidth(c)">
|
||||||
<checkbox *ngIf="isCheckBox(c)" label="" (onChange)="onCheckBoxChanged($event,r,c)" [enabled]="isControlEnabled(c)" [checked]="isChecked(r,c)"></checkbox>
|
<checkbox *ngIf="isCheckBox(c)" label="" (onChange)="onCheckBoxChanged($event,r,c)" [enabled]="isControlEnabled(c)" [checked]="isChecked(r,c)"></checkbox>
|
||||||
<select-box *ngIf="isSelectBox(c)" [options]="GetOptions(c)" (onDidSelect)="onSelectBoxChanged($event,r,c)" [selectedOption]="GetSelectedOptionDisplayName(r,c)"></select-box>
|
<select-box *ngIf="isSelectBox(c)" [options]="GetOptions(c)" (onDidSelect)="onSelectBoxChanged($event,r,c)" [selectedOption]="GetSelectedOptionDisplayName(r,c)"></select-box>
|
||||||
|
<editable-select-box *ngIf="isEditableSelectBox(c)" [options]="GetOptions(c)" (onDidSelect)="onSelectBoxChanged($event,r,c)" [selectedOption]="GetSelectedOptionDisplayName(r,c)"></editable-select-box>
|
||||||
<input-box *ngIf="isInputBox(c)" [value]="cellData" (onDidChange)="onInputBoxChanged($event,r,c)"></input-box>
|
<input-box *ngIf="isInputBox(c)" [value]="cellData" (onDidChange)="onInputBoxChanged($event,r,c)"></input-box>
|
||||||
<ng-container *ngIf="isLabel(c)" >{{cellData}}</ng-container>
|
<ng-container *ngIf="isLabel(c)" >{{cellData}}</ng-container>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
</tbody>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</table>
|
</table>
|
||||||
`
|
`
|
||||||
@@ -109,10 +119,20 @@ export default class DeclarativeTableComponent extends ComponentBase implements
|
|||||||
this.onCellDataChanged(e, row, cell);
|
this.onCellDataChanged(e, row, cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onSelectBoxChanged(e: ISelectData, row: number, cell: number): void {
|
private onSelectBoxChanged(e: ISelectData | string, row: number, cell: number): void {
|
||||||
|
|
||||||
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
||||||
if (column.categoryValues) {
|
if (column.categoryValues) {
|
||||||
this.onCellDataChanged(column.categoryValues[e.index].name, row, cell);
|
if (typeof e === 'string') {
|
||||||
|
let category = column.categoryValues.find(c => c.displayName === e);
|
||||||
|
if (category) {
|
||||||
|
this.onCellDataChanged(category.name, row, cell);
|
||||||
|
} else {
|
||||||
|
this.onCellDataChanged(e, row, cell);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.onCellDataChanged(column.categoryValues[e.index].name, row, cell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +155,11 @@ export default class DeclarativeTableComponent extends ComponentBase implements
|
|||||||
return column.valueType === DeclarativeDataType.category;
|
return column.valueType === DeclarativeDataType.category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isEditableSelectBox(cell: number): boolean {
|
||||||
|
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
||||||
|
return column.valueType === DeclarativeDataType.editableCategory;
|
||||||
|
}
|
||||||
|
|
||||||
private isInputBox(cell: number): boolean {
|
private isInputBox(cell: number): boolean {
|
||||||
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
||||||
return column.valueType === DeclarativeDataType.string && !column.isReadOnly;
|
return column.valueType === DeclarativeDataType.string && !column.isReadOnly;
|
||||||
@@ -142,7 +167,7 @@ export default class DeclarativeTableComponent extends ComponentBase implements
|
|||||||
|
|
||||||
private getColumnWidth(cell: number): string {
|
private getColumnWidth(cell: number): string {
|
||||||
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
let column: sqlops.DeclarativeTableColumn = this.columns[cell];
|
||||||
return this.convertSize(column.width);
|
return this.convertSize(column.width, '30px');
|
||||||
}
|
}
|
||||||
|
|
||||||
private GetOptions(cell: number): string[] {
|
private GetOptions(cell: number): string[] {
|
||||||
@@ -155,7 +180,13 @@ export default class DeclarativeTableComponent extends ComponentBase implements
|
|||||||
let cellData = this.data[row][cell];
|
let cellData = this.data[row][cell];
|
||||||
if (cellData && column.categoryValues) {
|
if (cellData && column.categoryValues) {
|
||||||
let category = column.categoryValues.find(v => v.name === cellData);
|
let category = column.categoryValues.find(v => v.name === cellData);
|
||||||
return category.displayName;
|
if (category) {
|
||||||
|
return category.displayName;
|
||||||
|
} else if (this.isEditableSelectBox(cell)) {
|
||||||
|
return cellData;
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
.declarative-table {
|
.declarative-table {
|
||||||
padding: 5px 30px 0px 30px;
|
padding: 5px 30px 0px 30px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width:100%;
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,6 +12,7 @@
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
background-color: #F5F5F5;
|
background-color: #F5F5F5;
|
||||||
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vs-dark .declarative-table-header {
|
.vs-dark .declarative-table-header {
|
||||||
|
|||||||
135
src/sql/parts/modelComponents/editor.component.ts
Normal file
135
src/sql/parts/modelComponents/editor.component.ts
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
import 'vs/css!./editor';
|
||||||
|
import {
|
||||||
|
Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver,
|
||||||
|
ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, QueryList
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import * as sqlops from 'sqlops';
|
||||||
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { ITextModel } from 'vs/editor/common/model';
|
||||||
|
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||||
|
import URI from 'vs/base/common/uri';
|
||||||
|
import { Schemas } from 'vs/base/common/network';
|
||||||
|
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||||
|
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||||
|
|
||||||
|
import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
|
||||||
|
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/parts/modelComponents/interfaces';
|
||||||
|
import { QueryTextEditor } from 'sql/parts/modelComponents/queryTextEditor';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
template: '',
|
||||||
|
selector: 'modelview-editor-component'
|
||||||
|
})
|
||||||
|
export default class EditorComponent extends ComponentBase implements IComponent, OnDestroy {
|
||||||
|
@Input() descriptor: IComponentDescriptor;
|
||||||
|
@Input() modelStore: IModelStore;
|
||||||
|
private _editor: QueryTextEditor;
|
||||||
|
private _editorInput: UntitledEditorInput;
|
||||||
|
private _editorModel: ITextModel;
|
||||||
|
private _renderedContent: string;
|
||||||
|
private _langaugeMode: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||||
|
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
||||||
|
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
|
||||||
|
@Inject(IModelService) private _modelService: IModelService,
|
||||||
|
@Inject(IModeService) private _modeService: IModeService
|
||||||
|
) {
|
||||||
|
super(changeRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.baseInit();
|
||||||
|
this._createEditor();
|
||||||
|
this._register(DOM.addDisposableListener(window, DOM.EventType.RESIZE, e => {
|
||||||
|
this.layout();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private _createEditor(): void {
|
||||||
|
this._editor = this._instantiationService.createInstance(QueryTextEditor);
|
||||||
|
this._editor.create(this._el.nativeElement);
|
||||||
|
this._editor.setVisible(true);
|
||||||
|
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: Schemas.untitled, path: `${this.descriptor.type}-${this.descriptor.id}` }), false, 'sql', '', '');
|
||||||
|
this._editor.setInput(this._editorInput, undefined);
|
||||||
|
this._editorInput.resolve().then(model => this._editorModel = model.textEditorModel);
|
||||||
|
|
||||||
|
this._register(this._editor);
|
||||||
|
this._register(this._editorInput);
|
||||||
|
this._register(this._editorModel.onDidChangeContent(e => {
|
||||||
|
this.content = this._editorModel.getValue();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.baseDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// IComponent implementation
|
||||||
|
|
||||||
|
public layout(): void {
|
||||||
|
let width: number = this.convertSizeToNumber(this.width);
|
||||||
|
let height: number = this.convertSizeToNumber(this.height);
|
||||||
|
this._editor.layout(new DOM.Dimension(
|
||||||
|
width && width > 0 ? width : DOM.getContentWidth(this._el.nativeElement),
|
||||||
|
height && height > 0 ? height : DOM.getContentHeight(this._el.nativeElement)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Editor Functions
|
||||||
|
private updateModel() {
|
||||||
|
if (this._editorModel) {
|
||||||
|
this._renderedContent = this.content;
|
||||||
|
this._modelService.updateModel(this._editorModel, this._renderedContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateLanguageMode() {
|
||||||
|
if (this._editorModel && this._editor) {
|
||||||
|
this._langaugeMode = this.languageMode;
|
||||||
|
this._modeService.getOrCreateMode(this._langaugeMode).then((modeValue) => {
|
||||||
|
this._modelService.setMode(this._editorModel, modeValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// IComponent implementation
|
||||||
|
|
||||||
|
public setLayout(layout: any): void {
|
||||||
|
// TODO allow configuring the look and feel
|
||||||
|
this.layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
public setProperties(properties: { [key: string]: any; }): void {
|
||||||
|
super.setProperties(properties);
|
||||||
|
if (this.content !== this._renderedContent) {
|
||||||
|
this.updateModel();
|
||||||
|
}
|
||||||
|
if (this.languageMode !== this._langaugeMode) {
|
||||||
|
this.updateLanguageMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CSS-bound properties
|
||||||
|
public get content(): string {
|
||||||
|
return this.getPropertyOrDefault<sqlops.EditorProperties, string>((props) => props.content, undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
public set content(newValue: string) {
|
||||||
|
this.setPropertyFromUI<sqlops.EditorProperties, string>((properties, content) => { properties.content = content; }, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get languageMode(): string {
|
||||||
|
return this.getPropertyOrDefault<sqlops.EditorProperties, string>((props) => props.languageMode, undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
public set languageMode(newValue: string) {
|
||||||
|
this.setPropertyFromUI<sqlops.EditorProperties, string>((properties, languageMode) => { properties.languageMode = languageMode; }, newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/sql/parts/modelComponents/editor.css
Normal file
10
src/sql/parts/modelComponents/editor.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
modelview-editor-component {
|
||||||
|
height: 100%;
|
||||||
|
width : 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
113
src/sql/parts/modelComponents/queryTextEditor.ts
Normal file
113
src/sql/parts/modelComponents/queryTextEditor.ts
Normal 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.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||||
|
import * as nls from 'vs/nls';
|
||||||
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
|
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||||
|
import { TPromise } from 'vs/base/common/winjs.base';
|
||||||
|
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||||
|
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||||
|
|
||||||
|
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||||
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||||
|
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||||
|
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||||
|
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||||
|
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||||
|
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||||
|
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||||
|
import { IEditorContributionCtor } from 'vs/editor/browser/editorExtensions';
|
||||||
|
import { FoldingController } from 'vs/editor/contrib/folding/folding';
|
||||||
|
|
||||||
|
class QueryCodeEditor extends CodeEditor {
|
||||||
|
|
||||||
|
protected _getContributions(): IEditorContributionCtor[] {
|
||||||
|
let contributions = super._getContributions();
|
||||||
|
let skipContributions = [FoldingController.prototype];
|
||||||
|
contributions = contributions.filter(c => skipContributions.indexOf(c.prototype) === -1);
|
||||||
|
return contributions;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of TextResourceEditor that is always readonly rather than only with non UntitledInputs
|
||||||
|
*/
|
||||||
|
export class QueryTextEditor extends BaseTextEditor {
|
||||||
|
|
||||||
|
public static ID = 'modelview.editors.textEditor';
|
||||||
|
private _dimension: DOM.Dimension;
|
||||||
|
constructor(
|
||||||
|
@ITelemetryService telemetryService: ITelemetryService,
|
||||||
|
@IInstantiationService instantiationService: IInstantiationService,
|
||||||
|
@IStorageService storageService: IStorageService,
|
||||||
|
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
|
||||||
|
@IThemeService themeService: IThemeService,
|
||||||
|
@IModeService modeService: IModeService,
|
||||||
|
@ITextFileService textFileService: ITextFileService,
|
||||||
|
@IEditorGroupService editorGroupService: IEditorGroupService
|
||||||
|
|
||||||
|
) {
|
||||||
|
super(QueryTextEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||||
|
}
|
||||||
|
|
||||||
|
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
|
||||||
|
return this.instantiationService.createInstance(QueryCodeEditor, parent, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getConfigurationOverrides(): IEditorOptions {
|
||||||
|
const options = super.getConfigurationOverrides();
|
||||||
|
if (this.input) {
|
||||||
|
options.inDiffEditor = true;
|
||||||
|
options.scrollBeyondLastLine = false;
|
||||||
|
options.folding = false;
|
||||||
|
options.renderWhitespace = 'none';
|
||||||
|
options.wordWrap = 'on';
|
||||||
|
options.renderIndentGuides = false;
|
||||||
|
options.rulers = [];
|
||||||
|
options.glyphMargin = true;
|
||||||
|
options.minimap = {
|
||||||
|
enabled: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
setInput(input: UntitledEditorInput, options: EditorOptions): TPromise<void> {
|
||||||
|
return super.setInput(input, options)
|
||||||
|
.then(() => this.input.resolve()
|
||||||
|
.then(editorModel => editorModel.load())
|
||||||
|
.then(editorModel => this.getControl().setModel((<ResourceEditorModel>editorModel).textEditorModel)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getAriaLabel(): string {
|
||||||
|
return nls.localize('queryTextEditorAriaLabel', 'modelview code editor for view model.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public layout(dimension?: DOM.Dimension){
|
||||||
|
if (dimension) {
|
||||||
|
this._dimension = dimension;
|
||||||
|
}
|
||||||
|
this.getControl().layout(dimension);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setWidth(width: number) {
|
||||||
|
if (this._dimension) {
|
||||||
|
this._dimension.width = width;
|
||||||
|
this.layout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public setHeight(height: number) {
|
||||||
|
if (this._dimension) {
|
||||||
|
this._dimension.height = height;
|
||||||
|
this.layout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ import { RowSelectionModel } from 'sql/base/browser/ui/table/plugins/rowSelectio
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-table',
|
selector: 'modelview-table',
|
||||||
template: `
|
template: `
|
||||||
<div #table style="width: 100%;height:100%"></div>
|
<div #table style="width: 100%;height:100%" [style.font-size]="fontSize"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class TableComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit {
|
export default class TableComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -98,7 +98,7 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
|||||||
syncColumnCellResize: true,
|
syncColumnCellResize: true,
|
||||||
enableColumnReorder: false,
|
enableColumnReorder: false,
|
||||||
enableCellNavigation: true,
|
enableCellNavigation: true,
|
||||||
forceFitColumns: true,
|
forceFitColumns: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this._table = new Table<Slick.SlickData>(this._inputContainer.nativeElement, this._tableData, this._tableColumns, options);
|
this._table = new Table<Slick.SlickData>(this._inputContainer.nativeElement, this._tableData, this._tableColumns, options);
|
||||||
@@ -178,6 +178,10 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
|||||||
return this.getPropertyOrDefault<sqlops.TableComponentProperties, string[]>((props) => props.columns, []);
|
return this.getPropertyOrDefault<sqlops.TableComponentProperties, string[]>((props) => props.columns, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get fontSize(): number | string {
|
||||||
|
return this.getPropertyOrDefault<sqlops.TableComponentProperties, number | string>((props) => props.fontSize, '');
|
||||||
|
}
|
||||||
|
|
||||||
public set columns(newValue: string[]) {
|
public set columns(newValue: string[]) {
|
||||||
this.setPropertyFromUI<sqlops.TableComponentProperties, string[]>((props, value) => props.columns = value, newValue);
|
this.setPropertyFromUI<sqlops.TableComponentProperties, string[]>((props, value) => props.columns = value, newValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ export class OEScriptSelectAction extends ScriptSelectAction {
|
|||||||
}
|
}
|
||||||
this._treeSelectionHandler.onTreeActionStateChange(true);
|
this._treeSelectionHandler.onTreeActionStateChange(true);
|
||||||
var connectionProfile = TreeUpdateUtils.getConnectionProfile(this._objectExplorerTreeNode);
|
var connectionProfile = TreeUpdateUtils.getConnectionProfile(this._objectExplorerTreeNode);
|
||||||
var ownerUri = this._connectionManagementService.getConnectionId(connectionProfile);
|
var ownerUri = this._connectionManagementService.getConnectionUri(connectionProfile);
|
||||||
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
||||||
var metadata = this._objectExplorerTreeNode.metadata;
|
var metadata = this._objectExplorerTreeNode.metadata;
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ export class OEScriptCreateAction extends ScriptCreateAction {
|
|||||||
this._treeSelectionHandler.onTreeActionStateChange(true);
|
this._treeSelectionHandler.onTreeActionStateChange(true);
|
||||||
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
||||||
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
||||||
var ownerUri = this._connectionManagementService.getConnectionId(connectionProfile);
|
var ownerUri = this._connectionManagementService.getConnectionUri(connectionProfile);
|
||||||
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
||||||
|
|
||||||
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
||||||
@@ -291,7 +291,7 @@ export class OEScriptExecuteAction extends ScriptExecuteAction {
|
|||||||
this._treeSelectionHandler.onTreeActionStateChange(true);
|
this._treeSelectionHandler.onTreeActionStateChange(true);
|
||||||
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
||||||
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
||||||
var ownerUri = this._connectionManagementService.getConnectionId(connectionProfile);
|
var ownerUri = this._connectionManagementService.getConnectionUri(connectionProfile);
|
||||||
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
||||||
|
|
||||||
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
||||||
@@ -327,7 +327,7 @@ export class OEScriptAlterAction extends ScriptAlterAction {
|
|||||||
this._treeSelectionHandler.onTreeActionStateChange(true);
|
this._treeSelectionHandler.onTreeActionStateChange(true);
|
||||||
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
||||||
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
||||||
var ownerUri = this._connectionManagementService.getConnectionId(connectionProfile);
|
var ownerUri = this._connectionManagementService.getConnectionUri(connectionProfile);
|
||||||
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
||||||
|
|
||||||
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
||||||
@@ -363,7 +363,7 @@ export class OEScriptDeleteAction extends ScriptDeleteAction {
|
|||||||
this._treeSelectionHandler.onTreeActionStateChange(true);
|
this._treeSelectionHandler.onTreeActionStateChange(true);
|
||||||
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
var connectionProfile = TreeUpdateUtils.getConnectionProfile(<TreeNode>this._objectExplorerTreeNode);
|
||||||
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
var metadata = (<TreeNode>this._objectExplorerTreeNode).metadata;
|
||||||
var ownerUri = this._connectionManagementService.getConnectionId(connectionProfile);
|
var ownerUri = this._connectionManagementService.getConnectionUri(connectionProfile);
|
||||||
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
ownerUri = this._connectionManagementService.getFormattedUri(ownerUri, connectionProfile);
|
||||||
|
|
||||||
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
return super.run({ profile: connectionProfile, object: metadata }).then((result) => {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
|||||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { IRange } from 'vs/editor/common/core/range';
|
import { IRange } from 'vs/editor/common/core/range';
|
||||||
import { IEditorViewState } from 'vs/editor/common/editorCommon';
|
import { IEditorViewState } from 'vs/editor/common/editorCommon';
|
||||||
|
import { Emitter } from 'vs/base/common/event';
|
||||||
|
|
||||||
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||||
@@ -41,7 +42,7 @@ import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar';
|
|||||||
import {
|
import {
|
||||||
RunQueryAction, CancelQueryAction, ListDatabasesAction, ListDatabasesActionItem,
|
RunQueryAction, CancelQueryAction, ListDatabasesAction, ListDatabasesActionItem,
|
||||||
ConnectDatabaseAction, ToggleConnectDatabaseAction, EstimatedQueryPlanAction,
|
ConnectDatabaseAction, ToggleConnectDatabaseAction, EstimatedQueryPlanAction,
|
||||||
ActualQueryPlanAction
|
ActualQueryPlanAction, ParseSyntaxAction
|
||||||
} from 'sql/parts/query/execution/queryActions';
|
} from 'sql/parts/query/execution/queryActions';
|
||||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||||
import { IEditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
import { IEditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
||||||
@@ -87,8 +88,10 @@ export class QueryEditor extends BaseEditor {
|
|||||||
private _listDatabasesAction: ListDatabasesAction;
|
private _listDatabasesAction: ListDatabasesAction;
|
||||||
private _estimatedQueryPlanAction: EstimatedQueryPlanAction;
|
private _estimatedQueryPlanAction: EstimatedQueryPlanAction;
|
||||||
private _actualQueryPlanAction: ActualQueryPlanAction;
|
private _actualQueryPlanAction: ActualQueryPlanAction;
|
||||||
|
private _parseSyntaxAction: ParseSyntaxAction;
|
||||||
|
|
||||||
private _savedViewStates = new Map<IEditorInput, IEditorViewState>();
|
private _savedViewStates = new Map<IEditorInput, IEditorViewState>();
|
||||||
|
private _resultViewStateChangeEmitters = new Map<QueryResultsInput, { onSaveViewState: Emitter<void>; onRestoreViewState: Emitter<void> }>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ITelemetryService _telemetryService: ITelemetryService,
|
@ITelemetryService _telemetryService: ITelemetryService,
|
||||||
@@ -368,6 +371,22 @@ export class QueryEditor extends BaseEditor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getAllText(): string {
|
||||||
|
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||||
|
let control = this._sqlEditor.getControl();
|
||||||
|
let codeEditor: CodeEditor = <CodeEditor>control;
|
||||||
|
if (codeEditor) {
|
||||||
|
let value = codeEditor.getValue();
|
||||||
|
if (value !== undefined && value.length > 0) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
public getSelectionText(): string {
|
public getSelectionText(): string {
|
||||||
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||||
let control = this._sqlEditor.getControl();
|
let control = this._sqlEditor.getControl();
|
||||||
@@ -437,6 +456,7 @@ export class QueryEditor extends BaseEditor {
|
|||||||
this._listDatabasesAction = this._instantiationService.createInstance(ListDatabasesAction, this);
|
this._listDatabasesAction = this._instantiationService.createInstance(ListDatabasesAction, this);
|
||||||
this._estimatedQueryPlanAction = this._instantiationService.createInstance(EstimatedQueryPlanAction, this);
|
this._estimatedQueryPlanAction = this._instantiationService.createInstance(EstimatedQueryPlanAction, this);
|
||||||
this._actualQueryPlanAction = this._instantiationService.createInstance(ActualQueryPlanAction, this);
|
this._actualQueryPlanAction = this._instantiationService.createInstance(ActualQueryPlanAction, this);
|
||||||
|
this._parseSyntaxAction = this._instantiationService.createInstance(ParseSyntaxAction, this);
|
||||||
|
|
||||||
// Create HTML Elements for the taskbar
|
// Create HTML Elements for the taskbar
|
||||||
let separator = Taskbar.createTaskbarSeparator();
|
let separator = Taskbar.createTaskbarSeparator();
|
||||||
@@ -451,6 +471,7 @@ export class QueryEditor extends BaseEditor {
|
|||||||
{ action: this._listDatabasesAction },
|
{ action: this._listDatabasesAction },
|
||||||
{ element: separator },
|
{ element: separator },
|
||||||
{ action: this._estimatedQueryPlanAction },
|
{ action: this._estimatedQueryPlanAction },
|
||||||
|
{ action: this._parseSyntaxAction }
|
||||||
];
|
];
|
||||||
this._taskbar.setContent(content);
|
this._taskbar.setContent(content);
|
||||||
}
|
}
|
||||||
@@ -490,6 +511,11 @@ export class QueryEditor extends BaseEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oldInput) {
|
if (oldInput) {
|
||||||
|
let resultViewStateChangeEmitters = this._resultViewStateChangeEmitters.get(oldInput.results);
|
||||||
|
if (resultViewStateChangeEmitters) {
|
||||||
|
resultViewStateChangeEmitters.onSaveViewState.fire();
|
||||||
|
}
|
||||||
|
|
||||||
this._disposeEditors();
|
this._disposeEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,6 +590,9 @@ export class QueryEditor extends BaseEditor {
|
|||||||
.then(onEditorsCreated)
|
.then(onEditorsCreated)
|
||||||
.then(doLayout)
|
.then(doLayout)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
if (this._resultViewStateChangeEmitters.has(newInput.results)) {
|
||||||
|
this._resultViewStateChangeEmitters.get(newInput.results).onRestoreViewState.fire();
|
||||||
|
}
|
||||||
if (this._savedViewStates.has(newInput.sql)) {
|
if (this._savedViewStates.has(newInput.sql)) {
|
||||||
this._sqlEditor.getControl().restoreViewState(this._savedViewStates.get(newInput.sql));
|
this._sqlEditor.getControl().restoreViewState(this._savedViewStates.get(newInput.sql));
|
||||||
}
|
}
|
||||||
@@ -598,6 +627,14 @@ export class QueryEditor extends BaseEditor {
|
|||||||
*/
|
*/
|
||||||
private _onResultsEditorCreated(resultsEditor: QueryResultsEditor, resultsInput: QueryResultsInput, options: EditorOptions): TPromise<void> {
|
private _onResultsEditorCreated(resultsEditor: QueryResultsEditor, resultsInput: QueryResultsInput, options: EditorOptions): TPromise<void> {
|
||||||
this._resultsEditor = resultsEditor;
|
this._resultsEditor = resultsEditor;
|
||||||
|
if (!this._resultViewStateChangeEmitters.has(resultsInput)) {
|
||||||
|
this._resultViewStateChangeEmitters.set(resultsInput, {
|
||||||
|
onRestoreViewState: new Emitter<void>(),
|
||||||
|
onSaveViewState: new Emitter<void>()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let emitters = this._resultViewStateChangeEmitters.get(resultsInput);
|
||||||
|
this._resultsEditor.setViewStateChangeEvents(emitters.onRestoreViewState.event, emitters.onSaveViewState.event);
|
||||||
return this._resultsEditor.setInput(resultsInput, options);
|
return this._resultsEditor.setInput(resultsInput, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { IQueryComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
|||||||
import { QueryOutputModule } from 'sql/parts/query/views/queryOutput.module';
|
import { QueryOutputModule } from 'sql/parts/query/views/queryOutput.module';
|
||||||
import { QUERY_OUTPUT_SELECTOR } from 'sql/parts/query/views/queryOutput.component';
|
import { QUERY_OUTPUT_SELECTOR } from 'sql/parts/query/views/queryOutput.component';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export const RESULTS_GRID_DEFAULTS = {
|
export const RESULTS_GRID_DEFAULTS = {
|
||||||
cellPadding: [6, 10, 5],
|
cellPadding: [6, 10, 5],
|
||||||
@@ -95,6 +96,8 @@ export class QueryResultsEditor extends BaseEditor {
|
|||||||
public static AngularSelectorString: string = 'slickgrid-container.slickgridContainer';
|
public static AngularSelectorString: string = 'slickgrid-container.slickgridContainer';
|
||||||
protected _rawOptions: BareResultsGridInfo;
|
protected _rawOptions: BareResultsGridInfo;
|
||||||
protected _input: QueryResultsInput;
|
protected _input: QueryResultsInput;
|
||||||
|
private _restoreViewStateEvent: Event<void>;
|
||||||
|
private _saveViewStateEvent: Event<void>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ITelemetryService telemetryService: ITelemetryService,
|
@ITelemetryService telemetryService: ITelemetryService,
|
||||||
@@ -149,6 +152,11 @@ export class QueryResultsEditor extends BaseEditor {
|
|||||||
return TPromise.wrap<void>(null);
|
return TPromise.wrap<void>(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setViewStateChangeEvents(onRestoreViewStateEvent: Event<void>, onSaveViewStateEvent: Event<void>) {
|
||||||
|
this._restoreViewStateEvent = onRestoreViewStateEvent;
|
||||||
|
this._saveViewStateEvent = onSaveViewStateEvent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the angular components and record for this input that we have done so
|
* Load the angular components and record for this input that we have done so
|
||||||
*/
|
*/
|
||||||
@@ -169,7 +177,11 @@ export class QueryResultsEditor extends BaseEditor {
|
|||||||
// Note: pass in input so on disposal this is cleaned up.
|
// Note: pass in input so on disposal this is cleaned up.
|
||||||
// Otherwise many components will be left around and be subscribed
|
// Otherwise many components will be left around and be subscribed
|
||||||
// to events from the backing data service
|
// to events from the backing data service
|
||||||
let params: IQueryComponentParams = { dataService: dataService };
|
let params: IQueryComponentParams = {
|
||||||
|
dataService: dataService,
|
||||||
|
onSaveViewState: this._saveViewStateEvent,
|
||||||
|
onRestoreViewState: this._restoreViewStateEvent
|
||||||
|
};
|
||||||
bootstrapAngular(this._instantiationService,
|
bootstrapAngular(this._instantiationService,
|
||||||
QueryOutputModule,
|
QueryOutputModule,
|
||||||
this.getContainer(),
|
this.getContainer(),
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
|||||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
|
import { IQueryManagementService } from 'sql/parts/query/common/queryManagement';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action class that query-based Actions will extend. This base class automatically handles activating and
|
* Action class that query-based Actions will extend. This base class automatically handles activating and
|
||||||
@@ -417,6 +418,55 @@ export class ListDatabasesAction extends QueryTaskbarAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action class that parses the query string in the current SQL text document.
|
||||||
|
*/
|
||||||
|
export class ParseSyntaxAction extends QueryTaskbarAction {
|
||||||
|
|
||||||
|
public static EnabledClass = '';
|
||||||
|
public static ID = 'parseQueryAction';
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
editor: QueryEditor,
|
||||||
|
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||||
|
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||||
|
@INotificationService private _notificationService: INotificationService,
|
||||||
|
) {
|
||||||
|
super(connectionManagementService, editor, ParseSyntaxAction.ID, ParseSyntaxAction.EnabledClass);
|
||||||
|
this.enabled = true;
|
||||||
|
this.label = nls.localize('parseSyntaxLabel', 'Parse Query');
|
||||||
|
}
|
||||||
|
|
||||||
|
public run(): TPromise<void> {
|
||||||
|
if (!this.editor.isSelectionEmpty()) {
|
||||||
|
if (this.isConnected(this.editor)) {
|
||||||
|
let text = this.editor.getSelectionText();
|
||||||
|
if (text === '') {
|
||||||
|
text = this.editor.getAllText();
|
||||||
|
}
|
||||||
|
this._queryManagementService.parseSyntax(this.editor.connectedUri, text).then(result => {
|
||||||
|
if (result && result.parseable) {
|
||||||
|
this._notificationService.notify({
|
||||||
|
severity: Severity.Info,
|
||||||
|
message: nls.localize('queryActions.parseSyntaxSuccess', 'Commands completed successfully')
|
||||||
|
});
|
||||||
|
} else if (result && result.errors.length > 0) {
|
||||||
|
let errorMessage = nls.localize('queryActions.parseSyntaxFailure', 'Command failed: ');
|
||||||
|
this._notificationService.error(`${errorMessage}${result.errors[0]}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this._notificationService.notify({
|
||||||
|
severity: Severity.Error,
|
||||||
|
message: nls.localize('queryActions.notConnected', 'Please connect to a server')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TPromise.as(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action item that handles the dropdown (combobox) that lists the available databases.
|
* Action item that handles the dropdown (combobox) that lists the available databases.
|
||||||
* Based off StartDebugActionItem.
|
* Based off StartDebugActionItem.
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { IQueryComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
|||||||
import { QueryComponent } from 'sql/parts/grid/views/query/query.component';
|
import { QueryComponent } from 'sql/parts/grid/views/query/query.component';
|
||||||
import { QueryPlanComponent } from 'sql/parts/queryPlan/queryPlan.component';
|
import { QueryPlanComponent } from 'sql/parts/queryPlan/queryPlan.component';
|
||||||
import { TopOperationsComponent } from 'sql/parts/queryPlan/topOperations.component';
|
import { TopOperationsComponent } from 'sql/parts/queryPlan/topOperations.component';
|
||||||
import { ChartViewerComponent } from 'sql/parts/grid/views/query/chartViewer.component';
|
|
||||||
import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils';
|
import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils';
|
||||||
import { PanelComponent, IPanelOptions } from 'sql/base/browser/ui/panel/panel.component';
|
import { PanelComponent, IPanelOptions } from 'sql/base/browser/ui/panel/panel.component';
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { IBootstrapParams, ISelector, providerIterator } from 'sql/services/boot
|
|||||||
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
||||||
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
||||||
|
import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editabledropdown.component';
|
||||||
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
||||||
|
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
@@ -36,6 +37,7 @@ export const DialogModule = (params, selector: string, instantiationService: IIn
|
|||||||
declarations: [
|
declarations: [
|
||||||
Checkbox,
|
Checkbox,
|
||||||
SelectBox,
|
SelectBox,
|
||||||
|
EditableDropDown,
|
||||||
InputBox,
|
InputBox,
|
||||||
DialogContainer,
|
DialogContainer,
|
||||||
WizardNavigation,
|
WizardNavigation,
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
|||||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { ConnectionContextKey } from 'sql/parts/connection/common/connectionContextKey';
|
import { ConnectionContextKey } from 'sql/parts/connection/common/connectionContextKey';
|
||||||
import { IBootstrapParams } from './bootstrapService';
|
import { IBootstrapParams } from './bootstrapService';
|
||||||
|
import { Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export interface IQueryComponentParams extends IBootstrapParams {
|
export interface IQueryComponentParams extends IBootstrapParams {
|
||||||
dataService: DataService;
|
dataService: DataService;
|
||||||
|
onSaveViewState: Event<void>;
|
||||||
|
onRestoreViewState: Event<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEditDataComponentParams extends IBootstrapParams {
|
export interface IEditDataComponentParams extends IBootstrapParams {
|
||||||
|
|||||||
2
src/sql/sqlops.d.ts
vendored
2
src/sql/sqlops.d.ts
vendored
@@ -777,7 +777,7 @@ declare module 'sqlops' {
|
|||||||
|
|
||||||
export interface SyntaxParseResult {
|
export interface SyntaxParseResult {
|
||||||
parseable: boolean;
|
parseable: boolean;
|
||||||
errorMessages: string[];
|
errors: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query Batch Notification -----------------------------------------------------------------------
|
// Query Batch Notification -----------------------------------------------------------------------
|
||||||
|
|||||||
53
src/sql/sqlops.proposed.d.ts
vendored
53
src/sql/sqlops.proposed.d.ts
vendored
@@ -23,6 +23,7 @@ declare module 'sqlops' {
|
|||||||
checkBox(): ComponentBuilder<CheckBoxComponent>;
|
checkBox(): ComponentBuilder<CheckBoxComponent>;
|
||||||
radioButton(): ComponentBuilder<RadioButtonComponent>;
|
radioButton(): ComponentBuilder<RadioButtonComponent>;
|
||||||
webView(): ComponentBuilder<WebViewComponent>;
|
webView(): ComponentBuilder<WebViewComponent>;
|
||||||
|
editor(): ComponentBuilder<EditorComponent>;
|
||||||
text(): ComponentBuilder<TextComponent>;
|
text(): ComponentBuilder<TextComponent>;
|
||||||
button(): ComponentBuilder<ButtonComponent>;
|
button(): ComponentBuilder<ButtonComponent>;
|
||||||
dropDown(): ComponentBuilder<DropDownComponent>;
|
dropDown(): ComponentBuilder<DropDownComponent>;
|
||||||
@@ -375,6 +376,7 @@ declare module 'sqlops' {
|
|||||||
export interface TableComponentProperties extends ComponentProperties {
|
export interface TableComponentProperties extends ComponentProperties {
|
||||||
data: any[][];
|
data: any[][];
|
||||||
columns: string[] | TableColumn[];
|
columns: string[] | TableColumn[];
|
||||||
|
fontSize?: number | string;
|
||||||
selectedRows?: number[];
|
selectedRows?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +392,8 @@ declare module 'sqlops' {
|
|||||||
export enum DeclarativeDataType {
|
export enum DeclarativeDataType {
|
||||||
string = 'string',
|
string = 'string',
|
||||||
category = 'category',
|
category = 'category',
|
||||||
boolean = 'boolean'
|
boolean = 'boolean',
|
||||||
|
editableCategory = 'editableCategory'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RadioButtonProperties {
|
export interface RadioButtonProperties {
|
||||||
@@ -434,9 +437,24 @@ declare module 'sqlops' {
|
|||||||
html?: string;
|
html?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Editor properties for the editor component
|
||||||
|
*/
|
||||||
|
export interface EditorProperties {
|
||||||
|
/**
|
||||||
|
* The content inside the text editor
|
||||||
|
*/
|
||||||
|
content?: string;
|
||||||
|
/**
|
||||||
|
* The languge mode for this text editor. The language mode is SQL by default.
|
||||||
|
*/
|
||||||
|
languageMode?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface ButtonProperties extends ComponentProperties, ComponentWithIcon {
|
export interface ButtonProperties extends ComponentProperties, ComponentWithIcon {
|
||||||
label?: string;
|
label?: string;
|
||||||
isFile?: boolean;
|
isFile?: boolean;
|
||||||
|
fileContent?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LoadingComponentProperties {
|
export interface LoadingComponentProperties {
|
||||||
@@ -502,7 +520,21 @@ declare module 'sqlops' {
|
|||||||
onMessage: vscode.Event<any>;
|
onMessage: vscode.Event<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ButtonComponent extends Component {
|
/**
|
||||||
|
* Editor component for displaying the text code editor
|
||||||
|
*/
|
||||||
|
export interface EditorComponent extends Component {
|
||||||
|
/**
|
||||||
|
* The content inside the text editor
|
||||||
|
*/
|
||||||
|
content: string;
|
||||||
|
/**
|
||||||
|
* The languge mode for this text editor. The language mode is SQL by default.
|
||||||
|
*/
|
||||||
|
languageMode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ButtonComponent extends Component, ButtonProperties {
|
||||||
label: string;
|
label: string;
|
||||||
iconPath: string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri };
|
iconPath: string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri };
|
||||||
onDidClick: vscode.Event<any>;
|
onDidClick: vscode.Event<any>;
|
||||||
@@ -1078,4 +1110,21 @@ declare module 'sqlops' {
|
|||||||
export function startBackgroundOperation(operationInfo: BackgroundOperationInfo): void;
|
export function startBackgroundOperation(operationInfo: BackgroundOperationInfo): void;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export namespace connection {
|
||||||
|
/**
|
||||||
|
* List the databases that can be accessed from the given connection
|
||||||
|
* @param {string} connectionId The ID of the connection
|
||||||
|
* @returns {string[]} An list of names of databases
|
||||||
|
*/
|
||||||
|
export function listDatabases(connectionId: string): Thenable<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a URI corresponding to the given connection so that it can be used with data
|
||||||
|
* providers and other APIs that require a connection API.
|
||||||
|
* Note: If the given connection corresponds to multiple URIs this may return any of them
|
||||||
|
* @param connectionId The ID of the connection
|
||||||
|
*/
|
||||||
|
export function getUriForConnection(connectionId: string): Thenable<string>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ export enum ModelComponentTypes {
|
|||||||
Group,
|
Group,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
LoadingComponent,
|
LoadingComponent,
|
||||||
FileBrowserTree
|
FileBrowserTree,
|
||||||
|
Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IComponentShape {
|
export interface IComponentShape {
|
||||||
@@ -272,7 +273,8 @@ export enum DataProviderType {
|
|||||||
export enum DeclarativeDataType {
|
export enum DeclarativeDataType {
|
||||||
string = 'string',
|
string = 'string',
|
||||||
category = 'category',
|
category = 'category',
|
||||||
boolean = 'boolean'
|
boolean = 'boolean',
|
||||||
|
editableCategory = 'editableCategory'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CardType {
|
export enum CardType {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { ExtHostConnectionManagementShape, SqlMainContext, MainThreadConnectionM
|
|||||||
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
|
|
||||||
export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape {
|
export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape {
|
||||||
|
|
||||||
private _proxy: MainThreadConnectionManagementShape;
|
private _proxy: MainThreadConnectionManagementShape;
|
||||||
|
|
||||||
@@ -27,7 +27,15 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
|
|||||||
return this._proxy.$getCurrentConnection();
|
return this._proxy.$getCurrentConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string}> {
|
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||||
return this._proxy.$getCredentials(connectionId);
|
return this._proxy.$getCredentials(connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $listDatabases(connectionId: string): Thenable<string[]> {
|
||||||
|
return this._proxy.$listDatabases(connectionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||||
|
return this._proxy.$getUriForConnection(connectionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,13 @@ class ModelBuilderImpl implements sqlops.ModelBuilder {
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor(): sqlops.ComponentBuilder<sqlops.EditorComponent> {
|
||||||
|
let id = this.getNextComponentId();
|
||||||
|
let builder: ComponentBuilderImpl<sqlops.EditorComponent> = this.getComponentBuilder(new EditorWrapper(this._proxy, this._handle, id), id);
|
||||||
|
this._componentBuilders.set(id, builder);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
button(): sqlops.ComponentBuilder<sqlops.ButtonComponent> {
|
button(): sqlops.ComponentBuilder<sqlops.ButtonComponent> {
|
||||||
let id = this.getNextComponentId();
|
let id = this.getNextComponentId();
|
||||||
let builder: ComponentBuilderImpl<sqlops.ButtonComponent> = this.getComponentBuilder(new ButtonWrapper(this._proxy, this._handle, id), id);
|
let builder: ComponentBuilderImpl<sqlops.ButtonComponent> = this.getComponentBuilder(new ButtonWrapper(this._proxy, this._handle, id), id);
|
||||||
@@ -740,6 +747,28 @@ class WebViewWrapper extends ComponentWrapper implements sqlops.WebViewComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EditorWrapper extends ComponentWrapper implements sqlops.EditorComponent {
|
||||||
|
|
||||||
|
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
|
||||||
|
super(proxy, handle, ModelComponentTypes.Editor, id);
|
||||||
|
this.properties = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public get content(): string {
|
||||||
|
return this.properties['content'];
|
||||||
|
}
|
||||||
|
public set content(v: string) {
|
||||||
|
this.setProperty('content', v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get languageMode(): string {
|
||||||
|
return this.properties['languageMode'];
|
||||||
|
}
|
||||||
|
public set languageMode(v: string) {
|
||||||
|
this.setProperty('languageMode', v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class RadioButtonWrapper extends ComponentWrapper implements sqlops.RadioButtonComponent {
|
class RadioButtonWrapper extends ComponentWrapper implements sqlops.RadioButtonComponent {
|
||||||
|
|
||||||
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
|
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
|
||||||
@@ -818,6 +847,14 @@ class TableComponentWrapper extends ComponentWrapper implements sqlops.TableComp
|
|||||||
this.setProperty('columns', v);
|
this.setProperty('columns', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get fontSize(): number | string {
|
||||||
|
return this.properties['fontSize'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public set fontSize(size: number | string) {
|
||||||
|
this.setProperty('fontSize', size);
|
||||||
|
}
|
||||||
|
|
||||||
public get selectedRows(): number[] {
|
public get selectedRows(): number[] {
|
||||||
return this.properties['selectedRows'];
|
return this.properties['selectedRows'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,17 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
|||||||
return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId));
|
return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async $listDatabases(connectionId: string): Promise<string[]> {
|
||||||
|
let connection = this._connectionManagementService.getActiveConnections().find(profile => profile.id === connectionId);
|
||||||
|
let connectionUri = this._connectionManagementService.getConnectionUri(connection);
|
||||||
|
let result = await this._connectionManagementService.listDatabases(connectionUri);
|
||||||
|
return result.databaseNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||||
|
return Promise.resolve(this._connectionManagementService.getConnectionUriFromId(connectionId));
|
||||||
|
}
|
||||||
|
|
||||||
private convertConnection(profile: IConnectionProfile): sqlops.connection.Connection {
|
private convertConnection(profile: IConnectionProfile): sqlops.connection.Connection {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -101,6 +101,12 @@ export function createApiFactory(
|
|||||||
},
|
},
|
||||||
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||||
return extHostConnectionManagement.$getCredentials(connectionId);
|
return extHostConnectionManagement.$getCredentials(connectionId);
|
||||||
|
},
|
||||||
|
listDatabases(connectionId: string): Thenable<string[]> {
|
||||||
|
return extHostConnectionManagement.$listDatabases(connectionId);
|
||||||
|
},
|
||||||
|
getUriForConnection(connectionId: string): Thenable<string> {
|
||||||
|
return extHostConnectionManagement.$getUriForConnection(connectionId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -473,6 +473,8 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
|
|||||||
$getActiveConnections(): Thenable<sqlops.connection.Connection[]>;
|
$getActiveConnections(): Thenable<sqlops.connection.Connection[]>;
|
||||||
$getCurrentConnection(): Thenable<sqlops.connection.Connection>;
|
$getCurrentConnection(): Thenable<sqlops.connection.Connection>;
|
||||||
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
||||||
|
$listDatabases(connectionId: string): Thenable<string[]>;
|
||||||
|
$getUriForConnection(connectionId: string): Thenable<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MainThreadCredentialManagementShape extends IDisposable {
|
export interface MainThreadCredentialManagementShape extends IDisposable {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function GetScriptOperationName(operation: ScriptOperation) {
|
|||||||
|
|
||||||
export function connectIfNotAlreadyConnected(connectionProfile: IConnectionProfile, connectionService: IConnectionManagementService): Promise<void> {
|
export function connectIfNotAlreadyConnected(connectionProfile: IConnectionProfile, connectionService: IConnectionManagementService): Promise<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
let connectionID = connectionService.getConnectionId(connectionProfile);
|
let connectionID = connectionService.getConnectionUri(connectionProfile);
|
||||||
let uri: string = connectionService.getFormattedUri(connectionID, connectionProfile);
|
let uri: string = connectionService.getFormattedUri(connectionID, connectionProfile);
|
||||||
if (!connectionService.isConnected(uri)) {
|
if (!connectionService.isConnected(uri)) {
|
||||||
let options: IConnectionCompletionOptions = {
|
let options: IConnectionCompletionOptions = {
|
||||||
|
|||||||
@@ -756,8 +756,8 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
connect(ownerUri, undefined, false, connectionProfileWithoutDb).then(() => {
|
connect(ownerUri, undefined, false, connectionProfileWithoutDb).then(() => {
|
||||||
try {
|
try {
|
||||||
// If I get the URI for the connection with or without a database from the connection management service
|
// If I get the URI for the connection with or without a database from the connection management service
|
||||||
let actualUriWithDb = connectionManagementService.getConnectionId(connectionProfileWithDb);
|
let actualUriWithDb = connectionManagementService.getConnectionUri(connectionProfileWithDb);
|
||||||
let actualUriWithoutDb = connectionManagementService.getConnectionId(connectionProfileWithoutDb);
|
let actualUriWithoutDb = connectionManagementService.getConnectionUri(connectionProfileWithoutDb);
|
||||||
|
|
||||||
// Then the retrieved URIs should match the one on the connection
|
// Then the retrieved URIs should match the one on the connection
|
||||||
let expectedUri = Utils.generateUri(connectionProfileWithoutDb);
|
let expectedUri = Utils.generateUri(connectionProfileWithoutDb);
|
||||||
@@ -804,4 +804,33 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
let credentials = connectionManagementService.getActiveConnectionCredentials(profile.id);
|
let credentials = connectionManagementService.getActiveConnectionCredentials(profile.id);
|
||||||
assert.equal(credentials['password'], profile.options['password']);
|
assert.equal(credentials['password'], profile.options['password']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getConnectionUriFromId returns a URI of an active connection with the given id', () => {
|
||||||
|
let profile = Object.assign({}, connectionProfile);
|
||||||
|
profile.options = {password: profile.password};
|
||||||
|
profile.id = 'test_id';
|
||||||
|
let uri = 'test_initial_uri';
|
||||||
|
connectionStatusManager.addConnection(profile, uri);
|
||||||
|
(connectionManagementService as any)._connectionStatusManager = connectionStatusManager;
|
||||||
|
|
||||||
|
// If I call getConnectionUriFromId on the given connection
|
||||||
|
let foundUri = connectionManagementService.getConnectionUriFromId(profile.id);
|
||||||
|
|
||||||
|
// Then the returned URI matches the connection's
|
||||||
|
assert.equal(foundUri, Utils.generateUri(new ConnectionProfile(capabilitiesService, profile)));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('getConectionUriFromId returns undefined if the given connection is not active', () => {
|
||||||
|
let profile = Object.assign({}, connectionProfile);
|
||||||
|
profile.options = {password: profile.password};
|
||||||
|
profile.id = 'test_id';
|
||||||
|
connectionStatusManager.addConnection(profile, Utils.generateUri(profile));
|
||||||
|
(connectionManagementService as any)._connectionStatusManager = connectionStatusManager;
|
||||||
|
|
||||||
|
// If I call getConnectionUriFromId with a different URI than the connection's
|
||||||
|
let foundUri = connectionManagementService.getConnectionUriFromId('different_id');
|
||||||
|
|
||||||
|
// Then undefined is returned
|
||||||
|
assert.equal(foundUri, undefined);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -115,7 +115,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionId(connectionProfile: ConnectionProfile): string {
|
getConnectionUri(connectionProfile: ConnectionProfile): string {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +123,10 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConnectionUriFromId(connectionId: string): string {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean {
|
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -568,6 +568,8 @@ export class CodeMenu {
|
|||||||
let cut: Electron.MenuItem;
|
let cut: Electron.MenuItem;
|
||||||
let copy: Electron.MenuItem;
|
let copy: Electron.MenuItem;
|
||||||
let paste: Electron.MenuItem;
|
let paste: Electron.MenuItem;
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
let selectAll: Electron.MenuItem;
|
||||||
|
|
||||||
if (isMacintosh) {
|
if (isMacintosh) {
|
||||||
undo = this.createContextAwareMenuItem(nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), 'undo', {
|
undo = this.createContextAwareMenuItem(nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), 'undo', {
|
||||||
@@ -581,12 +583,19 @@ export class CodeMenu {
|
|||||||
cut = this.createRoleMenuItem(nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"), 'editor.action.clipboardCutAction', 'cut');
|
cut = this.createRoleMenuItem(nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"), 'editor.action.clipboardCutAction', 'cut');
|
||||||
copy = this.createRoleMenuItem(nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"), 'editor.action.clipboardCopyAction', 'copy');
|
copy = this.createRoleMenuItem(nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"), 'editor.action.clipboardCopyAction', 'copy');
|
||||||
paste = this.createRoleMenuItem(nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"), 'editor.action.clipboardPasteAction', 'paste');
|
paste = this.createRoleMenuItem(nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"), 'editor.action.clipboardPasteAction', 'paste');
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
selectAll = this.createContextAwareMenuItem(nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"), 'editor.action.selectAll', {
|
||||||
|
inDevTools: devTools => devTools.selectAll(),
|
||||||
|
inNoWindow: () => Menu.sendActionToFirstResponder('selectAll:')
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
undo = this.createMenuItem(nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), 'undo');
|
undo = this.createMenuItem(nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"), 'undo');
|
||||||
redo = this.createMenuItem(nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"), 'redo');
|
redo = this.createMenuItem(nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"), 'redo');
|
||||||
cut = this.createMenuItem(nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"), 'editor.action.clipboardCutAction');
|
cut = this.createMenuItem(nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, "Cu&&t"), 'editor.action.clipboardCutAction');
|
||||||
copy = this.createMenuItem(nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"), 'editor.action.clipboardCopyAction');
|
copy = this.createMenuItem(nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, "&&Copy"), 'editor.action.clipboardCopyAction');
|
||||||
paste = this.createMenuItem(nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"), 'editor.action.clipboardPasteAction');
|
paste = this.createMenuItem(nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"), 'editor.action.clipboardPasteAction');
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
selectAll = this.createMenuItem(nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"), 'editor.action.selectAll');
|
||||||
}
|
}
|
||||||
|
|
||||||
const find = this.createMenuItem(nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"), 'actions.find');
|
const find = this.createMenuItem(nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"), 'actions.find');
|
||||||
@@ -614,6 +623,8 @@ export class CodeMenu {
|
|||||||
findInFiles,
|
findInFiles,
|
||||||
replaceInFiles,
|
replaceInFiles,
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
|
selectAll,
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
// __separator__(),
|
// __separator__(),
|
||||||
// toggleLineComment,
|
// toggleLineComment,
|
||||||
// toggleBlockComment,
|
// toggleBlockComment,
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
import { IWordAtPosition } from 'vs/editor/common/model';
|
import { IWordAtPosition } from 'vs/editor/common/model';
|
||||||
|
|
||||||
export const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?';
|
// {{SQL CARBON EDIT}}
|
||||||
|
export const USUAL_WORD_SEPARATORS = '`~!#$%^&*()-=+[{]}\\|;:\'",.<>/?';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a word definition regular expression based on default word separators.
|
* Create a word definition regular expression based on default word separators.
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ export interface IProductConfiguration {
|
|||||||
releaseNotesUrl: string;
|
releaseNotesUrl: string;
|
||||||
// {SQL CARBON EDIT}
|
// {SQL CARBON EDIT}
|
||||||
gettingStartedUrl: string;
|
gettingStartedUrl: string;
|
||||||
|
// {SQL CARBON EDIT}
|
||||||
|
vscodeVersion: string;
|
||||||
keyboardShortcutsUrlMac: string;
|
keyboardShortcutsUrlMac: string;
|
||||||
keyboardShortcutsUrlLinux: string;
|
keyboardShortcutsUrlLinux: string;
|
||||||
keyboardShortcutsUrlWin: string;
|
keyboardShortcutsUrlWin: string;
|
||||||
|
|||||||
@@ -458,15 +458,17 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
|||||||
this.logService.trace('windowsService#openAboutDialog');
|
this.logService.trace('windowsService#openAboutDialog');
|
||||||
const lastActiveWindow = this.windowsMainService.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
|
const lastActiveWindow = this.windowsMainService.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
const detail = nls.localize('aboutDetail',
|
const detail = nls.localize('aboutDetail',
|
||||||
"Version {0}\nCommit {1}\nDate {2}\nShell {3}\nRenderer {4}\nNode {5}\nArchitecture {6}",
|
"Version {0}\nCommit {1}\nDate {2}\nVS Code {7}\nShell {3}\nRenderer {4}\nNode {5}\nArchitecture {6}",
|
||||||
app.getVersion(),
|
app.getVersion(),
|
||||||
product.commit || 'Unknown',
|
product.commit || 'Unknown',
|
||||||
product.date || 'Unknown',
|
product.date || 'Unknown',
|
||||||
process.versions['electron'],
|
process.versions['electron'],
|
||||||
process.versions['chrome'],
|
process.versions['chrome'],
|
||||||
process.versions['node'],
|
process.versions['node'],
|
||||||
process.arch
|
process.arch,
|
||||||
|
product.vscodeVersion
|
||||||
);
|
);
|
||||||
|
|
||||||
const buttons = [nls.localize('okButton', "OK")];
|
const buttons = [nls.localize('okButton', "OK")];
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ interface WatermarkEntry {
|
|||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const showServers: WatermarkEntry = {
|
const showServers: WatermarkEntry = {
|
||||||
text: 'Show Servers',
|
text: nls.localize('watermark.showServers', 'Show Servers'),
|
||||||
ids: [OpenConnectionsViewletAction.ID]
|
ids: [OpenConnectionsViewletAction.ID]
|
||||||
};
|
};
|
||||||
|
|
||||||
const newSqlFile: WatermarkEntry = {
|
const newSqlFile: WatermarkEntry = {
|
||||||
text: 'New SQL File',
|
text: nls.localize('watermark.newSqlFile', 'New SQL File'),
|
||||||
ids: [GlobalNewUntitledFileAction.ID]
|
ids: [GlobalNewUntitledFileAction.ID]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
52
yarn.lock
52
yarn.lock
@@ -124,9 +124,11 @@ acorn@^5.2.1:
|
|||||||
version "5.2.1"
|
version "5.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7"
|
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7"
|
||||||
|
|
||||||
agent-base@~1.0.1:
|
agent-base@4, agent-base@^4.1.0:
|
||||||
version "1.0.2"
|
version "4.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-1.0.2.tgz#6890d3fb217004b62b70f8928e0fae5f8952a706"
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
||||||
|
dependencies:
|
||||||
|
es6-promisify "^5.0.0"
|
||||||
|
|
||||||
ajv-keywords@^1.0.0:
|
ajv-keywords@^1.0.0:
|
||||||
version "1.5.1"
|
version "1.5.1"
|
||||||
@@ -1300,7 +1302,7 @@ debug-fabulous@0.0.X:
|
|||||||
lazy-debug-legacy "0.0.X"
|
lazy-debug-legacy "0.0.X"
|
||||||
object-assign "4.1.0"
|
object-assign "4.1.0"
|
||||||
|
|
||||||
debug@2, debug@2.2.0, debug@~2.2.0:
|
debug@2.2.0, debug@~2.2.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1312,6 +1314,12 @@ debug@2.6.9, debug@2.X, debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3:
|
|||||||
dependencies:
|
dependencies:
|
||||||
ms "2.0.0"
|
ms "2.0.0"
|
||||||
|
|
||||||
|
debug@3.1.0, debug@^3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||||
|
dependencies:
|
||||||
|
ms "2.0.0"
|
||||||
|
|
||||||
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
@@ -1630,6 +1638,16 @@ es6-map@^0.1.3:
|
|||||||
es6-symbol "~3.1.1"
|
es6-symbol "~3.1.1"
|
||||||
event-emitter "~0.3.5"
|
event-emitter "~0.3.5"
|
||||||
|
|
||||||
|
es6-promise@^4.0.3:
|
||||||
|
version "4.2.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29"
|
||||||
|
|
||||||
|
es6-promisify@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||||
|
dependencies:
|
||||||
|
es6-promise "^4.0.3"
|
||||||
|
|
||||||
es6-set@~0.1.5:
|
es6-set@~0.1.5:
|
||||||
version "0.1.5"
|
version "0.1.5"
|
||||||
resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
|
resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
|
||||||
@@ -1916,10 +1934,6 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2:
|
|||||||
assign-symbols "^1.0.0"
|
assign-symbols "^1.0.0"
|
||||||
is-extendable "^1.0.1"
|
is-extendable "^1.0.1"
|
||||||
|
|
||||||
extend@3:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
|
|
||||||
|
|
||||||
extend@^3.0.0, extend@~3.0.0, extend@~3.0.1:
|
extend@^3.0.0, extend@~3.0.0, extend@~3.0.1:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
|
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
|
||||||
@@ -3057,13 +3071,12 @@ http-errors@1.6.2, http-errors@~1.6.2:
|
|||||||
setprototypeof "1.0.3"
|
setprototypeof "1.0.3"
|
||||||
statuses ">= 1.3.1 < 2"
|
statuses ">= 1.3.1 < 2"
|
||||||
|
|
||||||
http-proxy-agent@0.2.7:
|
http-proxy-agent@^2.1.0:
|
||||||
version "0.2.7"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-0.2.7.tgz#e17fda65f0902d952ce7921e62c7ff8862655a5e"
|
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base "~1.0.1"
|
agent-base "4"
|
||||||
debug "2"
|
debug "3.1.0"
|
||||||
extend "3"
|
|
||||||
|
|
||||||
http-signature@~0.10.0:
|
http-signature@~0.10.0:
|
||||||
version "0.10.1"
|
version "0.10.1"
|
||||||
@@ -3089,13 +3102,12 @@ http-signature@~1.2.0:
|
|||||||
jsprim "^1.2.2"
|
jsprim "^1.2.2"
|
||||||
sshpk "^1.7.0"
|
sshpk "^1.7.0"
|
||||||
|
|
||||||
https-proxy-agent@0.3.6:
|
https-proxy-agent@^2.2.1:
|
||||||
version "0.3.6"
|
version "2.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-0.3.6.tgz#713fa38e5d353f50eb14a342febe29033ed1619b"
|
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0"
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base "~1.0.1"
|
agent-base "^4.1.0"
|
||||||
debug "2"
|
debug "^3.1.0"
|
||||||
extend "3"
|
|
||||||
|
|
||||||
husky@^0.13.1:
|
husky@^0.13.1:
|
||||||
version "0.13.4"
|
version "0.13.4"
|
||||||
|
|||||||
Reference in New Issue
Block a user