Compare commits

..

37 Commits
1.2.3 ... 1.3.1

Author SHA1 Message Date
Alan Ren
bd53e685d0 bump to .53 (#3187) 2018-11-09 10:57:30 -08:00
Alan Ren
410bb62906 fix for stop session error and session selection lost issue (#3167)
* fix for stop session error and session selection lost issue

* remove the console.error call
2018-11-08 16:51:39 -08:00
Alan Ren
cbb4ac3e20 make it preserve the line breaks (#3176) 2018-11-08 16:34:27 -08:00
Alan Ren
61746b7ff7 Update UX-Design-Guidelines.md 2018-11-08 10:37:45 -08:00
Alan Ren
e6066c2cb5 Rename UX-Design-Guidelines to UX-Design-Guidelines.md 2018-11-08 10:29:43 -08:00
Alan Ren
633a918590 Create UX-Design-Guidelines 2018-11-08 10:29:16 -08:00
Alan Ren
9bbed2c275 fix for issue 3157 (#3158)
* fix for issue 3157

* use state instead of _state
2018-11-07 12:00:51 -08:00
Alan Ren
d9ba4d9130 profiler improvements (#3151)
* profiler improvements

* fix for issue 3114
2018-11-07 11:25:24 -08:00
Olivier Truong
e2bd6c06ec typo (#3025)
without instead of wihtout
2018-11-06 11:22:27 -08:00
Karl Burtram
a26be76d79 Update readme for Nov release (#3138) 2018-11-06 11:21:40 -08:00
Danny McCormick
3b68c1eb69 Add Azure Pipelines (#3140)
* Adding ci files

* Single pipeline

* Add test reporting

* Try adding mocha-junit-reporter

* More complete test reporting

* Cleaning up

* Trying to find location of test file

* Added searching logic to wrong file

* Trying different method of getting test results

* Add reporter option

* Adding alternate way of getting mac os

* Get rid of bad comments
2018-11-06 11:21:26 -08:00
Alan Ren
f7879bdbf9 Alanren/custom message box location (#3139)
* make message box associated with wizard page

* missed one condition check after renaming

* fix compilation error
2018-11-06 10:44:02 -08:00
Karl Burtram
dbb0fc519f Update Azure Data Studio to 1.3.1 2018-11-06 10:40:58 -08:00
Alan Ren
b931ccfabf fix for 1705 (#3131) 2018-11-06 10:34:58 -08:00
Matt Irvine
eeab048f46 Use correct foreground color for copy details button (#3126) 2018-11-06 10:14:25 -08:00
Anthony Dresser
e2b446be1c change default setting for showing default connection info in settings (#3043) 2018-11-05 16:08:55 -08:00
Anthony Dresser
5f2e17a738 Query Editor Memory improvements (#3041)
* working through memory issues

* work in progress

* add missing value

* work in progress

* more work in progress

* various more memory fixes

* additional improvements

* fix imports

* change test that we dispose queries on close not dispose

* update tests
2018-11-05 16:08:41 -08:00
Aditya Bist
399d6d0045 fixed operator typo (#3113) 2018-11-05 10:19:50 -08:00
Alan Ren
f36f3ffd21 connect dialog ux improvement (#3105)
* connect dialog ux improvement

* more style updates
2018-11-04 17:10:05 -08:00
Kevin Cunnane
00cd772cbc Snippets: fix sqlCreateTable, remove database refs & use dbo schema (#3094)
- Fixed issues with sqlCreateTable snippet, which meant it couldn't effectively be used to tab through all fields and then hit execute without errors. Specifically fixed bugs where types like NVARCHAR were incorrectly escaped and the Id part of a column was outside the name section, both causing intellisense & execution breaks
- Changed SchemaName to dbo. This helps hit the "80% case" where objects are in the most common schema
- Removed DatabaseName from most snippets. The core issue is this requires you to manually type the exact database name into the snippet which is really hard. We should consider having separate "with Database" snippets or support SQLCMD variables which would let us default to the current database without needing users to manually type them in as alternatives, but having basic snippets just work on current DB is important.
2018-11-02 14:26:03 -07:00
Karl Burtram
b6c9a3bb89 Bump Azure Data Studio to 1.2.4 2018-11-01 15:06:58 -07:00
Karl Burtram
cbf6c06e4b Bump SQL Tools to 1.5.0-alpha.52 2018-10-31 20:37:47 -07:00
Anthony Dresser
cff21124da Auto Scale Axis (#3070)
* fix input to chart that was causes scales to not auto size

* formatting

* formatting

* added comments
2018-10-31 20:27:40 -07:00
Aditya Bist
ce7893c2e5 Agent/edit job logic (#3023)
* lumped stepdata with jobdata in job dialog

* fix bug with empty steps

* added clumped and update steps and schedules from job dialog

* edit data sends one call instead of multiple

* cleaned code
2018-10-31 16:40:36 -07:00
Alan Ren
f7dcaa38ff fix for issue 3065 (#3067)
* fix for 3065

* remove the parameter, no need to save connection
2018-10-31 16:13:09 -07:00
Karl Burtram
8ce1013a26 Remove SQL Import dashboard tab (#3064) 2018-10-31 15:23:24 -07:00
Aditya Bist
114d67b408 fixed null ref (#3061) 2018-10-31 13:50:44 -07:00
Alan Ren
56c2d16560 a few ux improvements (#3057)
* style update

* checkbox styler

* casing update
2018-10-31 13:44:12 -07:00
Alan Ren
2238c42432 fix for issue 2719 (#3060) 2018-10-31 13:22:08 -07:00
Karl Burtram
64f6cf6747 Bump SQL Tools to 1.5.0-alpha.51 2018-10-31 13:16:38 -07:00
Karl Burtram
c0e9f1ca43 Fix build break in previous Query Plan commit 2018-10-31 13:00:23 -07:00
David Shiflet
7f66087d8c Add a command line interface for connecting to a SQL Server (#3047)
* Add switches for server, database, user, integrated auth

* Refactor into new commandline service

* Open query editor when passed server on command line

* Add tests
2018-10-31 13:05:37 -04:00
Ryan
18671b7cca Add query plan theme support (#2991) (#3031)
Add monaco-editor and monaco-editor-hover to output otherwise backgrounds collide.
2018-10-31 10:03:02 -07:00
Alan Ren
233156c744 fix missing footer for backup dialog (#3056)
@MattIrv  Thanks for helping out
2018-10-30 16:17:14 -07:00
Ruturaj Gujar
5e964d2105 Fixed some typos and grammatical errors (#3027) 2018-10-30 11:54:48 -07:00
Karl Burtram
59e7a5fa4b Change 'None' to 'Do not save' in Connection Dialog (#3051) 2018-10-30 10:45:47 -07:00
Karl Burtram
8452f577d2 Bump Azure Data Studio to 1.2.3 2018-10-30 10:27:03 -07:00
81 changed files with 890 additions and 445 deletions

View File

@@ -1,5 +1,28 @@
# Change Log # Change Log
## Version 1.2.4
* Release date: November 6, 2018
* Release status: General Availability
## What's new in this version
* Update to the SQL Server 2019 Preview extension
* Introducing Paste the Plan extension
* Introducing High Color queries extension, including SSMS editor theme
* Fixes in SQL Server Agent, Profiler, and Import extensions
* Fix .Net Core Socket KeepAlive issue causing dropped inactive connections on macOS
* Upgrade SQL Tools Service to .Net Core 2.2 Preview 3 (for eventual AAD support)
* Fix customer reported GitHub issues
## Contributions and "thank you"
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
* rdaniels6813 for `Add query plan theme support #3031`
* Ruturaj123 for `Fixed some typos and grammatical errors #3027`
* PromoFaux for `Use emoji shortcodes in CONTRIBUTING.md instead of <20> #3009`
* ckaczor for `Fix: DATETIMEOFFSET data types should be ISO formatted #714`
* hi-im-T0dd for `Fixed sync issue with my forked master so this commit is correct #2948`
* hi-im-T0dd for `Fixed when right clicking and selecting Manage-correct name displays #2794`
## Version 1.1.3 ## Version 1.1.3
* Release date: October 18, 2018 * Release date: October 18, 2018
* Release status: General Availability * Release status: General Availability

View File

@@ -8,12 +8,12 @@ Azure Data Studio is a data management tool that enables you to work with SQL Se
Platform | Link Platform | Link
-- | -- -- | --
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=2030731 Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=2038320
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=2030736 Windows ZIP | https://go.microsoft.com/fwlink/?linkid=2038323
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=2030738 macOS ZIP | https://go.microsoft.com/fwlink/?linkid=2038327
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=2030741 Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=2038332
Linux RPM | https://go.microsoft.com/fwlink/?linkid=2030746 Linux RPM | https://go.microsoft.com/fwlink/?linkid=2038401
Linux DEB | https://go.microsoft.com/fwlink/?linkid=2030750 Linux DEB | https://go.microsoft.com/fwlink/?linkid=2038405
Go to our [download page](https://aka.ms/azuredatastudio) for more specific instructions. Go to our [download page](https://aka.ms/azuredatastudio) for more specific instructions.
@@ -61,6 +61,12 @@ The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.micro
## Contributions and "Thank You" ## Contributions and "Thank You"
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes: We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
* rdaniels6813 for `Add query plan theme support #3031`
* Ruturaj123 for `Fixed some typos and grammatical errors #3027`
* PromoFaux for `Use emoji shortcodes in CONTRIBUTING.md instead of <20> #3009`
* ckaczor for `Fix: DATETIMEOFFSET data types should be ISO formatted #714`
* hi-im-T0dd for `Fixed sync issue with my forked master so this commit is correct #2948`
* hi-im-T0dd for `Fixed when right clicking and selecting Manage-correct name displays #2794`
* philoushka for `center the icon #2760` * philoushka for `center the icon #2760`
* anthonypants for `Typo #2775` * anthonypants for `Typo #2775`
* kstolte for `Fix Invalid Configuration in Launch.json #2789` * kstolte for `Fix Invalid Configuration in Launch.json #2789`
@@ -103,7 +109,6 @@ We would like to thank all our users who raised issues, and in particular the fo
* Russian: Andrey Veselov, Anton Fontanov, Anton Savin, Elena Ostrovskaia, Igor Babichev, Maxim Zelensky, Rodion Fedechkin, Tasha T, Vladimir Zyryanov * Russian: Andrey Veselov, Anton Fontanov, Anton Savin, Elena Ostrovskaia, Igor Babichev, Maxim Zelensky, Rodion Fedechkin, Tasha T, Vladimir Zyryanov
* Portuguese Brazil: Daniel de Sousa, Diogo Duarte, Douglas Correa, Douglas Eccker, José Emanuel Mendes, Marcelo Fernandes, Marcondes Alexandre, Roberto Fonseca, Rodrigo Crespi * Portuguese Brazil: Daniel de Sousa, Diogo Duarte, Douglas Correa, Douglas Eccker, José Emanuel Mendes, Marcelo Fernandes, Marcondes Alexandre, Roberto Fonseca, Rodrigo Crespi
And of course, we'd like to thank the authors of all upstream dependencies. Please see a full list in the [ThirdPartyNotices.txt](https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/ThirdPartyNotices.txt) And of course, we'd like to thank the authors of all upstream dependencies. Please see a full list in the [ThirdPartyNotices.txt](https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/ThirdPartyNotices.txt)
## License ## License

View File

@@ -0,0 +1,38 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: '8.x'
displayName: 'Install Node.js'
- script: |
git submodule update --init --recursive
nvm install 8.9.1
nvm use 8.9.1
npm i -g yarn
displayName: 'preinstall'
- script: |
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
sleep 3
displayName: 'Linux preinstall'
condition: eq(variables['Agent.OS'], 'Linux')
- script: |
yarn
displayName: 'Install'
- script: |
node_modules/.bin/gulp electron --silent
node_modules/.bin/gulp compile --silent --max_old_space_size=4096
node_modules/.bin/gulp optimize-vscode --silent --max_old_space_size=4096
displayName: 'Scripts'
- script: |
./scripts/test.sh --reporter mocha-junit-reporter
displayName: 'Tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
condition: succeededOrFailed()

View File

@@ -0,0 +1,27 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: '8.9'
displayName: 'Install Node.js'
- script: |
yarn
displayName: 'Yarn Install'
- script: |
.\node_modules\.bin\gulp electron
displayName: 'Electron'
- script: |
npm run compile
displayName: 'Compile'
- script: |
.\scripts\test.bat
.\scripts\test-integration.bat
displayName: 'Test'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
condition: succeededOrFailed()

29
azure-pipelines.yml Normal file
View File

@@ -0,0 +1,29 @@
trigger:
- master
- releases/*
jobs:
# All tasks on Windows
- job: build_all_windows
displayName: Build all tasks (Windows)
pool:
vmImage: vs2017-win2016
steps:
- template: azure-pipelines-windows.yml
# All tasks on Linux
- job: build_all_linux
displayName: Build all tasks (Linux)
pool:
vmImage: 'Ubuntu 16.04'
steps:
- template: azure-pipelines-linux-mac.yml
# All tasks on macOS
- job: build_all_darwin
displayName: Build all tasks (macOS)
pool:
vmImage: macos-10.13
steps:
- template: azure-pipelines-linux-mac.yml

View File

@@ -0,0 +1 @@

View File

@@ -2,7 +2,7 @@
"name": "agent", "name": "agent",
"displayName": "SQL Server Agent", "displayName": "SQL Server Agent",
"description": "Manage and troubleshoot SQL Server Agent jobs", "description": "Manage and troubleshoot SQL Server Agent jobs",
"version": "0.34.0", "version": "0.35.0",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt", "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt",

View File

@@ -35,7 +35,7 @@ export class OperatorDialog extends AgentDialog<OperatorData> {
private static readonly PagerSundayCheckBoxLabel: string = localize('createOperator.PagerSundayCheckBox', 'Sunday'); private static readonly PagerSundayCheckBoxLabel: string = localize('createOperator.PagerSundayCheckBox', 'Sunday');
private static readonly WorkdayBeginLabel: string = localize('createOperator.workdayBegin', 'Workday begin'); private static readonly WorkdayBeginLabel: string = localize('createOperator.workdayBegin', 'Workday begin');
private static readonly WorkdayEndLabel: string = localize('createOperator.workdayEnd', 'Workday end'); private static readonly WorkdayEndLabel: string = localize('createOperator.workdayEnd', 'Workday end');
private static readonly PagerDutyScheduleLabel: string = localize('createOperator.PagerDutySchedule', 'Pager on duty schdule'); private static readonly PagerDutyScheduleLabel: string = localize('createOperator.PagerDutySchedule', 'Pager on duty schedule');
// Notifications tab strings // Notifications tab strings
private static readonly AlertsTableLabel: string = localize('createOperator.AlertListHeading', 'Alert list'); private static readonly AlertsTableLabel: string = localize('createOperator.AlertListHeading', 'Alert list');

View File

@@ -2,7 +2,7 @@
"name": "import", "name": "import",
"displayName": "SQL Server Import", "displayName": "SQL Server Import",
"description": "SQL Server Import for Azure Data Studio supports importing CSV or JSON files into SQL Server.", "description": "SQL Server Import for Azure Data Studio supports importing CSV or JSON files into SQL Server.",
"version": "0.3.0", "version": "0.4.0",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"engines": { "engines": {

View File

@@ -345,7 +345,7 @@
"specialValueType": null, "specialValueType": null,
"isIdentity": false, "isIdentity": false,
"name": "asynchronousProcessing", "name": "asynchronousProcessing",
"displayName": "Asynchronous processing enabled", "displayName": "Asynchronous processing",
"description": "When true, enables usage of the Asynchronous functionality in the .Net Framework Data Provider", "description": "When true, enables usage of the Asynchronous functionality in the .Net Framework Data Provider",
"groupName": "Initialization", "groupName": "Initialization",
"valueType": "boolean", "valueType": "boolean",
@@ -387,7 +387,7 @@
"specialValueType": null, "specialValueType": null,
"isIdentity": false, "isIdentity": false,
"name": "columnEncryptionSetting", "name": "columnEncryptionSetting",
"displayName": "Column encryption setting", "displayName": "Column encryption",
"description": "Default column encryption setting for all the commands on the connection", "description": "Default column encryption setting for all the commands on the connection",
"groupName": "Security", "groupName": "Security",
"valueType": "category", "valueType": "category",

View File

@@ -42,18 +42,18 @@
"Create a new Table": { "Create a new Table": {
"prefix": "sqlCreateTable", "prefix": "sqlCreateTable",
"body": [ "body": [
"-- Create a new table called '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'", "-- Create a new table called '[${1:TableName}]' in schema '[${2:dbo}]'",
"-- Drop the table if it already exists", "-- Drop the table if it already exists",
"IF OBJECT_ID('[${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]', 'U') IS NOT NULL", "IF OBJECT_ID('[${2:dbo}].[${1:TableName}]', 'U') IS NOT NULL",
"DROP TABLE [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]", "DROP TABLE [${2:dbo}].[${1:TableName}]",
"GO", "GO",
"-- Create the table in the specified database and schema", "-- Create the table in the specified schema",
"CREATE TABLE [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]", "CREATE TABLE [${2:dbo}].[${1:TableName}]",
"(", "(",
"\t[${4:ColumnName}]Id INT NOT NULL PRIMARY KEY, -- Primary Key column", "\t[${3:Id}] INT NOT NULL PRIMARY KEY, -- Primary Key column",
"\t[${5:ColumnName1}] [NVARCHAR](50) NOT NULL,", "\t[${4:ColumnName2}] ${5:NVARCHAR(50)} NOT NULL,",
"\t[${6:ColumnName2}] [NVARCHAR](50) NOT NULL", "\t[${6:ColumnName3}] ${7:NVARCHAR(50)} NOT NULL",
"\t-- Specify more columns here", "\t$0-- Specify more columns here",
");", ");",
"GO" "GO"
], ],
@@ -64,10 +64,10 @@
"Drop a Table": { "Drop a Table": {
"prefix": "sqlDropTable", "prefix": "sqlDropTable",
"body": [ "body": [
"-- Drop a table called '${3:TableName}' in schema '${2:SchemaName}' in Database '${1:DatabaseName}'", "-- Drop a table called '${1:TableName}' in schema '${2:dbo}'",
"-- Drop the table if it already exists", "-- Drop the table if it already exists",
"IF OBJECT_ID('[${1:DatabaseName}].[${2:SchemaName}].[${3:TableName}]', 'U') IS NOT NULL", "IF OBJECT_ID('[${2:dbo}].[${1:TableName}]', 'U') IS NOT NULL",
"DROP TABLE [${1:DatabaseName}].[${2:SchemaName}].[${3:TableName}]", "DROP TABLE [${2:dbo}].[${1:TableName}]",
"GO" "GO"
], ],
"description": "Drop a Table" "description": "Drop a Table"
@@ -76,9 +76,9 @@
"Add a new column to a Table": { "Add a new column to a Table": {
"prefix": "sqlAddColumn", "prefix": "sqlAddColumn",
"body": [ "body": [
"-- Add a new column '[${1:NewColumnName}]' to table '[${2:TableName}]' in schema '[${3:SchemaName}]' in database '[${4:DatabaseName}]'", "-- Add a new column '[${1:NewColumnName}]' to table '[${2:TableName}]' in schema '[${3:dbo}]'",
"ALTER TABLE [${4:DatabaseName}].[${3:SchemaName}].[${2:TableName}]", "ALTER TABLE [${3:dbo}].[${2:TableName}]",
"\tADD [${1:NewColumnName}] /*new_column_name*/ ${5:int} /*new_column_datatype*/ ${6:NULL} /*new_column_nullability*/", "\tADD [${1:NewColumnName}] /*new_column_name*/ ${4:int} /*new_column_datatype*/ ${5:NULL} /*new_column_nullability*/",
"GO" "GO"
], ],
"description": "Add a new column to a Table" "description": "Add a new column to a Table"
@@ -87,8 +87,8 @@
"Drop a column from a Table": { "Drop a column from a Table": {
"prefix": "sqlDropColumn", "prefix": "sqlDropColumn",
"body": [ "body": [
"-- Drop '[${1:ColumnName}]' from table '[${2:TableName}]' in schema '[${3:SchemaName}]' in database '[${4:DatabaseName}]'", "-- Drop '[${1:ColumnName}]' from table '[${2:TableName}]' in schema '[${3:dbo}]'",
"ALTER TABLE [${4:DatabaseName}].[${3:SchemaName}].[${2:TableName}]", "ALTER TABLE [${3:dbo}].[${2:TableName}]",
"\tDROP COLUMN [${1:ColumnName}]", "\tDROP COLUMN [${1:ColumnName}]",
"GO" "GO"
], ],
@@ -98,9 +98,9 @@
"Select rows from a Table or a View": { "Select rows from a Table or a View": {
"prefix": "sqlSelect", "prefix": "sqlSelect",
"body": [ "body": [
"-- Select rows from a Table or View '[${1:TableOrViewName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'", "-- Select rows from a Table or View '[${1:TableOrViewName}]' in schema '[${2:dbo}]'",
"SELECT * FROM [${3:DatabaseName}].[${2:SchemaName}].[${1:TableOrViewName}]", "SELECT * FROM [${2:dbo}].[${1:TableOrViewName}]",
"WHERE ${4:/* add search conditions here */}", "WHERE ${3:/* add search conditions here */}",
"GO" "GO"
], ],
"description": "Select rows from a Table or a View" "description": "Select rows from a Table or a View"
@@ -109,17 +109,17 @@
"Insert rows into a Table": { "Insert rows into a Table": {
"prefix": "sqlInsertRows", "prefix": "sqlInsertRows",
"body": [ "body": [
"-- Insert rows into table '${1:TableName}' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'", "-- Insert rows into table '${1:TableName}' in schema '[${2:dbo}]'",
"INSERT INTO [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]", "INSERT INTO [${2:dbo}].[${1:TableName}]",
"( -- Columns to insert data into", "( -- Columns to insert data into",
" ${4:[ColumnName1], [ColumnName2], [ColumnName3]}", " ${3:[ColumnName1], [ColumnName2], [ColumnName3]}",
")", ")",
"VALUES", "VALUES",
"( -- First row: values for the columns in the list above", "( -- First row: values for the columns in the list above",
" ${5:ColumnValue1, ColumnValue2, ColumnValue3}", " ${4:ColumnValue1, ColumnValue2, ColumnValue3}",
"),", "),",
"( -- Second row: values for the columns in the list above", "( -- Second row: values for the columns in the list above",
" ${6:ColumnValue1, ColumnValue2, ColumnValue3}", " ${5:ColumnValue1, ColumnValue2, ColumnValue3}",
")", ")",
"-- Add more rows here", "-- Add more rows here",
"GO" "GO"
@@ -130,9 +130,9 @@
"Delete rows from a Table": { "Delete rows from a Table": {
"prefix": "sqlDeleteRows", "prefix": "sqlDeleteRows",
"body": [ "body": [
"-- Delete rows from table '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'", "-- Delete rows from table '[${1:TableName}]' in schema '[${2:dbo}]'",
"DELETE FROM [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]", "DELETE FROM [${2:dbo}].[${1:TableName}]",
"WHERE ${4:/* add search conditions here */}", "WHERE ${3:/* add search conditions here */}",
"GO" "GO"
], ],
"description": "Delete rows from a Table" "description": "Delete rows from a Table"
@@ -141,13 +141,13 @@
"Update rows in a Table": { "Update rows in a Table": {
"prefix": "sqlUpdateRows", "prefix": "sqlUpdateRows",
"body": [ "body": [
"-- Update rows in table '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'", "-- Update rows in table '[${1:TableName}]' in schema '[${2:dbo}]'",
"UPDATE [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]", "UPDATE [${2:dbo}].[${1:TableName}]",
"SET", "SET",
"\t[${4:ColumnName1}] = ${5:ColumnValue1},", "\t[${3:ColumnName1}] = ${4:ColumnValue1},",
"\t[${6:ColumnName2}] = ${7:ColumnValue2}", "\t[${5:ColumnName2}] = ${6:ColumnValue2}",
"\t-- Add more columns and values here", "\t-- Add more columns and values here",
"WHERE ${8:/* add search conditions here */}", "WHERE ${7:/* add search conditions here */}",
"GO" "GO"
], ],
"description": "Update rows in a Table" "description": "Update rows in a Table"
@@ -156,27 +156,27 @@
"Create a stored procedure": { "Create a stored procedure": {
"prefix": "sqlCreateStoredProc", "prefix": "sqlCreateStoredProc",
"body": [ "body": [
"-- Create a new stored procedure called '${1:StoredProcedureName}' in schema '${2:SchemaName}'", "-- Create a new stored procedure called '${1:StoredProcedureName}' in schema '${2:dbo}'",
"-- Drop the stored procedure if it already exists", "-- Drop the stored procedure if it already exists",
"IF EXISTS (", "IF EXISTS (",
"SELECT *", "SELECT *",
"\tFROM INFORMATION_SCHEMA.ROUTINES", "\tFROM INFORMATION_SCHEMA.ROUTINES",
"WHERE SPECIFIC_SCHEMA = N'${2:SchemaName}'", "WHERE SPECIFIC_SCHEMA = N'${2:dbo}'",
"\tAND SPECIFIC_NAME = N'${1:StoredProcedureName}'", "\tAND SPECIFIC_NAME = N'${1:StoredProcedureName}'",
")", ")",
"DROP PROCEDURE ${2:SchemaName}.${1:StoredProcedureName}", "DROP PROCEDURE ${2:dbo}.${1:StoredProcedureName}",
"GO", "GO",
"-- Create the stored procedure in the specified schema", "-- Create the stored procedure in the specified schema",
"CREATE PROCEDURE ${2:SchemaName}.${1:StoredProcedureName}", "CREATE PROCEDURE ${2:dbo}.${1:StoredProcedureName}",
"\t$3@param1 /*parameter name*/ int /*datatype_for_param1*/ = 0, /*default_value_for_param1*/", "\t$3@param1 /*parameter name*/ $4int /*datatype_for_param1*/ = 0, /*default_value_for_param1*/",
"\t$4@param2 /*parameter name*/ int /*datatype_for_param1*/ = 0 /*default_value_for_param2*/", "\t$5@param2 /*parameter name*/ $6int /*datatype_for_param1*/ = 0 /*default_value_for_param2*/",
"-- add more stored procedure parameters here", "-- add more stored procedure parameters here",
"AS", "AS",
"\t-- body of the stored procedure", "\t-- body of the stored procedure",
"\tSELECT @param1, @param2", "\tSELECT @param1, @param2",
"GO", "GO",
"-- example to execute the stored procedure we just created", "-- example to execute the stored procedure we just created",
"EXECUTE ${2:SchemaName}.${1:StoredProcedureName} 1 /*value_for_param1*/, 2 /*value_for_param2*/", "EXECUTE ${2:dbo}.${1:StoredProcedureName} 1 /*value_for_param1*/, 2 /*value_for_param2*/",
"GO" "GO"
], ],
"description": "Create a stored procedure" "description": "Create a stored procedure"
@@ -185,14 +185,14 @@
"Drop a stored procedure": { "Drop a stored procedure": {
"prefix": "sqlDropStoredProc", "prefix": "sqlDropStoredProc",
"body": [ "body": [
"-- Drop the stored procedure called '${1:StoredProcedureName}' in schema '${2:SchemaName}'", "-- Drop the stored procedure called '${1:StoredProcedureName}' in schema '${2:dbo}'",
"IF EXISTS (", "IF EXISTS (",
"SELECT *", "SELECT *",
"\tFROM INFORMATION_SCHEMA.ROUTINES", "\tFROM INFORMATION_SCHEMA.ROUTINES",
"WHERE SPECIFIC_SCHEMA = N'${2:SchemaName}'", "WHERE SPECIFIC_SCHEMA = N'${2:dbo}'",
"\tAND SPECIFIC_NAME = N'${1:StoredProcedureName}'", "\tAND SPECIFIC_NAME = N'${1:StoredProcedureName}'",
")", ")",
"DROP PROCEDURE ${2:SchemaName}.${1:StoredProcedureName}", "DROP PROCEDURE ${2:dbo}.${1:StoredProcedureName}",
"GO" "GO"
], ],
"description": "Drop a stored procedure" "description": "Drop a stored procedure"
@@ -241,7 +241,7 @@
"Declare a cursor": { "Declare a cursor": {
"prefix": "sqlCursor", "prefix": "sqlCursor",
"body": [ "body": [
"-- Declare a cursor for a Table or a View '${1:TableOrViewName}' in schema '${2:SchemaName}'", "-- Declare a cursor for a Table or a View '${1:TableOrViewName}' in schema '${2:dbo}'",
"DECLARE @ColumnName1 NVARCHAR(50), @ColumnName2 NVARCHAR(50)", "DECLARE @ColumnName1 NVARCHAR(50), @ColumnName2 NVARCHAR(50)",
"", "",
"DECLARE db_cursor CURSOR FOR", "DECLARE db_cursor CURSOR FOR",
@@ -304,8 +304,8 @@
"prefix": "sqlCreateIndex", "prefix": "sqlCreateIndex",
"body": [ "body": [
"-- Create a nonclustered index with or without a unique constraint", "-- Create a nonclustered index with or without a unique constraint",
"-- Or create a clustered index on table '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'", "-- Or create a clustered index on table '[${1:TableName}]' in schema '[${2:dbo}]' in database '[${3:DatabaseName}]'",
"CREATE ${5:/*UNIQUE or CLUSTERED*/} INDEX IX_${4:IndexName} ON [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}] ([${6:ColumnName1}] DESC /*Change sort order as needed*/", "CREATE ${5:/*UNIQUE or CLUSTERED*/} INDEX IX_${4:IndexName} ON [${3:DatabaseName}].[${2:dbo}].[${1:TableName}] ([${6:ColumnName1}] DESC /*Change sort order as needed*/",
"GO" "GO"
], ],
"description": "Create a new Index" "description": "Create a new Index"
@@ -319,13 +319,13 @@
"IF OBJECT_ID('tempDB..#${1:TableName}', 'U') IS NOT NULL", "IF OBJECT_ID('tempDB..#${1:TableName}', 'U') IS NOT NULL",
"DROP TABLE #${1:TableName}", "DROP TABLE #${1:TableName}",
"GO", "GO",
"-- Create the temporary table from a physical table called '${4:TableName}' in schema '${3:SchemaName}' in database '${2:DatabaseName}'", "-- Create the temporary table from a physical table called '${4:TableName}' in schema '${3:dbo}' in database '${2:DatabaseName}'",
"SELECT *", "SELECT *",
"INTO #${1:TableName}", "INTO #${1:TableName}",
"FROM [${2:DatabaseName}].[${3:[SchemaName}].[${4:TableName}]", "FROM [${2:DatabaseName}].[${3:[dbo}].[${4:TableName}]",
"WHERE ${5:/* add search conditions here */}" "WHERE ${5:/* add search conditions here */}"
], ],
"description": "Create a new Temporary Table" "description": "Create a new Temporary Table"
}, }
} }

View File

@@ -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.52", "version": "1.5.0-alpha.53",
"downloadFileNames": { "downloadFileNames": {
"Windows_86": "win-x86-netcoreapp2.2.zip", "Windows_86": "win-x86-netcoreapp2.2.zip",
"Windows_64": "win-x64-netcoreapp2.2.zip", "Windows_64": "win-x64-netcoreapp2.2.zip",

View File

@@ -12,9 +12,7 @@ import { CreateSessionData } from '../data/createSessionData';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
export class CreateSessionDialog { export class CreateSessionDialog {
// Top level // Top level
private readonly DialogTitle: string = localize('createSessionDialog.newSession', 'New Session');
private readonly CancelButtonText: string = localize('createSessionDialog.cancel', 'Cancel'); private readonly CancelButtonText: string = localize('createSessionDialog.cancel', 'Cancel');
private readonly CreateButtonText: string = localize('createSessionDialog.create', 'Create'); private readonly CreateButtonText: string = localize('createSessionDialog.create', 'Create');
private readonly DialogTitleText: string = localize('createSessionDialog.title', 'Create New Profiler Session'); private readonly DialogTitleText: string = localize('createSessionDialog.title', 'Create New Profiler Session');
@@ -25,23 +23,28 @@ export class CreateSessionDialog {
private sessionNameBox: sqlops.InputBoxComponent; private sessionNameBox: sqlops.InputBoxComponent;
private model: CreateSessionData; private model: CreateSessionData;
private readonly _providerType: string;
private _onSuccess: vscode.EventEmitter<CreateSessionData> = new vscode.EventEmitter<CreateSessionData>(); private _onSuccess: vscode.EventEmitter<CreateSessionData> = new vscode.EventEmitter<CreateSessionData>();
public readonly onSuccess: vscode.Event<CreateSessionData> = this._onSuccess.event; public readonly onSuccess: vscode.Event<CreateSessionData> = this._onSuccess.event;
constructor(ownerUri: string, templates: Array<sqlops.ProfilerSessionTemplate>) { constructor(ownerUri: string, providerType: string, templates: Array<sqlops.ProfilerSessionTemplate>) {
if (typeof (templates) === 'undefined' || templates === null) { if (typeof (templates) === 'undefined' || templates === null) {
throw new Error(localize('createSessionDialog.templatesInvalid', "Invalid templates list, cannot open dialog")); throw new Error(localize('createSessionDialog.templatesInvalid', "Invalid templates list, cannot open dialog"));
} }
if (typeof (ownerUri) === 'undefined' || ownerUri === null) { if (typeof (ownerUri) === 'undefined' || ownerUri === null) {
throw new Error(localize('createSessionDialog.dialogOwnerInvalid', "Invalid dialog owner, cannot open dialog")); throw new Error(localize('createSessionDialog.dialogOwnerInvalid', "Invalid dialog owner, cannot open dialog"));
} }
if (typeof (providerType) === 'undefined' || providerType === null) {
throw new Error(localize('createSessionDialog.invalidProviderType', "Invalid provider type, cannot open dialog"));
}
this._providerType = providerType;
this.model = new CreateSessionData(ownerUri, templates); this.model = new CreateSessionData(ownerUri, templates);
} }
public async showDialog(): Promise<void> { public async showDialog(): Promise<void> {
this.dialog = sqlops.window.modelviewdialog.createDialog(this.DialogTitle); this.dialog = sqlops.window.modelviewdialog.createDialog(this.DialogTitleText);
this.initializeContent(); this.initializeContent();
this.dialog.okButton.onClick(() => this.execute()); this.dialog.okButton.onClick(() => this.execute());
this.dialog.cancelButton.onClick(() => { }); this.dialog.cancelButton.onClick(() => { });
@@ -76,7 +79,7 @@ export class CreateSessionDialog {
title: localize('createSessionDialog.enterSessionName', "Enter session name:") title: localize('createSessionDialog.enterSessionName', "Enter session name:")
}], }],
title: this.DialogTitleText title: ''
}]).withLayout({ width: '100%' }).component(); }]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel); await view.initializeModel(formModel);
@@ -97,8 +100,7 @@ export class CreateSessionDialog {
} }
private async execute(): Promise<void> { private async execute(): Promise<void> {
let currentConnection = await sqlops.connection.getCurrentConnection(); let profilerService = sqlops.dataprotocol.getProvider<sqlops.ProfilerProvider>(this._providerType, sqlops.DataProviderType.ProfilerProvider);
let profilerService = sqlops.dataprotocol.getProvider<sqlops.ProfilerProvider>(currentConnection.providerName, sqlops.DataProviderType.ProfilerProvider);
let name = this.sessionNameBox.value; let name = this.sessionNameBox.value;
let selected = this.templatesBox.value.toString(); let selected = this.templatesBox.value.toString();

View File

@@ -29,8 +29,8 @@ export class MainController {
} }
public activate(): void { public activate(): void {
vscode.commands.registerCommand('profiler.openCreateSessionDialog', (ownerUri: string, templates: Array<sqlops.ProfilerSessionTemplate>) => { vscode.commands.registerCommand('profiler.openCreateSessionDialog', (ownerUri: string, providerType: string, templates: Array<sqlops.ProfilerSessionTemplate>) => {
let dialog = new CreateSessionDialog(ownerUri, templates); let dialog = new CreateSessionDialog(ownerUri, providerType, templates);
dialog.showDialog(); dialog.showDialog();
}); });
} }

View File

@@ -2,7 +2,7 @@
"name": "profiler", "name": "profiler",
"displayName": "SQL Server Profiler", "displayName": "SQL Server Profiler",
"description": "SQL Server Profiler for Azure Data Studio", "description": "SQL Server Profiler for Azure Data Studio",
"version": "0.2.0", "version": "0.3.0",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt", "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt",
@@ -26,11 +26,10 @@
"Microsoft.mssql" "Microsoft.mssql"
], ],
"contributes": { "contributes": {
"commands": [ "commands": [
{ {
"command": "profiler.newProfiler", "command": "profiler.newProfiler",
"title": "New Profiler", "title": "Launch Profiler",
"category": "Profiler" "category": "Profiler"
}, },
{ {
@@ -49,6 +48,15 @@
"category": "Profiler" "category": "Profiler"
} }
], ],
"menus": {
"objectExplorer/item/context": [
{
"command": "profiler.newProfiler",
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server",
"group": "profiler"
}
]
},
"outputChannels": [ "outputChannels": [
"sqlprofiler" "sqlprofiler"
] ]
@@ -59,4 +67,4 @@
"devDependencies": { "devDependencies": {
"vscode": "1.0.1" "vscode": "1.0.1"
} }
} }

View File

@@ -67,7 +67,8 @@
"panel.background": "#212121", "panel.background": "#212121",
"panel.border": "#515151", "panel.border": "#515151",
"panelTitle.activeForeground": "#ffffff", "panelTitle.activeForeground": "#ffffff",
"panelTitle.inactiveForeground": "#888888" "panelTitle.inactiveForeground": "#888888",
"panelTitle.activeBorder": "#026dc8"
}, },
"tokenColors": [ "tokenColors": [
{ {

View File

@@ -77,7 +77,8 @@
"panel.background": "#ffffff", "panel.background": "#ffffff",
"panel.border": "#c8c8c8", "panel.border": "#c8c8c8",
"panelTitle.activeForeground": "#212121", "panelTitle.activeForeground": "#212121",
"panelTitle.inactiveForeground": "#757575" "panelTitle.inactiveForeground": "#757575",
"panelTitle.activeBorder": "#026dc8"
}, },
"tokenColors": [ "tokenColors": [
{ {

View File

@@ -1,6 +1,6 @@
{ {
"name": "azuredatastudio", "name": "azuredatastudio",
"version": "1.2.3", "version": "1.3.1",
"distro": "8c3e97e3425cc9814496472ab73e076de2ba99ee", "distro": "8c3e97e3425cc9814496472ab73e076de2ba99ee",
"author": { "author": {
"name": "Microsoft Corporation" "name": "Microsoft Corporation"

View File

@@ -611,7 +611,7 @@
</body></file> </body></file>
<file original="src/sql/parts/connection/common/connectionActions" source-language="en" datatype="plaintext"><body> <file original="src/sql/parts/connection/common/connectionActions" source-language="en" datatype="plaintext"><body>
<trans-unit id="ClearRecentlyUsedLabel"> <trans-unit id="ClearRecentlyUsedLabel">
<source xml:lang="en">Clear Recent Connections List</source> <source xml:lang="en">Clear List</source>
</trans-unit> </trans-unit>
<trans-unit id="ClearedRecentConnections"> <trans-unit id="ClearedRecentConnections">
<source xml:lang="en">Recent connections list cleared</source> <source xml:lang="en">Recent connections list cleared</source>
@@ -1039,10 +1039,10 @@
<source xml:lang="en">Connection</source> <source xml:lang="en">Connection</source>
</trans-unit> </trans-unit>
<trans-unit id="recentConnectionTitle"> <trans-unit id="recentConnectionTitle">
<source xml:lang="en">Recent connections</source> <source xml:lang="en">Recent Connections</source>
</trans-unit> </trans-unit>
<trans-unit id="savedConnectionTitle"> <trans-unit id="savedConnectionTitle">
<source xml:lang="en">Saved connections</source> <source xml:lang="en">Saved Connections</source>
</trans-unit> </trans-unit>
<trans-unit id="connectType"> <trans-unit id="connectType">
<source xml:lang="en">Connection type</source> <source xml:lang="en">Connection type</source>
@@ -1520,9 +1520,6 @@
</trans-unit> </trans-unit>
</body></file> </body></file>
<file original="src/sql/parts/profiler/contrib/profilerActions" source-language="en" datatype="plaintext"><body> <file original="src/sql/parts/profiler/contrib/profilerActions" source-language="en" datatype="plaintext"><body>
<trans-unit id="profiler.connect">
<source xml:lang="en">Connect</source>
</trans-unit>
<trans-unit id="profilerAction.disconnect"> <trans-unit id="profilerAction.disconnect">
<source xml:lang="en">Disconnect</source> <source xml:lang="en">Disconnect</source>
</trans-unit> </trans-unit>
@@ -1533,16 +1530,13 @@
<source xml:lang="en">Start</source> <source xml:lang="en">Start</source>
</trans-unit> </trans-unit>
<trans-unit id="create"> <trans-unit id="create">
<source xml:lang="en">Create</source> <source xml:lang="en">New Session</source>
</trans-unit>
<trans-unit id="profiler.capture">
<source xml:lang="en">Pause Capture</source>
</trans-unit> </trans-unit>
<trans-unit id="profilerAction.resumeCapture"> <trans-unit id="profilerAction.resumeCapture">
<source xml:lang="en">Resume Capture</source> <source xml:lang="en">Resume</source>
</trans-unit> </trans-unit>
<trans-unit id="profilerAction.pauseCapture"> <trans-unit id="profilerAction.pauseCapture">
<source xml:lang="en">Pause Capture</source> <source xml:lang="en">Pause</source>
</trans-unit> </trans-unit>
<trans-unit id="profilerStop.stop"> <trans-unit id="profilerStop.stop">
<source xml:lang="en">Stop</source> <source xml:lang="en">Stop</source>
@@ -1550,9 +1544,6 @@
<trans-unit id="profiler.clear"> <trans-unit id="profiler.clear">
<source xml:lang="en">Clear Data</source> <source xml:lang="en">Clear Data</source>
</trans-unit> </trans-unit>
<trans-unit id="profiler.autoscrollOn">
<source xml:lang="en">Auto Scroll: On</source>
</trans-unit>
<trans-unit id="profilerAction.autoscrollOn"> <trans-unit id="profilerAction.autoscrollOn">
<source xml:lang="en">Auto Scroll: On</source> <source xml:lang="en">Auto Scroll: On</source>
</trans-unit> </trans-unit>
@@ -1572,7 +1563,7 @@
<source xml:lang="en">Find Previous String</source> <source xml:lang="en">Find Previous String</source>
</trans-unit> </trans-unit>
<trans-unit id="profilerAction.newProfiler"> <trans-unit id="profilerAction.newProfiler">
<source xml:lang="en">New Profiler</source> <source xml:lang="en">Launch Profiler</source>
</trans-unit> </trans-unit>
</body></file> </body></file>
<file original="src/sql/base/browser/ui/selectBox/selectBox" source-language="en" datatype="plaintext"><body> <file original="src/sql/base/browser/ui/selectBox/selectBox" source-language="en" datatype="plaintext"><body>
@@ -1644,7 +1635,7 @@
</body></file> </body></file>
<file original="src/sql/parts/connection/connectionDialog/advancedPropertiesController" source-language="en" datatype="plaintext"><body> <file original="src/sql/parts/connection/connectionDialog/advancedPropertiesController" source-language="en" datatype="plaintext"><body>
<trans-unit id="connectionAdvancedProperties"> <trans-unit id="connectionAdvancedProperties">
<source xml:lang="en">Advanced properties</source> <source xml:lang="en">Advanced Properties</source>
</trans-unit> </trans-unit>
<trans-unit id="advancedProperties.discard"> <trans-unit id="advancedProperties.discard">
<source xml:lang="en">Discard</source> <source xml:lang="en">Discard</source>

View File

@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="extensions/profiler/client\out/dialogs/profilerCreateSessionDialog" source-language="en" datatype="plaintext"><body> <file original="extensions/profiler/client\out/dialogs/profilerCreateSessionDialog" source-language="en" datatype="plaintext"><body>
<trans-unit id="createSessionDialog.newSession">
<source xml:lang="en">New Session</source>
</trans-unit>
<trans-unit id="createSessionDialog.cancel"> <trans-unit id="createSessionDialog.cancel">
<source xml:lang="en">Cancel</source> <source xml:lang="en">Cancel</source>
</trans-unit> </trans-unit>

View File

@@ -12,12 +12,18 @@ set CODE=".build\electron\%NAMESHORT%"
rem TFS Builds rem TFS Builds
if not "%BUILD_BUILDID%" == "" ( if not "%BUILD_BUILDID%" == "" (
%CODE% .\node_modules\mocha\bin\_mocha %* if not "%ADD_REPORTER%" == "" (
%CODE% .\node_modules\mocha\bin\_mocha --reporter mocha-junit-reporter %*
)
if "%ADD_REPORTER%" == "" (
%CODE% .\node_modules\mocha\bin\_mocha %*
)
) )
rem Otherwise rem Otherwise
if "%BUILD_BUILDID%" == "" ( if "%BUILD_BUILDID%" == "" (
%CODE% .\node_modules\mocha\bin\_mocha --reporter dot %* %CODE% .\node_modules\mocha\bin\_mocha --reporter mocha-junit-reporter %*
) )
popd popd

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]] || [[ "$AGENT_OS" == "Darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; } realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0"))) ROOT=$(dirname $(dirname $(realpath "$0")))
@@ -14,7 +14,7 @@ fi
cd $ROOT cd $ROOT
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]] || [[ "$AGENT_OS" == "Darwin"* ]]; then
NAME=`node -p "require('./product.json').nameLong"` NAME=`node -p "require('./product.json').nameLong"`
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron" CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
else else
@@ -30,7 +30,7 @@ node build/lib/electron.js || ./node_modules/.bin/gulp electron
# Unit Tests # Unit Tests
export ELECTRON_RUN_AS_NODE=1 export ELECTRON_RUN_AS_NODE=1
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]] || [[ "$AGENT_OS" == "Darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; \ cd $ROOT ; ulimit -n 4096 ; \
"$CODE" \ "$CODE" \
node_modules/mocha/bin/_mocha "$@" node_modules/mocha/bin/_mocha "$@"

View File

@@ -56,6 +56,7 @@
.modal .modal-title { .modal .modal-title {
font-size: 15px; font-size: 15px;
font-weight: 600;
} }
.modal .modal-title-icon { .modal .modal-title-icon {
@@ -147,7 +148,7 @@
} }
.modal .footer-button { .modal .footer-button {
margin-right: 5px; margin-left: 5px;
} }
.modal .right-footer .footer-button:last-of-type { .modal .right-footer .footer-button:last-of-type {
@@ -235,8 +236,8 @@
.modal.flyout-dialog .dialog-message-detail { .modal.flyout-dialog .dialog-message-detail {
margin-top: 5px; margin-top: 5px;
white-space: normal; white-space: pre-wrap;
-webkit-user-select: text; user-select: text;
font-size: 11px; font-size: 11px;
} }

View File

@@ -20,11 +20,34 @@
} }
.optionsDialog-options-groups { .optionsDialog-options-groups {
padding: 15px; margin-top: 10px;
height: calc(100% - 150px); flex: 1 1;
overflow-y: auto; overflow-y: auto;
} }
.optionsDialog-options-groups {
margin: 10px 0px;
flex: 1 1;
overflow-y: auto;
}
.vs .optionsDialog-options-groups {
box-shadow: 0 1px 4px 1px rgba(220, 220, 220, 0.71);
}
.vs-dark .optionsDialog-options-groups {
box-shadow: 0 4px 5px 0px rgba(0, 0, 0, 0.71);
}
.optionsDialog-options-groups .split-view-view .header {
padding-left: 28px !important;
background-position-x: 8px !important;
}
.optionsDialog-options-groups .split-view-view .body {
padding-left: 5px !important;
}
.backButtonIcon { .backButtonIcon {
content: url('back.svg'); content: url('back.svg');
width: 20px; width: 20px;
@@ -33,21 +56,42 @@
cursor: pointer; cursor: pointer;
} }
.vs-dark.monaco-shell .backButtonIcon { .hc-black .backButtonIcon,
.vs-dark .backButtonIcon {
content: url('back_inverse.svg'); content: url('back_inverse.svg');
} }
.optionsDialog-description { .optionsDialog-description {
padding: 15px; height: 90px;
overflow-y: auto; margin: 15px;
overflow-y: auto;
}
.optionsDialog-description .modal-title {
background-repeat: no-repeat;
background-position: 2px center;
padding-left: 25px;
background-size: 16px;
}
.vs .optionsDialog-description .modal-title {
background-image: url('info_notification.svg')
}
.vs-dark .optionsDialog-description .modal-title,
.hc-black .optionsDialog-description .modal-title {
background-image: url('info_notification_inverse.svg')
} }
.optionsDialog-options { .optionsDialog-options {
height: calc(100% - 30px); height: 100%;
display: flex;
flex-direction: column;
} }
.optionsDialog-description-content { .optionsDialog-description-content {
padding: 10px; padding-top: 10px;
padding-left: 25px;
} }
.optionsDialog-table{ .optionsDialog-table{

View File

@@ -72,8 +72,8 @@ const defaultOptions: IModalOptions = {
}; };
export abstract class Modal extends Disposable implements IThemable { export abstract class Modal extends Disposable implements IThemable {
protected _useDefaultMessageBoxLocation: boolean = true;
private _messageElement: HTMLElement; protected _messageElement: HTMLElement;
private _messageIcon: HTMLElement; private _messageIcon: HTMLElement;
private _messageSeverity: Builder; private _messageSeverity: Builder;
private _messageSummary: Builder; private _messageSummary: Builder;
@@ -253,7 +253,9 @@ export abstract class Modal extends Disposable implements IThemable {
this._messageElement = this._modalMessageSection.getHTMLElement(); this._messageElement = this._modalMessageSection.getHTMLElement();
this.updateElementVisibility(this._messageElement, false); this.updateElementVisibility(this._messageElement, false);
parts.push(this._messageElement); if (this._useDefaultMessageBoxLocation) {
parts.push(this._messageElement);
}
} }
// This modal body section refers to the body of of the dialog // This modal body section refers to the body of of the dialog

View File

@@ -125,7 +125,7 @@ export class OptionsDialog extends Modal {
}); });
let builder = new Builder(this._body); let builder = new Builder(this._body);
builder.div({ class: 'Connection-divider' }, (dividerContainer) => { builder.div({}, (dividerContainer) => {
this._dividerBuilder = dividerContainer; this._dividerBuilder = dividerContainer;
}); });

View File

@@ -46,9 +46,9 @@ panel {
} }
.tabbedPanel .tabList .tab .tabLabel { .tabbedPanel .tabList .tab .tabLabel {
text-transform: uppercase; font-size: 14px;
font-size: 13px;
padding-bottom: 4px; padding-bottom: 4px;
font-weight: 600;
} }
.tabbedPanel.vertical .tabList .tab .tabLabel { .tabbedPanel.vertical .tabList .tab .tabLabel {

View File

@@ -36,7 +36,6 @@ export interface IPanelTab {
interface IInternalPanelTab extends IPanelTab { interface IInternalPanelTab extends IPanelTab {
header: HTMLElement; header: HTMLElement;
label: HTMLElement; label: HTMLElement;
dispose(): void;
} }
const defaultOptions: IPanelOptions = { const defaultOptions: IPanelOptions = {
@@ -143,8 +142,6 @@ export class TabbedPanel extends Disposable implements IThemable {
this.tabList.appendChild(tabHeaderElement); this.tabList.appendChild(tabHeaderElement);
tab.header = tabHeaderElement; tab.header = tabHeaderElement;
tab.label = tabLabel; tab.label = tabLabel;
tab.dispose = () => { };
this._register(tab);
} }
public showTab(id: PanelTabIdentifier): void { public showTab(id: PanelTabIdentifier): void {

View File

@@ -19,6 +19,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
.tabbedPanel > .title .tabList .tab .tabLabel.active { .tabbedPanel > .title .tabList .tab .tabLabel.active {
color: ${titleActive}; color: ${titleActive};
border-bottom-color: ${titleActiveBorder}; border-bottom-color: ${titleActiveBorder};
border-bottom-width: 2px;
} }
.tabbedPanel > .title .tabList .tab-header.active { .tabbedPanel > .title .tabList .tab-header.active {

View File

@@ -3,11 +3,14 @@
* Licensed under the Source EULA. 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 { IDisposableDataProvider } from 'sql/base/browser/ui/table/interfaces';
export interface IObservableCollection<T> { export interface IObservableCollection<T> {
getLength(): number; getLength(): number;
at(index: number): T; at(index: number): T;
getRange(start: number, end: number): T[]; getRange(start: number, end: number): T[];
setCollectionChangedCallback(callback: (change: CollectionChange, startIndex: number, count: number) => void): void; setCollectionChangedCallback(callback: (change: CollectionChange, startIndex: number, count: number) => void): void;
dispose(): void;
} }
export interface IGridDataRow { export interface IGridDataRow {
@@ -24,24 +27,27 @@ class LoadCancellationToken {
} }
class DataWindow<TData> { class DataWindow<TData> {
private _dataSourceLength: number;
private _data: TData[]; private _data: TData[];
private _length: number = 0; private _length: number = 0;
private _offsetFromDataSource: number = -1; private _offsetFromDataSource: number = -1;
private loadFunction: (offset: number, count: number) => Thenable<TData[]>;
private lastLoadCancellationToken: LoadCancellationToken; private lastLoadCancellationToken: LoadCancellationToken;
private loadCompleteCallback: (start: number, end: number) => void;
private placeholderItemGenerator: (index: number) => TData;
constructor(dataSourceLength: number, constructor(
loadFunction: (offset: number, count: number) => Thenable<TData[]>, private loadFunction: (offset: number, count: number) => Thenable<TData[]>,
placeholderItemGenerator: (index: number) => TData, private placeholderItemGenerator: (index: number) => TData,
loadCompleteCallback: (start: number, end: number) => void) { private loadCompleteCallback: (start: number, end: number) => void
this._dataSourceLength = dataSourceLength; ) {
this.loadFunction = loadFunction; }
this.placeholderItemGenerator = placeholderItemGenerator;
this.loadCompleteCallback = loadCompleteCallback; dispose() {
this._data = undefined;
this.loadFunction = undefined;
this.placeholderItemGenerator = undefined;
this.loadCompleteCallback = undefined;
if (this.lastLoadCancellationToken) {
this.lastLoadCancellationToken.isCancelled = true;
}
} }
getStartIndex(): number { getStartIndex(): number {
@@ -76,10 +82,9 @@ class DataWindow<TData> {
return; return;
} }
let cancellationToken = new LoadCancellationToken(); this.lastLoadCancellationToken = new LoadCancellationToken();
this.lastLoadCancellationToken = cancellationToken;
this.loadFunction(offset, length).then(data => { this.loadFunction(offset, length).then(data => {
if (!cancellationToken.isCancelled) { if (!this.lastLoadCancellationToken.isCancelled) {
this._data = data; this._data = data;
this.loadCompleteCallback(this._offsetFromDataSource, this._offsetFromDataSource + this._length); this.loadCompleteCallback(this._offsetFromDataSource, this._offsetFromDataSource + this._length);
} }
@@ -97,10 +102,12 @@ export class VirtualizedCollection<TData> implements IObservableCollection<TData
private collectionChangedCallback: (change: CollectionChange, startIndex: number, count: number) => void; private collectionChangedCallback: (change: CollectionChange, startIndex: number, count: number) => void;
constructor(windowSize: number, constructor(
windowSize: number,
length: number, length: number,
loadFn: (offset: number, count: number) => Thenable<TData[]>, loadFn: (offset: number, count: number) => Thenable<TData[]>,
private _placeHolderGenerator: (index: number) => TData) { private _placeHolderGenerator: (index: number) => TData
) {
this._windowSize = windowSize; this._windowSize = windowSize;
this._length = length; this._length = length;
@@ -110,9 +117,15 @@ export class VirtualizedCollection<TData> implements IObservableCollection<TData
} }
}; };
this._bufferWindowBefore = new DataWindow(length, loadFn, _placeHolderGenerator, loadCompleteCallback); this._bufferWindowBefore = new DataWindow(loadFn, _placeHolderGenerator, loadCompleteCallback);
this._window = new DataWindow(length, loadFn, _placeHolderGenerator, loadCompleteCallback); this._window = new DataWindow(loadFn, _placeHolderGenerator, loadCompleteCallback);
this._bufferWindowAfter = new DataWindow(length, loadFn, _placeHolderGenerator, loadCompleteCallback); this._bufferWindowAfter = new DataWindow(loadFn, _placeHolderGenerator, loadCompleteCallback);
}
dispose() {
this._bufferWindowAfter.dispose();
this._bufferWindowBefore.dispose();
this._window.dispose();
} }
setCollectionChangedCallback(callback: (change: CollectionChange, startIndex: number, count: number) => void): void { setCollectionChangedCallback(callback: (change: CollectionChange, startIndex: number, count: number) => void): void {
@@ -197,7 +210,7 @@ export class VirtualizedCollection<TData> implements IObservableCollection<TData
} }
} }
export class AsyncDataProvider<TData extends IGridDataRow> implements Slick.DataProvider<TData> { export class AsyncDataProvider<TData extends IGridDataRow> implements IDisposableDataProvider<TData> {
constructor(private dataRows: IObservableCollection<TData>) { } constructor(private dataRows: IObservableCollection<TData>) { }
@@ -212,4 +225,8 @@ export class AsyncDataProvider<TData extends IGridDataRow> implements Slick.Data
public getRange(start: number, end: number): TData[] { public getRange(start: number, end: number): TData[] {
return !this.dataRows ? undefined : this.dataRows.getRange(start, end); return !this.dataRows ? undefined : this.dataRows.getRange(start, end);
} }
dispose() {
this.dataRows.dispose();
}
} }

View File

@@ -0,0 +1,31 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IListStyles } from 'vs/base/browser/ui/list/listWidget';
import { Color } from 'vs/base/common/color';
export interface IDisposableDataProvider<T> extends Slick.DataProvider<T> {
dispose(): void;
}
export interface ITableMouseEvent {
anchor: HTMLElement | { x: number, y: number };
cell?: { row: number, cell: number };
}
export interface ITableStyles extends IListStyles {
tableHeaderBackground?: Color;
tableHeaderForeground?: Color;
}
export interface ITableSorter<T> {
sort(args: Slick.OnSortEventArgs<T>);
}
export interface ITableConfiguration<T> {
dataProvider?: IDisposableDataProvider<T> | Array<T>;
columns?: Slick.Column<T>[];
sorter?: ITableSorter<T>;
}

View File

@@ -5,28 +5,18 @@
import 'vs/css!./media/table'; import 'vs/css!./media/table';
import { TableDataView } from './tableDataView'; import { TableDataView } from './tableDataView';
import { IDisposableDataProvider, ITableSorter, ITableMouseEvent, ITableConfiguration, ITableStyles } from 'sql/base/browser/ui/table/interfaces';
import { IThemable } from 'vs/platform/theme/common/styler'; import { IThemable } from 'vs/platform/theme/common/styler';
import { IListStyles } from 'vs/base/browser/ui/list/listWidget';
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects'; import { mixin } from 'vs/base/common/objects';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable } from 'vs/base/common/lifecycle';
import { Orientation } from 'vs/base/browser/ui/splitview/splitview'; import { Orientation } from 'vs/base/browser/ui/splitview/splitview';
import { Widget } from 'vs/base/browser/ui/widget'; import { Widget } from 'vs/base/browser/ui/widget';
import { isArray, isBoolean } from 'vs/base/common/types'; import { isArray, isBoolean } from 'vs/base/common/types';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { range } from 'vs/base/common/arrays'; import { range } from 'vs/base/common/arrays';
import { $ } from 'vs/base/browser/builder';
export interface ITableMouseEvent {
anchor: HTMLElement | { x: number, y: number };
cell?: { row: number, cell: number };
}
export interface ITableStyles extends IListStyles {
tableHeaderBackground?: Color;
tableHeaderForeground?: Color;
}
function getDefaultOptions<T>(): Slick.GridOptions<T> { function getDefaultOptions<T>(): Slick.GridOptions<T> {
return <Slick.GridOptions<T>>{ return <Slick.GridOptions<T>>{
@@ -35,23 +25,13 @@ function getDefaultOptions<T>(): Slick.GridOptions<T> {
}; };
} }
export interface ITableSorter<T> {
sort(args: Slick.OnSortEventArgs<T>);
}
export interface ITableConfiguration<T> {
dataProvider?: Slick.DataProvider<T> | Array<T>;
columns?: Slick.Column<T>[];
sorter?: ITableSorter<T>;
}
export class Table<T extends Slick.SlickData> extends Widget implements IThemable, IDisposable { export class Table<T extends Slick.SlickData> extends Widget implements IThemable, IDisposable {
private styleElement: HTMLStyleElement; private styleElement: HTMLStyleElement;
private idPrefix: string; private idPrefix: string;
private _grid: Slick.Grid<T>; private _grid: Slick.Grid<T>;
private _columns: Slick.Column<T>[]; private _columns: Slick.Column<T>[];
private _data: Slick.DataProvider<T>; private _data: IDisposableDataProvider<T>;
private _sorter: ITableSorter<T>; private _sorter: ITableSorter<T>;
private _autoscroll: boolean; private _autoscroll: boolean;
@@ -60,8 +40,6 @@ export class Table<T extends Slick.SlickData> extends Widget implements IThemabl
private _classChangeTimeout: number; private _classChangeTimeout: number;
private _disposables: IDisposable[] = [];
private _onContextMenu = new Emitter<ITableMouseEvent>(); private _onContextMenu = new Emitter<ITableMouseEvent>();
public readonly onContextMenu: Event<ITableMouseEvent> = this._onContextMenu.event; public readonly onContextMenu: Event<ITableMouseEvent> = this._onContextMenu.event;
@@ -76,6 +54,8 @@ export class Table<T extends Slick.SlickData> extends Widget implements IThemabl
this._data = configuration.dataProvider; this._data = configuration.dataProvider;
} }
this._register(this._data);
if (configuration && configuration.columns) { if (configuration && configuration.columns) {
this._columns = configuration.columns; this._columns = configuration.columns;
} else { } else {
@@ -117,6 +97,12 @@ export class Table<T extends Slick.SlickData> extends Widget implements IThemabl
}); });
} }
this._register({
dispose: () => {
this._grid.destroy();
}
});
this.mapMouseEvent(this._grid.onContextMenu, this._onContextMenu); this.mapMouseEvent(this._grid.onContextMenu, this._onContextMenu);
this.mapMouseEvent(this._grid.onClick, this._onClick); this.mapMouseEvent(this._grid.onClick, this._onClick);
} }
@@ -131,7 +117,8 @@ export class Table<T extends Slick.SlickData> extends Widget implements IThemabl
} }
public dispose() { public dispose() {
dispose(this._disposables); $(this._container).dispose();
super.dispose();
} }
public invalidateRows(rows: number[], keepEditor: boolean) { public invalidateRows(rows: number[], keepEditor: boolean) {
@@ -166,7 +153,7 @@ export class Table<T extends Slick.SlickData> extends Widget implements IThemabl
this._grid.setData(this._data, true); this._grid.setData(this._data, true);
} }
getData(): Slick.DataProvider<T> { getData(): IDisposableDataProvider<T> {
return this._data; return this._data;
} }

View File

@@ -9,6 +9,8 @@ import { Event, Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import * as types from 'vs/base/common/types'; import * as types from 'vs/base/common/types';
import { IDisposableDataProvider } from 'sql/base/browser/ui/table/interfaces';
export interface IFindPosition { export interface IFindPosition {
col: number; col: number;
row: number; row: number;
@@ -20,7 +22,7 @@ function defaultSort<T>(args: Slick.OnSortEventArgs<T>, data: Array<T>): Array<T
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);
} }
export class TableDataView<T extends Slick.SlickData> implements Slick.DataProvider<T> { export class TableDataView<T extends Slick.SlickData> implements IDisposableDataProvider<T> {
private _data: Array<T>; private _data: Array<T>;
private _findArray: Array<IFindPosition>; private _findArray: Array<IFindPosition>;
private _findObs: Observable<IFindPosition>; private _findObs: Observable<IFindPosition>;
@@ -154,4 +156,10 @@ export class TableDataView<T extends Slick.SlickData> implements Slick.DataProvi
get findCount(): number { get findCount(): number {
return types.isUndefinedOrNull(this._findArray) ? 0 : this._findArray.length; return types.isUndefinedOrNull(this._findArray) ? 0 : this._findArray.length;
} }
dispose() {
this._data = undefined;
this._findArray = undefined;
this._findObs = undefined;
}
} }

View File

@@ -23,7 +23,7 @@
.carbon-taskbar.monaco-toolbar .monaco-action-bar.animated .actions-container { .carbon-taskbar.monaco-toolbar .monaco-action-bar.animated .actions-container {
justify-content: flex-start; justify-content: flex-start;
padding-left: 15px; padding: 5px 5px 5px 15px;
flex-wrap: wrap; flex-wrap: wrap;
} }

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2 -2 16 16" enable-background="new -2 -2 16 16"><polygon fill="#424242" points="9,0 4.5,9 3,6 0,6 3,12 6,12 12,0"/></svg>

After

Width:  |  Height:  |  Size: 194 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2 -2 16 16" enable-background="new -2 -2 16 16"><polygon fill="#C5C5C5" points="9,0 4.5,9 3,6 0,6 3,12 6,12 12,0"/></svg>

After

Width:  |  Height:  |  Size: 194 B

View File

@@ -227,6 +227,51 @@
background: url('unpin.svg') center center no-repeat; background: url('unpin.svg') center center no-repeat;
} }
.vs .sql.icon.pause {
background-image: url('pause.svg')
}
.vs-dark .sql.icon.pause,
.hc-black .sql.icon.pause {
background-image: url('pause_inverse.svg')
}
.vs .sql.icon.continue {
background-image: url('continue.svg')
}
.vs-dark .sql.icon.continue,
.hc-black .sql.icon.continue {
background-image: url('continue_inverse.svg')
}
.vs .sql.icon.checked {
background-image: url('check.svg')
}
.vs-dark .sql.icon.checked,
.hc-black .sql.icon.checked {
background-image: url('check_inverse.svg')
}
.vs .sql.icon.start {
background-image: url('start.svg')
}
.vs-dark .sql.icon.start,
.hc-black .sql.icon.start {
background-image: url('start_inverse.svg')
}
.vs .sql.icon.stop {
background-image: url('stop.svg')
}
.vs-dark .sql.icon.stop,
.hc-black .sql.icon.stop {
background-image: url('stop_inverse.svg')
}
.small { .small {
width: 16px; width: 16px;
height: 16px; height: 16px;

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-blue{fill:#00539c;}</style></defs><title>continue</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M15.64,8l-7.8,6H2V2H7.84Z"/></g><g id="iconBg"><path class="icon-vs-action-blue" d="M3,3H5V13H3ZM7.5,3V13L14,8Z"/></g></svg>

After

Width:  |  Height:  |  Size: 502 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-blue{fill:#75beff;}</style></defs><title>continue</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M15.64,8l-7.8,6H2V2H7.84Z"/></g><g id="iconBg"><path class="icon-vs-action-blue" d="M3,3H5V13H3ZM7.5,3V13L14,8Z"/></g></svg>

After

Width:  |  Height:  |  Size: 502 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-blue{fill:#00539c;}</style></defs><title>pause</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M13,2V14H8.5V2ZM3,14H7.5V2H3Z"/></g><g id="iconBg"><path class="icon-vs-action-blue" d="M4,3H6.5V13H4ZM9.5,3V13H12V3Z"/></g></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-blue{fill:#75beff;}</style></defs><title>pause</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M13,2V14H8.5V2ZM3,14H7.5V2H3Z"/></g><g id="iconBg"><path class="icon-vs-action-blue" d="M4,3H6.5V13H4ZM9.5,3V13H12V3Z"/></g></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-green{fill:#388a34;}</style></defs><title>continue</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M14.334,8,3.667,16H3V0h.667Z"/></g><g id="iconBg"><path class="icon-vs-action-green" d="M4,1.5v13L12.667,8,4,1.5Z"/></g></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-green{fill:#89d185;}</style></defs><title>continue</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M14.334,8,3.667,16H3V0h.667Z"/></g><g id="iconBg"><path class="icon-vs-action-green" d="M4,1.5v13L12.667,8,4,1.5Z"/></g></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-red{fill:#a1260d;}</style></defs><title>stop</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M14,2V14H2V2Z"/></g><g id="iconBg"><path class="icon-vs-action-red" d="M13,3V13H3V3Z"/></g></svg>

After

Width:  |  Height:  |  Size: 470 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-red{fill:#f48771;}</style></defs><title>stop</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M14,2V14H2V2Z"/></g><g id="iconBg"><path class="icon-vs-action-red" d="M13,3V13H3V3Z"/></g></svg>

After

Width:  |  Height:  |  Size: 470 B

View File

@@ -26,7 +26,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
export class ClearRecentConnectionsAction extends Action { export class ClearRecentConnectionsAction extends Action {
public static ID = 'clearRecentConnectionsAction'; public static ID = 'clearRecentConnectionsAction';
public static LABEL = nls.localize('ClearRecentlyUsedLabel', 'Clear Recent Connections List'); public static LABEL = nls.localize('ClearRecentlyUsedLabel', 'Clear List');
public static ICON = 'search-action clear-search-results'; public static ICON = 'search-action clear-search-results';
private _onRecentConnectionsRemoved = new Emitter<void>(); private _onRecentConnectionsRemoved = new Emitter<void>();
@@ -83,7 +83,7 @@ export class ClearRecentConnectionsAction extends Action {
{ key: nls.localize('connectionAction.no', 'No'), value: false } { key: nls.localize('connectionAction.no', 'No'), value: false }
]; ];
self._quickOpenService.pick(choices.map(x => x.key), { placeHolder: nls.localize('ClearRecentlyUsedLabel', 'Clear Recent Connections List'), ignoreFocusLost: true }).then((choice) => { self._quickOpenService.pick(choices.map(x => x.key), { placeHolder: nls.localize('ClearRecentlyUsedLabel', 'Clear List'), ignoreFocusLost: true }).then((choice) => {
let confirm = choices.find(x => x.key === choice); let confirm = choices.find(x => x.key === choice);
resolve(confirm && confirm.value); resolve(confirm && confirm.value);
}); });

View File

@@ -38,7 +38,7 @@ export class AdvancedPropertiesController {
public get advancedDialog() { public get advancedDialog() {
if (!this._advancedDialog) { if (!this._advancedDialog) {
this._advancedDialog = this._instantiationService.createInstance( this._advancedDialog = this._instantiationService.createInstance(
OptionsDialog, localize('connectionAdvancedProperties', 'Advanced properties'), TelemetryKeys.ConnectionAdvancedProperties, { hasBackButton: true }); OptionsDialog, localize('connectionAdvancedProperties', 'Advanced Properties'), TelemetryKeys.ConnectionAdvancedProperties, { hasBackButton: true });
this._advancedDialog.cancelLabel = localize('advancedProperties.discard', 'Discard'); this._advancedDialog.cancelLabel = localize('advancedProperties.discard', 'Discard');
this._advancedDialog.onCloseEvent(() => this._onCloseAdvancedProperties()); this._advancedDialog.onCloseEvent(() => this._onCloseAdvancedProperties());
this._advancedDialog.onOk(() => this.handleOnOk()); this._advancedDialog.onOk(() => this.handleOnOk());

View File

@@ -37,6 +37,7 @@ import * as styler from 'vs/platform/theme/common/styler';
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
export interface OnShowUIResponse { export interface OnShowUIResponse {
selectedProviderType: string; selectedProviderType: string;
@@ -49,7 +50,7 @@ export class ConnectionDialogWidget extends Modal {
private _noRecentConnectionBuilder: Builder; private _noRecentConnectionBuilder: Builder;
private _savedConnectionBuilder: Builder; private _savedConnectionBuilder: Builder;
private _noSavedConnectionBuilder: Builder; private _noSavedConnectionBuilder: Builder;
private _dividerBuilder: Builder; private _connectionDetailTitle: Builder;
private _connectButton: Button; private _connectButton: Button;
private _closeButton: Button; private _closeButton: Button;
private _providerTypeSelectBox: SelectBox; private _providerTypeSelectBox: SelectBox;
@@ -143,7 +144,7 @@ export class ConnectionDialogWidget extends Modal {
this._panel = new TabbedPanel(connectionContainer.getHTMLElement()); this._panel = new TabbedPanel(connectionContainer.getHTMLElement());
this._recentConnectionTabId = this._panel.pushTab({ this._recentConnectionTabId = this._panel.pushTab({
identifier: 'recent_connection', identifier: 'recent_connection',
title: localize('recentConnectionTitle', 'Recent connections'), title: localize('recentConnectionTitle', 'Recent Connections'),
view: { view: {
render: c => { render: c => {
recentConnectionTab.appendTo(c); recentConnectionTab.appendTo(c);
@@ -154,7 +155,7 @@ export class ConnectionDialogWidget extends Modal {
let savedConnectionTabId = this._panel.pushTab({ let savedConnectionTabId = this._panel.pushTab({
identifier: 'saved_connection', identifier: 'saved_connection',
title: localize('savedConnectionTitle', 'Saved connections'), title: localize('savedConnectionTitle', 'Saved Connections'),
view: { view: {
layout: () => { }, layout: () => { },
render: c => { render: c => {
@@ -179,8 +180,9 @@ export class ConnectionDialogWidget extends Modal {
} }
}); });
this._bodyBuilder.div({ class: 'Connection-divider' }, (dividerContainer) => { this._bodyBuilder.div({ class: 'connection-details-title' }, (dividerContainer) => {
this._dividerBuilder = dividerContainer; this._connectionDetailTitle = dividerContainer;
this._connectionDetailTitle.text(localize('connectionDetailsTitle', 'Connection Details'));
}); });
this._bodyBuilder.div({ class: 'connection-type' }, (modelTableContent) => { this._bodyBuilder.div({ class: 'connection-type' }, (modelTableContent) => {
@@ -217,10 +219,12 @@ export class ConnectionDialogWidget extends Modal {
private updateTheme(theme: IColorTheme): void { private updateTheme(theme: IColorTheme): void {
let borderColor = theme.getColor(contrastBorder); let borderColor = theme.getColor(contrastBorder);
let border = borderColor ? borderColor.toString() : null; let border = borderColor ? borderColor.toString() : null;
if (this._dividerBuilder) { let backgroundColor = theme.getColor(SIDE_BAR_BACKGROUND);
this._dividerBuilder.style('border-top-width', border ? '1px' : null); if (this._connectionDetailTitle) {
this._dividerBuilder.style('border-top-style', border ? 'solid' : null); this._connectionDetailTitle.style('border-width', border ? '1px 0px' : null);
this._dividerBuilder.style('border-top-color', border); this._connectionDetailTitle.style('border-style', border ? 'solid none' : null);
this._connectionDetailTitle.style('border-color', border);
this._connectionDetailTitle.style('background-color', backgroundColor ? backgroundColor.toString() : null);
} }
} }
@@ -277,17 +281,13 @@ export class ConnectionDialogWidget extends Modal {
private createRecentConnectionList(): void { private createRecentConnectionList(): void {
this._recentConnectionBuilder.div({ class: 'connection-recent-content' }, (recentConnectionContainer) => { this._recentConnectionBuilder.div({ class: 'connection-recent-content' }, (recentConnectionContainer) => {
let recentHistoryLabel = localize('recentHistory', 'Recent history');
recentConnectionContainer.div({ class: 'recent-titles-container' }, (container) => { recentConnectionContainer.div({ class: 'recent-titles-container' }, (container) => {
container.div({ class: 'connection-history-label' }, (recentTitle) => {
recentTitle.text(recentHistoryLabel);
});
container.div({ class: 'connection-history-actions' }, (actionsContainer) => { container.div({ class: 'connection-history-actions' }, (actionsContainer) => {
this._actionbar = this._register(new ActionBar(actionsContainer.getHTMLElement(), { animated: false })); this._actionbar = this._register(new ActionBar(actionsContainer.getHTMLElement(), { animated: false }));
let clearAction = this._instantiationService.createInstance(ClearRecentConnectionsAction, ClearRecentConnectionsAction.ID, ClearRecentConnectionsAction.LABEL); let clearAction = this._instantiationService.createInstance(ClearRecentConnectionsAction, ClearRecentConnectionsAction.ID, ClearRecentConnectionsAction.LABEL);
clearAction.useConfirmationMessage = true; clearAction.useConfirmationMessage = true;
clearAction.onRecentConnectionsRemoved(() => this.open(false)); clearAction.onRecentConnectionsRemoved(() => this.open(false));
this._actionbar.push(clearAction, { icon: true, label: false }); this._actionbar.push(clearAction, { icon: true, label: true });
}); });
}); });
recentConnectionContainer.div({ class: 'server-explorer-viewlet' }, (divContainer: Builder) => { recentConnectionContainer.div({ class: 'server-explorer-viewlet' }, (divContainer: Builder) => {

View File

@@ -9,25 +9,35 @@
} }
.connection-input { .connection-input {
padding-right:8px;
width: 200px; width: 200px;
padding-bottom: 5px; padding-bottom: 5px;
} }
.connection-dialog { .connection-dialog {
height: calc(100% - 20px); height: 100%;
display: flex;
flex-direction: column;
overflow-x: hidden;
overflow-y: auto;
} }
.connection-dialog .tabbedPanel { .connection-dialog .tabbedPanel {
border-top-color: transparent; border-top-color: transparent;
height: calc(100% - 350px); flex: 1 1;
display: block;
min-height: 120px; min-height: 120px;
overflow: hidden;
margin: 0px 11px;
}
.connection-dialog .tabBody {
overflow: hidden;
flex: 1 1;
display: flex;
flex-direction: column;
} }
.connection-recent, .connection-saved { .connection-recent, .connection-saved {
margin: 15px; margin: 5px;
height: calc(100% - 60px); flex: 1 1;
overflow-y: auto; overflow-y: auto;
} }
@@ -45,6 +55,8 @@
.recent-titles-container { .recent-titles-container {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 5px;
flex: 0 0 auto;
} }
.connection-provider-info { .connection-provider-info {
@@ -53,7 +65,13 @@
} }
.connection-recent-content { .connection-recent-content {
height: calc(100% - 20px); height: 100%;
display: flex;
flex-direction: column;
}
.connection-recent-content .server-explorer-viewlet {
flex: 1 1;
} }
.connection-table-content { .connection-table-content {
@@ -66,8 +84,9 @@
} }
.connection-type { .connection-type {
margin: 15px; flex: 0 0 auto;
overflow-y: hidden; overflow: hidden;
margin: 0px 13px;
} }
.connection-dialog .connection-history-actions .action-label.icon { .connection-dialog .connection-history-actions .action-label.icon {
@@ -76,8 +95,9 @@
line-height: 20px; line-height: 20px;
min-width: 20px; min-width: 20px;
background-size: 16px; background-size: 16px;
background-position: center center; background-position: 2px center;
background-repeat: no-repeat; background-repeat: no-repeat;
padding-left: 25px;
} }
.search-action.clear-search-results { .search-action.clear-search-results {
@@ -87,4 +107,11 @@
.vs-dark .search-action.clear-search-results, .vs-dark .search-action.clear-search-results,
.hc-black .search-action.clear-search-results { .hc-black .search-action.clear-search-results {
background: url('clear-search-results-dark.svg'); background: url('clear-search-results-dark.svg');
}
.connection-details-title {
font-size: 14px;
margin: 5px 0px;
padding: 5px 15px;
font-weight: 600;
} }

View File

@@ -5,6 +5,5 @@
.advanced-button { .advanced-button {
width: 100px; width: 100px;
padding-right:8px;
padding-bottom: 5px; padding-bottom: 5px;
} }

View File

@@ -24,7 +24,6 @@ import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
import { NodeType } from 'sql/parts/objectExplorer/common/nodeType'; import { NodeType } from 'sql/parts/objectExplorer/common/nodeType';
import { ConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup'; import { ConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile'; import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { NewProfilerAction } from 'sql/parts/profiler/contrib/profilerActions';
import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils'; import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement'; import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { MenuId, IMenuService } from 'vs/platform/actions/common/actions'; import { MenuId, IMenuService } from 'vs/platform/actions/common/actions';
@@ -90,9 +89,11 @@ export class ServerTreeActionProvider extends ContributableActionProvider {
* Return actions for connection elements * Return actions for connection elements
*/ */
public getConnectionActions(tree: ITree, profile: ConnectionProfile): IAction[] { public getConnectionActions(tree: ITree, profile: ConnectionProfile): IAction[] {
let node = new TreeNode(NodeType.Server, '', false, '', '', '', undefined, undefined, undefined, undefined);
return this.getAllActions({ return this.getAllActions({
tree: tree, tree: tree,
profile: profile profile: profile,
treeNode: node
}, (context) => this.getBuiltinConnectionActions(context)); }, (context) => this.getBuiltinConnectionActions(context));
} }
@@ -125,10 +126,6 @@ export class ServerTreeActionProvider extends ContributableActionProvider {
actions.push(this._instantiationService.createInstance(DeleteConnectionAction, DeleteConnectionAction.ID, DeleteConnectionAction.DELETE_CONNECTION_LABEL, context.profile)); actions.push(this._instantiationService.createInstance(DeleteConnectionAction, DeleteConnectionAction.ID, DeleteConnectionAction.DELETE_CONNECTION_LABEL, context.profile));
actions.push(this._instantiationService.createInstance(RefreshAction, RefreshAction.ID, RefreshAction.LABEL, context.tree, context.profile)); actions.push(this._instantiationService.createInstance(RefreshAction, RefreshAction.ID, RefreshAction.LABEL, context.tree, context.profile));
if (process.env['VSCODE_DEV'] && constants.MssqlProviderId === context.profile.providerName) {
actions.push(this._instantiationService.createInstance(OEAction, NewProfilerAction.ID, NewProfilerAction.LABEL));
}
return actions; return actions;
} }

View File

@@ -31,8 +31,8 @@ export class TreeCreationUtils {
return new Tree(treeContainer, { dataSource, renderer, controller, dnd, filter, sorter, accessibilityProvider }, return new Tree(treeContainer, { dataSource, renderer, controller, dnd, filter, sorter, accessibilityProvider },
{ {
indentPixels: 10, indentPixels: 0,
twistiePixels: 20, twistiePixels: 0,
ariaLabel: nls.localize('treeAriaLabel', "Recent Connections") ariaLabel: nls.localize('treeAriaLabel', "Recent Connections")
}); });
} }

View File

@@ -9,7 +9,7 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement'; import { IConnectionManagementService, IConnectionDialogService} from 'sql/parts/connection/common/connectionManagement';
import { IObjectExplorerService } from '../../objectExplorer/common/objectExplorerService'; import { IObjectExplorerService } from '../../objectExplorer/common/objectExplorerService';
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput'; import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
@@ -18,6 +18,10 @@ import { IProfilerService } from '../service/interfaces';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { KeyCode, KeyMod } from 'vs/editor/editor.api'; import { KeyCode, KeyMod } from 'vs/editor/editor.api';
import { ProfilerEditor } from '../editor/profilerEditor'; import { ProfilerEditor } from '../editor/profilerEditor';
import { ObjectExplorerActionsContext } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
import { mssqlProviderName } from 'sql/parts/connection/common/constants';
// Contribute Global Actions // Contribute Global Actions
const category = nls.localize('profilerCategory', "Profiler"); const category = nls.localize('profilerCategory', "Profiler");
@@ -30,15 +34,45 @@ const newProfilerSchema: IJSONSchema = {
CommandsRegistry.registerCommand({ CommandsRegistry.registerCommand({
id: 'profiler.newProfiler', id: 'profiler.newProfiler',
handler: (accessor: ServicesAccessor) => { handler: (accessor: ServicesAccessor, ...args: any[]) => {
let editorService: IEditorService = accessor.get(IEditorService); let connectionProfile: ConnectionProfile = undefined;
let instantiationService: IInstantiationService = accessor.get(IInstantiationService); let instantiationService: IInstantiationService = accessor.get(IInstantiationService);
let editorService: IEditorService = accessor.get(IEditorService);
let connectionService: IConnectionManagementService = accessor.get(IConnectionManagementService); let connectionService: IConnectionManagementService = accessor.get(IConnectionManagementService);
let objectExplorerService: IObjectExplorerService = accessor.get(IObjectExplorerService); let objectExplorerService: IObjectExplorerService = accessor.get(IObjectExplorerService);
let connectionDialogService: IConnectionDialogService = accessor.get(IConnectionDialogService);
let capabilitiesService: ICapabilitiesService = accessor.get(ICapabilitiesService);
let connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService); // If a context is available if invoked from the context menu, we will use the connection profiler of the server node
let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile); if (args && args.length === 1 && args[0] && args[0] instanceof ObjectExplorerActionsContext) {
return editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => TPromise.as(true)); let context = args[0] as ObjectExplorerActionsContext;
connectionProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, context.connectionProfile);
}
else {
// No context available, we will try to get the current global active connection
connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService) as ConnectionProfile;
}
let promise;
if (connectionProfile) {
promise = connectionService.connectIfNotConnected(connectionProfile);
} else {
// if still no luck, we will open the Connection dialog and let user connect to a server
promise = connectionDialogService.openDialogAndWait(connectionService, { connectionType: 1, providers: [mssqlProviderName] }).then((profile) => {
connectionProfile = profile as ConnectionProfile;
});
}
return promise.then(() => {
if (!connectionProfile) {
connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService) as ConnectionProfile;
}
if (connectionProfile && connectionProfile.providerName === mssqlProviderName) {
let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile);
editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => TPromise.as(true));
}
});
} }
}); });

View File

@@ -10,7 +10,6 @@ import { IProfilerController } from 'sql/parts/profiler/editor/controller/interf
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput'; import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
import { BaseActionContext } from 'sql/workbench/common/actions'; import { BaseActionContext } from 'sql/workbench/common/actions';
import { Task } from 'sql/platform/tasks/common/tasks'; import { Task } from 'sql/platform/tasks/common/tasks';
import { ObjectExplorerActionsContext } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile'; import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { IConnectionManagementService, IConnectionCompletionOptions, ConnectionType } from 'sql/parts/connection/common/connectionManagement'; import { IConnectionManagementService, IConnectionCompletionOptions, ConnectionType } from 'sql/parts/connection/common/connectionManagement';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces'; import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
@@ -25,8 +24,11 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
export class ProfilerConnect extends Action { export class ProfilerConnect extends Action {
private static readonly ConnectText = nls.localize('profilerAction.connect', 'Connect');
private static readonly DisconnectText = nls.localize('profilerAction.disconnect', 'Disconnect');
public static ID = 'profiler.connect'; public static ID = 'profiler.connect';
public static LABEL = nls.localize('profiler.connect', "Connect"); public static LABEL = ProfilerConnect.ConnectText;
private _connected: boolean = false; private _connected: boolean = false;
@@ -59,7 +61,7 @@ export class ProfilerConnect extends Action {
public set connected(value: boolean) { public set connected(value: boolean) {
this._connected = value; this._connected = value;
this._setClass(value ? 'disconnect' : 'connect'); this._setClass(value ? 'disconnect' : 'connect');
this._setLabel(value ? nls.localize('profilerAction.disconnect', 'Disconnect') : nls.localize('profilerAction.connect', "Connect")); this._setLabel(value ? ProfilerConnect.DisconnectText : ProfilerConnect.ConnectText);
} }
public get connected(): boolean { public get connected(): boolean {
@@ -75,7 +77,7 @@ export class ProfilerStart extends Action {
id: string, label: string, id: string, label: string,
@IProfilerService private _profilerService: IProfilerService @IProfilerService private _profilerService: IProfilerService
) { ) {
super(id, label, 'start'); super(id, label, 'sql start');
} }
public run(input: ProfilerInput): TPromise<boolean> { public run(input: ProfilerInput): TPromise<boolean> {
@@ -86,7 +88,7 @@ export class ProfilerStart extends Action {
export class ProfilerCreate extends Action { export class ProfilerCreate extends Action {
public static ID = 'profiler.create'; public static ID = 'profiler.create';
public static LABEL = nls.localize('create', "Create"); public static LABEL = nls.localize('create', "New Session");
constructor( constructor(
id: string, label: string, id: string, label: string,
@@ -105,8 +107,13 @@ export class ProfilerCreate extends Action {
} }
export class ProfilerPause extends Action { export class ProfilerPause extends Action {
private static readonly PauseText = nls.localize('profilerAction.pauseCapture', 'Pause');
private static readonly ResumeText = nls.localize('profilerAction.resumeCapture', 'Resume');
private static readonly PauseCssClass = 'sql pause';
private static readonly ResumeCssClass = 'sql continue';
public static ID = 'profiler.pause'; public static ID = 'profiler.pause';
public static LABEL = nls.localize('profiler.capture', "Pause Capture"); public static LABEL = ProfilerPause.PauseText;
private _paused: boolean = false; private _paused: boolean = false;
@@ -114,7 +121,7 @@ export class ProfilerPause extends Action {
id: string, label: string, id: string, label: string,
@IProfilerService private _profilerService: IProfilerService @IProfilerService private _profilerService: IProfilerService
) { ) {
super(id, label, 'stop'); super(id, label, ProfilerPause.PauseCssClass);
} }
public run(input: ProfilerInput): TPromise<boolean> { public run(input: ProfilerInput): TPromise<boolean> {
@@ -127,8 +134,8 @@ export class ProfilerPause extends Action {
public set paused(value: boolean) { public set paused(value: boolean) {
this._paused = value; this._paused = value;
this._setClass(value ? 'start' : 'stop'); this._setClass(value ? ProfilerPause.ResumeCssClass : ProfilerPause.PauseCssClass);
this._setLabel(value ? nls.localize('profilerAction.resumeCapture', "Resume Capture") : nls.localize('profilerAction.pauseCapture', "Pause Capture")); this._setLabel(value ? ProfilerPause.ResumeText : ProfilerPause.PauseText);
} }
public get paused(): boolean { public get paused(): boolean {
@@ -144,7 +151,7 @@ export class ProfilerStop extends Action {
id: string, label: string, id: string, label: string,
@IProfilerService private _profilerService: IProfilerService @IProfilerService private _profilerService: IProfilerService
) { ) {
super(id, label, 'stop'); super(id, label, 'sql stop');
} }
public run(input: ProfilerInput): TPromise<boolean> { public run(input: ProfilerInput): TPromise<boolean> {
@@ -167,16 +174,21 @@ export class ProfilerClear extends Action {
} }
export class ProfilerAutoScroll extends Action { export class ProfilerAutoScroll extends Action {
private static readonly AutoScrollOnText = nls.localize('profilerAction.autoscrollOn', 'Auto Scroll: On');
private static readonly AutoScrollOffText = nls.localize('profilerAction.autoscrollOff', 'Auto Scroll: Off');
private static readonly CheckedCssClass = 'sql checked';
public static ID = 'profiler.autoscroll'; public static ID = 'profiler.autoscroll';
public static LABEL = nls.localize('profiler.autoscrollOn', "Auto Scroll: On"); public static LABEL = ProfilerAutoScroll.AutoScrollOnText;
constructor(id: string, label: string) { constructor(id: string, label: string) {
super(id, label); super(id, label, ProfilerAutoScroll.CheckedCssClass);
} }
run(input: ProfilerInput): TPromise<boolean> { run(input: ProfilerInput): TPromise<boolean> {
this.checked = !this.checked; this.checked = !this.checked;
this._setLabel(this.checked ? nls.localize('profilerAction.autoscrollOn', "Auto Scroll: On") : nls.localize('profilerAction.autoscrollOff', "Auto Scroll: Off")); this._setLabel(this.checked ? ProfilerAutoScroll.AutoScrollOnText : ProfilerAutoScroll.AutoScrollOffText);
this._setClass(this.checked ? ProfilerAutoScroll.CheckedCssClass : '');
input.state.change({ autoscroll: this.checked }); input.state.change({ autoscroll: this.checked });
return TPromise.as(true); return TPromise.as(true);
} }
@@ -256,7 +268,7 @@ export class ProfilerFindPrevious implements IEditorAction {
export class NewProfilerAction extends Task { export class NewProfilerAction extends Task {
public static readonly ID = 'profiler.newProfiler'; public static readonly ID = 'profiler.newProfiler';
public static readonly LABEL = nls.localize('profilerAction.newProfiler', 'New Profiler'); public static readonly LABEL = nls.localize('profilerAction.newProfiler', 'Launch Profiler');
public static readonly ICON = 'profile'; public static readonly ICON = 'profile';
private _connectionProfile: ConnectionProfile; private _connectionProfile: ConnectionProfile;

View File

@@ -1,52 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
export class GlobalNewProfilerAction extends Action {
public static ID = 'explorer.newProfiler';
public static LABEL = nls.localize('profilerWorkbenchAction.newProfiler', "New Profiler");
constructor(
id: string, label: string,
@IEditorService private _editorService: IEditorService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IConnectionManagementService private _connectionService: IConnectionManagementService
) {
super(id, label);
}
run(context?: any): TPromise<boolean> {
// TODO: for test-only, grab the first MSSQL active connection for the profiler session
// TODO: when finishing the feature the connection should come from the launch context
let connectionProfile: IConnectionProfile;
if (context && context.connectionProfile) {
connectionProfile = context.connectionProfile;
} else {
let activeConnections = this._connectionService.getActiveConnections();
if (activeConnections) {
for (let i = 0; i < activeConnections.length; ++i) {
if (activeConnections[i].providerName === 'MSSQL') {
connectionProfile = activeConnections[i];
break;
}
}
}
}
let profilerInput = this._instantiationService.createInstance(ProfilerInput, connectionProfile);
return this._editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => TPromise.as(true));
}
}

View File

@@ -122,7 +122,6 @@ export class ProfilerEditor extends BaseEditor {
private _viewTemplates: Array<IProfilerViewTemplate>; private _viewTemplates: Array<IProfilerViewTemplate>;
private _sessionSelector: SelectBox; private _sessionSelector: SelectBox;
private _sessionsList: Array<string>; private _sessionsList: Array<string>;
private _connectionInfoText: HTMLElement;
// Actions // Actions
private _connectAction: Actions.ProfilerConnect; private _connectAction: Actions.ProfilerConnect;
@@ -211,6 +210,7 @@ export class ProfilerEditor extends BaseEditor {
this._viewTemplates = this._profilerService.getViewTemplates(); this._viewTemplates = this._profilerService.getViewTemplates();
this._viewTemplateSelector = new SelectBox(this._viewTemplates.map(i => i.name), 'Standard View', this._contextViewService); this._viewTemplateSelector = new SelectBox(this._viewTemplates.map(i => i.name), 'Standard View', this._contextViewService);
this._viewTemplateSelector.setAriaLabel(nls.localize('profiler.viewSelectAccessibleName', 'Select View'));
this._register(this._viewTemplateSelector.onDidSelect(e => { this._register(this._viewTemplateSelector.onDidSelect(e => {
if (this.input) { if (this.input) {
this.input.viewTemplate = this._viewTemplates.find(i => i.name === e.selected); this.input.viewTemplate = this._viewTemplates.find(i => i.name === e.selected);
@@ -223,6 +223,7 @@ export class ProfilerEditor extends BaseEditor {
this._sessionsList = ['']; this._sessionsList = [''];
this._sessionSelector = new SelectBox(this._sessionsList, '', this._contextViewService); this._sessionSelector = new SelectBox(this._sessionsList, '', this._contextViewService);
this._sessionSelector.setAriaLabel(nls.localize('profiler.sessionSelectAccessibleName', 'Select Session'));
this._register(this._sessionSelector.onDidSelect(e => { this._register(this._sessionSelector.onDidSelect(e => {
if (this.input) { if (this.input) {
this.input.sessionName = e.selected; this.input.sessionName = e.selected;
@@ -233,32 +234,36 @@ export class ProfilerEditor extends BaseEditor {
sessionsContainer.style.paddingRight = '5px'; sessionsContainer.style.paddingRight = '5px';
this._sessionSelector.render(sessionsContainer); this._sessionSelector.render(sessionsContainer);
this._connectionInfoText = document.createElement('div');
this._connectionInfoText.style.paddingRight = '5px';
this._connectionInfoText.innerText = '';
this._connectionInfoText.style.textAlign = 'center';
this._connectionInfoText.style.display = 'flex';
this._connectionInfoText.style.alignItems = 'center';
this._register(attachSelectBoxStyler(this._viewTemplateSelector, this.themeService)); this._register(attachSelectBoxStyler(this._viewTemplateSelector, this.themeService));
this._register(attachSelectBoxStyler(this._sessionSelector, this.themeService)); this._register(attachSelectBoxStyler(this._sessionSelector, this.themeService));
this._actionBar.setContent([ this._actionBar.setContent([
{ action: this._startAction },
{ action: this._stopAction },
{ element: sessionsContainer },
{ action: this._createAction }, { action: this._createAction },
{ element: Taskbar.createTaskbarSeparator() }, { element: Taskbar.createTaskbarSeparator() },
{ element: this._createTextElement(nls.localize('profiler.sessionSelectLabel', 'Select Session:')) },
{ element: sessionsContainer },
{ action: this._startAction },
{ action: this._stopAction },
{ action: this._pauseAction }, { action: this._pauseAction },
{ action: this._autoscrollAction },
{ action: this._instantiationService.createInstance(Actions.ProfilerClear, Actions.ProfilerClear.ID, Actions.ProfilerClear.LABEL) },
{ element: Taskbar.createTaskbarSeparator() }, { element: Taskbar.createTaskbarSeparator() },
{ element: this._createTextElement(nls.localize('profiler.viewSelectLabel', 'Select View:')) },
{ element: viewTemplateContainer }, { element: viewTemplateContainer },
{ element: Taskbar.createTaskbarSeparator() }, { element: Taskbar.createTaskbarSeparator() },
{ element: this._connectionInfoText } { action: this._autoscrollAction },
{ action: this._instantiationService.createInstance(Actions.ProfilerClear, Actions.ProfilerClear.ID, Actions.ProfilerClear.LABEL) }
]); ]);
} }
private _createTextElement(text: string): HTMLDivElement {
let textElement = document.createElement('div');
textElement.style.paddingRight = '10px';
textElement.innerText = text;
textElement.style.textAlign = 'center';
textElement.style.display = 'flex';
textElement.style.alignItems = 'center';
return textElement;
}
private _createProfilerTable(): HTMLElement { private _createProfilerTable(): HTMLElement {
let profilerTableContainer = document.createElement('div'); let profilerTableContainer = document.createElement('div');
profilerTableContainer.className = 'profiler-table monaco-editor'; profilerTableContainer.className = 'profiler-table monaco-editor';
@@ -417,7 +422,6 @@ export class ProfilerEditor extends BaseEditor {
autoscroll: true, autoscroll: true,
isPanelCollapsed: true isPanelCollapsed: true
}); });
this._connectionInfoText.innerText = input.connectionName;
this._profilerTableEditor.updateState(); this._profilerTableEditor.updateState();
this._splitView.layout(); this._splitView.layout();
this._profilerTableEditor.focus(); this._profilerTableEditor.focus();
@@ -464,34 +468,16 @@ export class ProfilerEditor extends BaseEditor {
this._connectAction.connected = this.input.state.isConnected; this._connectAction.connected = this.input.state.isConnected;
if (this.input.state.isConnected) { if (this.input.state.isConnected) {
this._updateToolbar(); this._updateToolbar();
this._sessionSelector.enable();
this._profilerService.getXEventSessions(this.input.id).then((r) => {
// set undefined result to empty list
if (!r) {
r = [];
}
this._sessionSelector.setOptions(r); // Launch the create session dialog if openning a new window.
this._sessionsList = r; let uiState = this._profilerService.getSessionViewState(this.input.id);
if ((this.input.sessionName === undefined || this.input.sessionName === '') && this._sessionsList.length > 0) { let previousSessionName = uiState && uiState.previousSessionName;
let sessionIndex: number = 0; if (!this.input.sessionName && !previousSessionName) {
let uiState = this._profilerService.getSessionViewState(this.input.id); this._profilerService.launchCreateSessionDialog(this.input);
if (uiState && uiState.previousSessionName) { }
sessionIndex = this._sessionsList.indexOf(uiState.previousSessionName);
} else {
this._profilerService.launchCreateSessionDialog(this.input);
}
if (sessionIndex < 0) { this._updateSessionSelector(previousSessionName);
sessionIndex = 0;
}
this.input.sessionName = this._sessionsList[sessionIndex];
this._sessionSelector.selectWithOptionName(this.input.sessionName);
}
});
} else { } else {
this._startAction.enabled = false; this._startAction.enabled = false;
this._stopAction.enabled = false; this._stopAction.enabled = false;
@@ -517,23 +503,35 @@ export class ProfilerEditor extends BaseEditor {
} }
if (this.input.state.isStopped) { if (this.input.state.isStopped) {
this._updateToolbar(); this._updateToolbar();
this._sessionSelector.enable(); this._updateSessionSelector();
this._profilerService.getXEventSessions(this.input.id).then((r) => {
// set undefined result to empty list
if (!r) {
r = [];
}
this._sessionsList = r;
this._sessionSelector.setOptions(r);
if ((this.input.sessionName === undefined || this.input.sessionName === '') && this._sessionsList.length > 0) {
this.input.sessionName = this._sessionsList[0];
}
});
} }
} }
} }
private _updateSessionSelector(previousSessionName: string = undefined) {
this._sessionSelector.enable();
this._profilerService.getXEventSessions(this.input.id).then((r) => {
if (!r) {
r = [];
}
this._sessionSelector.setOptions(r);
this._sessionsList = r;
if (this._sessionsList.length > 0) {
if (!this.input.sessionName) {
this.input.sessionName = previousSessionName;
}
if (this._sessionsList.indexOf(this.input.sessionName) === -1) {
this.input.sessionName = this._sessionsList[0];
}
this._sessionSelector.selectWithOptionName(this.input.sessionName);
};
});
}
private _updateToolbar(): void { private _updateToolbar(): void {
this._startAction.enabled = !this.input.state.isRunning && !this.input.state.isPaused && this.input.state.isConnected; this._startAction.enabled = !this.input.state.isRunning && !this.input.state.isPaused && this.input.state.isConnected;
this._createAction.enabled = !this.input.state.isRunning && !this.input.state.isPaused && this.input.state.isConnected; this._createAction.enabled = !this.input.state.isRunning && !this.input.state.isPaused && this.input.state.isConnected;

View File

@@ -12,7 +12,7 @@ import * as sqlops from 'sqlops';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { EditorInput } from 'vs/workbench/common/editor'; import { EditorInput, ConfirmResult } from 'vs/workbench/common/editor';
import { IEditorModel } from 'vs/platform/editor/common/editor'; import { IEditorModel } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
@@ -22,6 +22,7 @@ import { IDialogService, IConfirmation, IConfirmationResult } from 'vs/platform/
import { escape } from 'sql/base/common/strings'; import { escape } from 'sql/base/common/strings';
import * as types from 'vs/base/common/types'; import * as types from 'vs/base/common/types';
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
export class ProfilerInput extends EditorInput implements IProfilerSession { export class ProfilerInput extends EditorInput implements IProfilerSession {
@@ -41,7 +42,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
public onColumnsChanged: Event<Slick.Column<Slick.SlickData>[]> = this._onColumnsChanged.event; public onColumnsChanged: Event<Slick.Column<Slick.SlickData>[]> = this._onColumnsChanged.event;
constructor( constructor(
private _connection: IConnectionProfile, public connection: IConnectionProfile,
@IInstantiationService private _instantiationService: IInstantiationService, @IInstantiationService private _instantiationService: IInstantiationService,
@IProfilerService private _profilerService: IProfilerService, @IProfilerService private _profilerService: IProfilerService,
@INotificationService private _notificationService: INotificationService, @INotificationService private _notificationService: INotificationService,
@@ -58,7 +59,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
autoscroll: true autoscroll: true
}); });
this._profilerService.registerSession(generateUuid(), _connection, this).then((id) => { this._profilerService.registerSession(generateUuid(), connection, this).then((id) => {
this._id = id; this._id = id;
this.state.change({ isConnected: true }); this.state.change({ isConnected: true });
}); });
@@ -72,23 +73,10 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
return ret; return ret;
}; };
this._data = new TableDataView<Slick.SlickData>(undefined, searchFn); this._data = new TableDataView<Slick.SlickData>(undefined, searchFn);
}
this.onDispose(() => { public get providerType(): string {
if (this._state.isRunning || this.state.isPaused) { return this.connection ? this.connection.providerName : undefined;
let confirm: IConfirmation = {
message: nls.localize('confirmStopProfilerSession', "Would you like to stop the running XEvent session?"),
primaryButton: nls.localize('profilerClosingActions.yes', 'Yes'),
secondaryButton: nls.localize('profilerClosingActions.no', 'No'),
type: 'question'
};
this._dialogService.confirm(confirm).then(result => {
if (result.confirmed) {
this._profilerService.stopSession(this.id);
}
});
}
});
} }
public set viewTemplate(template: IProfilerViewTemplate) { public set viewTemplate(template: IProfilerViewTemplate) {
@@ -114,7 +102,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
} }
public set sessionName(name: string) { public set sessionName(name: string) {
if (!this._state.isRunning || !this.state.isPaused) { if (!this.state.isRunning || !this.state.isPaused) {
this._sessionName = name; this._sessionName = name;
} }
} }
@@ -133,10 +121,10 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
public getName(): string { public getName(): string {
let name: string = nls.localize('profilerInput.profiler', 'Profiler'); let name: string = nls.localize('profilerInput.profiler', 'Profiler');
if (!this._connection) { if (!this.connection) {
return name; return name;
} }
name += ': ' + this._connection.serverName.substring(0, 20); name += ': ' + this.connection.serverName.substring(0, 20);
return name; return name;
} }
@@ -178,11 +166,11 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
} }
public get connectionName(): string { public get connectionName(): string {
if (!types.isUndefinedOrNull(this._connection)) { if (!types.isUndefinedOrNull(this.connection)) {
if (this._connection.databaseName) { if (this.connection.databaseName) {
return `${this._connection.serverName} ${this._connection.databaseName}`; return `${this.connection.serverName} ${this.connection.databaseName}`;
} else { } else {
return `${this._connection.serverName}`; return `${this.connection.serverName}`;
} }
} }
else { else {
@@ -199,7 +187,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
} }
public onSessionStopped(notification: sqlops.ProfilerSessionStoppedParams) { public onSessionStopped(notification: sqlops.ProfilerSessionStoppedParams) {
this._notificationService.error(nls.localize("profiler.sessionStopped", "XEvent Profiler Session stopped unexpectedly on the server {0}.", this._connection.serverName)); this._notificationService.error(nls.localize("profiler.sessionStopped", "XEvent Profiler Session stopped unexpectedly on the server {0}.", this.connection.serverName));
this.state.change({ this.state.change({
isStopped: true, isStopped: true,
@@ -240,7 +228,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
public onMoreRows(eventMessage: sqlops.ProfilerSessionEvents) { public onMoreRows(eventMessage: sqlops.ProfilerSessionEvents) {
if (eventMessage.eventsLost) { if (eventMessage.eventsLost) {
this._notificationService.warn(nls.localize("profiler.eventsLost", "The XEvent Profiler session for {0} has lost events.", this._connection.serverName)); this._notificationService.warn(nls.localize("profiler.eventsLost", "The XEvent Profiler session for {0} has lost events.", this.connection.serverName));
} }
for (let i: number = 0; i < eventMessage.events.length && i < 500; ++i) { for (let i: number = 0; i < eventMessage.events.length && i < 500; ++i) {
@@ -264,4 +252,31 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
} }
} }
confirmSave(): TPromise<ConfirmResult> {
if (this.state.isRunning || this.state.isPaused) {
return this._dialogService.show(Severity.Warning,
nls.localize('confirmStopProfilerSession', "Would you like to stop the running XEvent session?"),
[
nls.localize('profilerClosingActions.yes', 'Yes'),
nls.localize('profilerClosingActions.no', 'No'),
nls.localize('profilerClosingActions.cancel', 'Cancel')
]).then((selection: number) => {
if (selection === 0) {
this._profilerService.stopSession(this.id);
return ConfirmResult.DONT_SAVE;
} else if (selection === 1) {
return ConfirmResult.DONT_SAVE;
} else {
return ConfirmResult.CANCEL;
}
});;
} else {
return TPromise.wrap(ConfirmResult.DONT_SAVE);
}
}
isDirty(): boolean {
return this.state.isRunning || this.state.isPaused;
}
} }

View File

@@ -141,7 +141,10 @@ export class ProfilerService implements IProfilerService {
this._sessionMap.get(this._idMap.reverseGet(id)).onSessionStateChanged({ isStopped: true, isPaused: false, isRunning: false }); this._sessionMap.get(this._idMap.reverseGet(id)).onSessionStateChanged({ isStopped: true, isPaused: false, isRunning: false });
return true; return true;
}, (reason) => { }, (reason) => {
this._notificationService.error(reason.message); // The error won't be actionable to the user, so only log it to console.
// In case of error, the state of the UI is not usable, makes more sense to
// set it to stopped so that user can restart it or pick a different session
this._sessionMap.get(this._idMap.reverseGet(id)).onSessionStateChanged({ isStopped: true, isPaused: false, isRunning: false });
}); });
} }
@@ -228,6 +231,6 @@ export class ProfilerService implements IProfilerService {
} }
public launchCreateSessionDialog(input?: ProfilerInput): Thenable<void> { public launchCreateSessionDialog(input?: ProfilerInput): Thenable<void> {
return this._commandService.executeCommand('profiler.openCreateSessionDialog', input.id, this.getSessionTemplates()); return this._commandService.executeCommand('profiler.openCreateSessionDialog', input.id, input.providerType, this.getSessionTemplates());
} }
} }

View File

@@ -339,7 +339,7 @@ let registryProperties = {
'sql.showConnectionInfoInTitle': { 'sql.showConnectionInfoInTitle': {
'type': 'boolean', 'type': 'boolean',
'description': localize('showConnectionInfoInTitle', "Controls whether to show the connection info for a tab in the title."), 'description': localize('showConnectionInfoInTitle', "Controls whether to show the connection info for a tab in the title."),
'default': false 'default': true
}, },
'mssql.intelliSense.enableIntelliSense': { 'mssql.intelliSense.enableIntelliSense': {
'type': 'boolean', 'type': 'boolean',

View File

@@ -32,9 +32,6 @@ export interface IQueryEditorService {
// Creates new edit data session // Creates new edit data session
newEditDataEditor(schemaName: string, tableName: string, queryString: string): Promise<IConnectableInput>; newEditDataEditor(schemaName: string, tableName: string, queryString: string): Promise<IConnectableInput>;
// Clears any QueryEditor data for the given URI held by this service
onQueryInputClosed(uri: string): void;
/** /**
* Handles updating of SQL files on a save as event. These need special consideration * Handles updating of SQL files on a save as event. These need special consideration
* due to query results and other information being tied to the URI of the file * due to query results and other information being tied to the URI of the file

View File

@@ -116,11 +116,11 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
} }
if (this._configurationService) { if (this._configurationService) {
this._configurationService.onDidChangeConfiguration(e => { this._toDispose.push(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectedKeys.includes('sql.showConnectionInfoInTitle')) { if (e.affectedKeys.includes('sql.showConnectionInfoInTitle')) {
this._onDidChangeLabel.fire(); this._onDidChangeLabel.fire();
} }
}); }));
} }
this.onDisconnect(); this.onDisconnect();
@@ -196,17 +196,17 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
// State update funtions // State update funtions
public runQuery(selection: ISelectionData, executePlanOptions?: ExecutionPlanOptions): void { public runQuery(selection: ISelectionData, executePlanOptions?: ExecutionPlanOptions): void {
this._queryModelService.runQuery(this.uri, selection, this.uri, this, executePlanOptions); this._queryModelService.runQuery(this.uri, selection, this, executePlanOptions);
this.showQueryResultsEditor(); this.showQueryResultsEditor();
} }
public runQueryStatement(selection: ISelectionData): void { public runQueryStatement(selection: ISelectionData): void {
this._queryModelService.runQueryStatement(this.uri, selection, this.uri, this); this._queryModelService.runQueryStatement(this.uri, selection, this);
this.showQueryResultsEditor(); this.showQueryResultsEditor();
} }
public runQueryString(text: string): void { public runQueryString(text: string): void {
this._queryModelService.runQueryString(this.uri, text, this.uri, this); this._queryModelService.runQueryString(this.uri, text, this);
this.showQueryResultsEditor(); this.showQueryResultsEditor();
} }
@@ -276,7 +276,6 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
// Clean up functions // Clean up functions
public dispose(): void { public dispose(): void {
this._queryModelService.disposeQuery(this.uri);
this._sql.dispose(); this._sql.dispose();
this._results.dispose(); this._results.dispose();
this._toDispose = dispose(this._toDispose); this._toDispose = dispose(this._toDispose);
@@ -285,7 +284,7 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
} }
public close(): void { public close(): void {
this._queryEditorService.onQueryInputClosed(this.uri); this._queryModelService.disposeQuery(this.uri);
this._connectionManagementService.disconnectEditor(this, true); this._connectionManagementService.disconnectEditor(this, true);
this._sql.close(); this._sql.close();

View File

@@ -215,6 +215,7 @@ export class QueryManagementService implements IQueryManagementService {
}); });
} }
public disposeQuery(ownerUri: string): Thenable<void> { public disposeQuery(ownerUri: string): Thenable<void> {
this._queryRunners.delete(ownerUri);
return this._runAction(ownerUri, (runner) => { return this._runAction(ownerUri, (runner) => {
return runner.disposeQuery(ownerUri); return runner.disposeQuery(ownerUri);
}); });

View File

@@ -29,6 +29,13 @@ export class ResultsViewState {
constructor(@IConfigurationService private configurationService: IConfigurationService) { constructor(@IConfigurationService private configurationService: IConfigurationService) {
} }
dispose() {
this.gridPanelState.dispose();
this.messagePanelState.dispose();
this.chartState.dispose();
this.queryPlanState.dispose();
}
} }
/** /**
@@ -50,7 +57,11 @@ export class QueryResultsInput extends EditorInput {
public readonly onRestoreViewStateEmitter = new Emitter<void>(); public readonly onRestoreViewStateEmitter = new Emitter<void>();
public readonly onSaveViewStateEmitter = new Emitter<void>(); public readonly onSaveViewStateEmitter = new Emitter<void>();
public readonly state = new ResultsViewState(this.configurationService); private _state = new ResultsViewState(this.configurationService);
public get state(): ResultsViewState {
return this._state;
}
constructor(private _uri: string, constructor(private _uri: string,
@IConfigurationService private configurationService: IConfigurationService @IConfigurationService private configurationService: IConfigurationService
@@ -60,6 +71,12 @@ export class QueryResultsInput extends EditorInput {
this._hasBootstrapped = false; this._hasBootstrapped = false;
} }
close() {
this.state.dispose();
this._state = undefined;
super.close();
}
getTypeId(): string { getTypeId(): string {
return QueryResultsInput.ID; return QueryResultsInput.ID;
} }

View File

@@ -33,4 +33,8 @@ export class ChartTab implements IPanelTab {
public dispose() { public dispose() {
this.view.dispose(); this.view.dispose();
} }
public clear() {
this.view.clear();
}
} }

View File

@@ -35,6 +35,10 @@ export class ChartState {
options: IInsightOptions = { options: IInsightOptions = {
type: ChartType.Bar type: ChartType.Bar
}; };
dispose() {
}
} }
declare class Proxy { declare class Proxy {
@@ -134,6 +138,15 @@ export class ChartView extends Disposable implements IPanelView {
this.buildOptions(); this.buildOptions();
} }
public clear() {
}
public dispose() {
dispose(this.optionDisposables);
super.dispose();
}
render(container: HTMLElement): void { render(container: HTMLElement): void {
if (!this.container) { if (!this.container) {
this.container = $('div.chart-parent-container'); this.container = $('div.chart-parent-container');

View File

@@ -7,7 +7,7 @@
import { attachTableStyler } from 'sql/common/theme/styler'; import { attachTableStyler } from 'sql/common/theme/styler';
import QueryRunner from 'sql/parts/query/execution/queryRunner'; import QueryRunner from 'sql/parts/query/execution/queryRunner';
import { VirtualizedCollection, AsyncDataProvider } from 'sql/base/browser/ui/table/asyncDataView'; import { VirtualizedCollection, AsyncDataProvider } from 'sql/base/browser/ui/table/asyncDataView';
import { Table, ITableStyles, ITableMouseEvent } from 'sql/base/browser/ui/table/table'; import { Table } from 'sql/base/browser/ui/table/table';
import { ScrollableSplitView } from 'sql/base/browser/ui/scrollableSplitview/scrollableSplitview'; import { ScrollableSplitView } from 'sql/base/browser/ui/scrollableSplitview/scrollableSplitview';
import { MouseWheelSupport } from 'sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin'; import { MouseWheelSupport } from 'sql/base/browser/ui/table/plugins/mousewheelTableScroll.plugin';
import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin'; import { AutoColumnSize } from 'sql/base/browser/ui/table/plugins/autoSizeColumns.plugin';
@@ -19,6 +19,7 @@ import { escape } from 'sql/base/common/strings';
import { hyperLinkFormatter, textFormatter } from 'sql/parts/grid/services/sharedServices'; import { hyperLinkFormatter, textFormatter } from 'sql/parts/grid/services/sharedServices';
import { CopyKeybind } from 'sql/base/browser/ui/table/plugins/copyKeybind.plugin'; import { CopyKeybind } from 'sql/base/browser/ui/table/plugins/copyKeybind.plugin';
import { AdditionalKeyBindings } from 'sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin'; import { AdditionalKeyBindings } from 'sql/base/browser/ui/table/plugins/additionalKeyBindings.plugin';
import { ITableStyles, ITableMouseEvent } from 'sql/base/browser/ui/table/interfaces';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import * as pretty from 'pretty-data'; import * as pretty from 'pretty-data';
@@ -61,6 +62,10 @@ export class GridPanelState {
public tableStates: GridTableState[] = []; public tableStates: GridTableState[] = [];
public scrollPosition: number; public scrollPosition: number;
public collapsed = false; public collapsed = false;
dispose() {
dispose(this.tableStates);
}
} }
export interface IGridTableState { export interface IGridTableState {
@@ -68,14 +73,14 @@ export interface IGridTableState {
maximized: boolean; maximized: boolean;
} }
export class GridTableState { export class GridTableState extends Disposable {
private _maximized: boolean; private _maximized: boolean;
private _onMaximizedChange = new Emitter<boolean>(); private _onMaximizedChange = this._register(new Emitter<boolean>());
public onMaximizedChange: Event<boolean> = this._onMaximizedChange.event; public onMaximizedChange: Event<boolean> = this._onMaximizedChange.event;
private _onCanBeMaximizedChange = new Emitter<boolean>(); private _onCanBeMaximizedChange = this._register(new Emitter<boolean>());
public onCanBeMaximizedChange: Event<boolean> = this._onCanBeMaximizedChange.event; public onCanBeMaximizedChange: Event<boolean> = this._onCanBeMaximizedChange.event;
private _canBeMaximized: boolean; private _canBeMaximized: boolean;
@@ -86,6 +91,7 @@ export class GridTableState {
public activeCell: Slick.Cell; public activeCell: Slick.Cell;
constructor(public readonly resultId: number, public readonly batchId: number) { constructor(public readonly resultId: number, public readonly batchId: number) {
super();
} }
public get canBeMaximized(): boolean { public get canBeMaximized(): boolean {
@@ -217,13 +223,13 @@ export class GridPanel extends ViewletPanel {
} }
let table = this.instantiationService.createInstance(GridTable, this.runner, set); let table = this.instantiationService.createInstance(GridTable, this.runner, set);
table.state = tableState; table.state = tableState;
tableState.onMaximizedChange(e => { this.tableDisposable.push(tableState.onMaximizedChange(e => {
if (e) { if (e) {
this.maximizeTable(table.id); this.maximizeTable(table.id);
} else { } else {
this.minimizeTables(); this.minimizeTables();
} }
}); }));
this.tableDisposable.push(attachTableStyler(table, this.themeService)); this.tableDisposable.push(attachTableStyler(table, this.themeService));
tables.push(table); tables.push(table);
@@ -238,11 +244,17 @@ export class GridPanel extends ViewletPanel {
this.tables = this.tables.concat(tables); this.tables = this.tables.concat(tables);
} }
public clear() {
this.reset();
}
private reset() { private reset() {
for (let i = this.splitView.length - 1; i >= 0; i--) { for (let i = this.splitView.length - 1; i >= 0; i--) {
this.splitView.removeView(i); this.splitView.removeView(i);
} }
dispose(this.tables); dispose(this.tables);
dispose(this.tableDisposable);
this.tableDisposable = [];
this.tables = []; this.tables = [];
this.maximizedGrid = undefined; this.maximizedGrid = undefined;
@@ -293,6 +305,15 @@ export class GridPanel extends ViewletPanel {
public get state(): GridPanelState { public get state(): GridPanelState {
return this._state; return this._state;
} }
public dispose() {
dispose(this.queryRunnerDisposables);
dispose(this.tableDisposable);
dispose(this.tables);
this.tableDisposable = undefined;
this.tables = undefined;
super.dispose();
}
} }
class GridTable<T> extends Disposable implements IView { class GridTable<T> extends Disposable implements IView {
@@ -444,9 +465,9 @@ class GridTable<T> extends Disposable implements IView {
private setupState() { private setupState() {
// change actionbar on maximize change // change actionbar on maximize change
this.state.onMaximizedChange(this.rebuildActionBar, this); this._register(this.state.onMaximizedChange(this.rebuildActionBar, this));
this.state.onCanBeMaximizedChange(this.rebuildActionBar, this); this._register(this.state.onCanBeMaximizedChange(this.rebuildActionBar, this));
if (this.state.scrollPosition) { if (this.state.scrollPosition) {
// most of the time this won't do anything // most of the time this won't do anything
@@ -656,6 +677,8 @@ class GridTable<T> extends Disposable implements IView {
public dispose() { public dispose() {
$(this.container).destroy(); $(this.container).destroy();
this.table.dispose();
this.actionBar.dispose();
super.dispose(); super.dispose();
} }
} }

View File

@@ -7,6 +7,7 @@
import 'vs/css!./media/messagePanel'; import 'vs/css!./media/messagePanel';
import { IMessagesActionContext, SelectAllMessagesAction, CopyMessagesAction } from './actions'; import { IMessagesActionContext, SelectAllMessagesAction, CopyMessagesAction } from './actions';
import QueryRunner from 'sql/parts/query/execution/queryRunner'; import QueryRunner from 'sql/parts/query/execution/queryRunner';
import { QueryInput } from 'sql/parts/query/common/queryInput';
import { IResultMessage, ISelectionData } from 'sqlops'; import { IResultMessage, ISelectionData } from 'sqlops';
@@ -28,8 +29,6 @@ import { $ } from 'vs/base/browser/builder';
import { isArray, isUndefinedOrNull } from 'vs/base/common/types'; import { isArray, isUndefinedOrNull } from 'vs/base/common/types';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditor } from 'vs/editor/common/editorCommon';
import { QueryInput } from 'sql/parts/query/common/queryInput';
import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { ScrollbarVisibility } from 'vs/base/common/scrollable';
export interface IResultMessageIntern extends IResultMessage { export interface IResultMessageIntern extends IResultMessage {
@@ -71,6 +70,10 @@ export class MessagePanelState {
this.collapsed = !messagesOpenedSettings; this.collapsed = !messagesOpenedSettings;
} }
} }
dispose() {
}
} }
export class MessagePanel extends ViewletPanel { export class MessagePanel extends ViewletPanel {
@@ -102,6 +105,7 @@ export class MessagePanel extends ViewletPanel {
renderer: this.renderer, renderer: this.renderer,
controller: this.controller controller: this.controller
}, { keyboardSupport: false, horizontalScrollMode: ScrollbarVisibility.Auto }); }, { keyboardSupport: false, horizontalScrollMode: ScrollbarVisibility.Auto });
this.disposables.push(this.tree);
this.tree.onDidScroll(e => { this.tree.onDidScroll(e => {
if (this.state) { if (this.state) {
this.state.scrollPosition = this.tree.getScrollPosition(); this.state.scrollPosition = this.tree.getScrollPosition();
@@ -117,7 +121,7 @@ export class MessagePanel extends ViewletPanel {
protected renderBody(container: HTMLElement): void { protected renderBody(container: HTMLElement): void {
this.container.style.width = '100%'; this.container.style.width = '100%';
this.container.style.height = '100%'; this.container.style.height = '100%';
attachListStyler(this.tree, this.themeService); this.disposables.push(attachListStyler(this.tree, this.themeService));
container.appendChild(this.container); container.appendChild(this.container);
this.tree.setInput(this.model); this.tree.setInput(this.model);
} }
@@ -193,9 +197,19 @@ export class MessagePanel extends ViewletPanel {
} }
this.setExpanded(!this.state.collapsed); this.setExpanded(!this.state.collapsed);
} }
public get state(): MessagePanelState { public get state(): MessagePanelState {
return this._state; return this._state;
} }
public clear() {
this.reset();
}
public dispose() {
dispose(this.queryRunnerDisposables);
super.dispose();
}
} }
class MessageDataSource implements IDataSource { class MessageDataSource implements IDataSource {

View File

@@ -478,11 +478,11 @@ export class QueryEditor extends BaseEditor {
this.setTaskbarContent(); this.setTaskbarContent();
this._configurationService.onDidChangeConfiguration(e => { this._toDispose.push(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectedKeys.includes('workbench.enablePreviewFeatures')) { if (e.affectedKeys.includes('workbench.enablePreviewFeatures')) {
this.setTaskbarContent(); this.setTaskbarContent();
} }
}); }));
} }
private setTaskbarContent(): void { private setTaskbarContent(): void {

View File

@@ -90,7 +90,6 @@ export class QueryResultsEditor extends BaseEditor {
public static ID: string = 'workbench.editor.queryResultsEditor'; public static ID: string = 'workbench.editor.queryResultsEditor';
public static AngularSelectorString: string = 'slickgrid-container.slickgridContainer'; public static AngularSelectorString: string = 'slickgrid-container.slickgridContainer';
protected _rawOptions: BareResultsGridInfo; protected _rawOptions: BareResultsGridInfo;
protected _input: QueryResultsInput;
private resultsView: QueryResultsView; private resultsView: QueryResultsView;
private styleSheet = DOM.createStyleSheet(); private styleSheet = DOM.createStyleSheet();
@@ -104,17 +103,17 @@ export class QueryResultsEditor extends BaseEditor {
) { ) {
super(QueryResultsEditor.ID, telemetryService, themeService); super(QueryResultsEditor.ID, telemetryService, themeService);
this._rawOptions = BareResultsGridInfo.createFromRawSettings(this._configurationService.getValue('resultsGrid'), getZoomLevel()); this._rawOptions = BareResultsGridInfo.createFromRawSettings(this._configurationService.getValue('resultsGrid'), getZoomLevel());
this._configurationService.onDidChangeConfiguration(e => { this._register(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('resultsGrid')) { if (e.affectsConfiguration('resultsGrid')) {
this._rawOptions = BareResultsGridInfo.createFromRawSettings(this._configurationService.getValue('resultsGrid'), getZoomLevel()); this._rawOptions = BareResultsGridInfo.createFromRawSettings(this._configurationService.getValue('resultsGrid'), getZoomLevel());
this.applySettings(); this.applySettings();
} }
}); }));
this.applySettings(); this.applySettings();
} }
public get input(): QueryResultsInput { public get input(): QueryResultsInput {
return this._input; return this._input as QueryResultsInput;
} }
private applySettings() { private applySettings() {
@@ -133,10 +132,16 @@ export class QueryResultsEditor extends BaseEditor {
this.styleSheet.remove(); this.styleSheet.remove();
parent.appendChild(this.styleSheet); parent.appendChild(this.styleSheet);
if (!this.resultsView) { if (!this.resultsView) {
this.resultsView = new QueryResultsView(parent, this._instantiationService, this._queryModelService); this.resultsView = this._register(new QueryResultsView(parent, this._instantiationService, this._queryModelService));
} }
} }
dispose() {
this.styleSheet.remove();
this.styleSheet = undefined;
super.dispose();
}
layout(dimension: DOM.Dimension): void { layout(dimension: DOM.Dimension): void {
this.resultsView.layout(dimension); this.resultsView.layout(dimension);
} }
@@ -147,6 +152,11 @@ export class QueryResultsEditor extends BaseEditor {
return TPromise.wrap<void>(null); return TPromise.wrap<void>(null);
} }
clearInput() {
this.resultsView.clearInput();
super.clearInput();
}
public chart(dataId: { batchId: number, resultId: number }) { public chart(dataId: { batchId: number, resultId: number }) {
this.resultsView.chartData(dataId); this.resultsView.chartData(dataId);
} }
@@ -154,11 +164,4 @@ export class QueryResultsEditor extends BaseEditor {
public showQueryPlan(xml: string) { public showQueryPlan(xml: string) {
this.resultsView.showPlan(xml); this.resultsView.showPlan(xml);
} }
public dispose(): void {
super.dispose();
if (this.resultsView) {
this.resultsView.dispose();
}
}
} }

View File

@@ -111,6 +111,15 @@ class ResultsView extends Disposable implements IPanelView {
} }
} }
dispose() {
super.dispose();
}
public clear() {
this.gridPanel.clear();
this.messagePanel.clear();
}
remove(): void { remove(): void {
this.container.remove(); this.container.remove();
} }
@@ -151,6 +160,10 @@ class ResultsTab implements IPanelTab {
public dispose() { public dispose() {
dispose(this.view); dispose(this.view);
} }
public clear() {
this.view.clear();
}
} }
export class QueryResultsView extends Disposable { export class QueryResultsView extends Disposable {
@@ -221,8 +234,11 @@ export class QueryResultsView extends Disposable {
} }
} }
public dispose() { clearInput() {
this._panelView.dispose(); this._input = undefined;
this.resultsTab.clear();
this.qpTab.clear();
this.chartTab.clear();
} }
public get input(): QueryResultsInput { public get input(): QueryResultsInput {
@@ -264,4 +280,8 @@ export class QueryResultsView extends Disposable {
this._panelView.removeTab(this.qpTab.identifier); this._panelView.removeTab(this.qpTab.identifier);
} }
} }
public dispose() {
super.dispose();
}
} }

View File

@@ -35,9 +35,9 @@ export interface IQueryModelService {
getConfig(): Promise<{ [key: string]: any }>; getConfig(): Promise<{ [key: string]: any }>;
getShortcuts(): Promise<any>; getShortcuts(): Promise<any>;
getQueryRows(uri: string, rowStart: number, numberOfRows: number, batchId: number, resultId: number): Thenable<ResultSetSubset>; getQueryRows(uri: string, rowStart: number, numberOfRows: number, batchId: number, resultId: number): Thenable<ResultSetSubset>;
runQuery(uri: string, selection: ISelectionData, title: string, queryInput: QueryInput, runOptions?: ExecutionPlanOptions): void; runQuery(uri: string, selection: ISelectionData, queryInput: QueryInput, runOptions?: ExecutionPlanOptions): void;
runQueryStatement(uri: string, selection: ISelectionData, title: string, queryInput: QueryInput): void; runQueryStatement(uri: string, selection: ISelectionData, queryInput: QueryInput): void;
runQueryString(uri: string, selection: string, title: string, queryInput: QueryInput); runQueryString(uri: string, selection: string, queryInput: QueryInput);
cancelQuery(input: QueryRunner | string): void; cancelQuery(input: QueryRunner | string): void;
disposeQuery(uri: string): void; disposeQuery(uri: string): void;
isRunningQuery(uri: string): boolean; isRunningQuery(uri: string): boolean;

View File

@@ -209,32 +209,28 @@ export class QueryModelService implements IQueryModelService {
/** /**
* Run a query for the given URI with the given text selection * Run a query for the given URI with the given text selection
*/ */
public runQuery(uri: string, selection: sqlops.ISelectionData, public runQuery(uri: string, selection: sqlops.ISelectionData, queryInput: QueryInput, runOptions?: sqlops.ExecutionPlanOptions): void {
title: string, queryInput: QueryInput, runOptions?: sqlops.ExecutionPlanOptions): void { this.doRunQuery(uri, selection, queryInput, false, runOptions);
this.doRunQuery(uri, selection, title, queryInput, false, runOptions);
} }
/** /**
* Run the current SQL statement for the given URI * Run the current SQL statement for the given URI
*/ */
public runQueryStatement(uri: string, selection: sqlops.ISelectionData, public runQueryStatement(uri: string, selection: sqlops.ISelectionData, queryInput: QueryInput): void {
title: string, queryInput: QueryInput): void { this.doRunQuery(uri, selection, queryInput, true);
this.doRunQuery(uri, selection, title, queryInput, true);
} }
/** /**
* Run the current SQL statement for the given URI * Run the current SQL statement for the given URI
*/ */
public runQueryString(uri: string, selection: string, public runQueryString(uri: string, selection: string, queryInput: QueryInput): void {
title: string, queryInput: QueryInput): void { this.doRunQuery(uri, selection, queryInput, true);
this.doRunQuery(uri, selection, title, queryInput, true);
} }
/** /**
* Run Query implementation * Run Query implementation
*/ */
private doRunQuery(uri: string, selection: sqlops.ISelectionData | string, private doRunQuery(uri: string, selection: sqlops.ISelectionData | string, queryInput: QueryInput,
title: string, queryInput: QueryInput,
runCurrentStatement: boolean, runOptions?: sqlops.ExecutionPlanOptions): void { runCurrentStatement: boolean, runOptions?: sqlops.ExecutionPlanOptions): void {
// Reuse existing query runner if it exists // Reuse existing query runner if it exists
let queryRunner: QueryRunner; let queryRunner: QueryRunner;
@@ -256,7 +252,7 @@ export class QueryModelService implements IQueryModelService {
} else { } else {
// We do not have a query runner for this editor, so create a new one // We do not have a query runner for this editor, so create a new one
// and map it to the results uri // and map it to the results uri
info = this.initQueryRunner(uri, title); info = this.initQueryRunner(uri);
queryRunner = info.queryRunner; queryRunner = info.queryRunner;
} }
@@ -277,8 +273,8 @@ export class QueryModelService implements IQueryModelService {
} }
} }
private initQueryRunner(uri: string, title: string): QueryInfo { private initQueryRunner(uri: string): QueryInfo {
let queryRunner = this._instantiationService.createInstance(QueryRunner, uri, title); let queryRunner = this._instantiationService.createInstance(QueryRunner, uri);
let info = new QueryInfo(); let info = new QueryInfo();
queryRunner.addListener(QREvents.RESULT_SET, e => { queryRunner.addListener(QREvents.RESULT_SET, e => {
this._fireQueryEvent(uri, 'resultSet', e); this._fireQueryEvent(uri, 'resultSet', e);
@@ -363,6 +359,10 @@ export class QueryModelService implements IQueryModelService {
if (queryRunner) { if (queryRunner) {
queryRunner.disposeQuery(); queryRunner.disposeQuery();
} }
// remove our info map
if (this._queryInfoMap.has(ownerUri)) {
this._queryInfoMap.delete(ownerUri);
}
} }
// EDIT DATA METHODS ///////////////////////////////////////////////////// // EDIT DATA METHODS /////////////////////////////////////////////////////
@@ -386,7 +386,7 @@ export class QueryModelService implements IQueryModelService {
// We do not have a query runner for this editor, so create a new one // We do not have a query runner for this editor, so create a new one
// and map it to the results uri // and map it to the results uri
queryRunner = this._instantiationService.createInstance(QueryRunner, ownerUri, ownerUri); queryRunner = this._instantiationService.createInstance(QueryRunner, ownerUri);
queryRunner.addListener(QREvents.RESULT_SET, resultSet => { queryRunner.addListener(QREvents.RESULT_SET, resultSet => {
this._fireQueryEvent(ownerUri, 'resultSet', resultSet); this._fireQueryEvent(ownerUri, 'resultSet', resultSet);
}); });

View File

@@ -20,7 +20,7 @@ import * as nls from 'vs/nls';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import * as types from 'vs/base/common/types'; import * as types from 'vs/base/common/types';
import { EventEmitter } from 'sql/base/common/eventEmitter'; import { EventEmitter } from 'sql/base/common/eventEmitter';
import { IDisposable } from 'vs/base/common/lifecycle'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { Emitter, Event } from 'vs/base/common/event'; import { Emitter, Event } from 'vs/base/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -62,7 +62,7 @@ export interface IGridMessage extends sqlops.IResultMessage {
* Query Runner class which handles running a query, reports the results to the content manager, * Query Runner class which handles running a query, reports the results to the content manager,
* and handles getting more rows from the service layer and disposing when the content is closed. * and handles getting more rows from the service layer and disposing when the content is closed.
*/ */
export default class QueryRunner { export default class QueryRunner extends Disposable {
// MEMBER VARIABLES //////////////////////////////////////////////////// // MEMBER VARIABLES ////////////////////////////////////////////////////
private _resultLineOffset: number; private _resultLineOffset: number;
private _totalElapsedMilliseconds: number = 0; private _totalElapsedMilliseconds: number = 0;
@@ -76,7 +76,7 @@ export default class QueryRunner {
private _planXml = new Deferred<string>(); private _planXml = new Deferred<string>();
public get planXml(): Thenable<string> { return this._planXml.promise; } public get planXml(): Thenable<string> { return this._planXml.promise; }
private _onMessage = new Emitter<sqlops.IResultMessage>(); private _onMessage = this._register(new Emitter<sqlops.IResultMessage>());
private _debouncedMessage = debounceEvent<sqlops.IResultMessage, sqlops.IResultMessage[]>(this._onMessage.event, (l, e) => { private _debouncedMessage = debounceEvent<sqlops.IResultMessage, sqlops.IResultMessage[]>(this._onMessage.event, (l, e) => {
// on first run // on first run
if (types.isUndefinedOrNull(l)) { if (types.isUndefinedOrNull(l)) {
@@ -88,7 +88,7 @@ export default class QueryRunner {
private _echoedMessages = echo(this._debouncedMessage.event); private _echoedMessages = echo(this._debouncedMessage.event);
public readonly onMessage = this._echoedMessages.event; public readonly onMessage = this._echoedMessages.event;
private _onResultSet = new Emitter<sqlops.ResultSetSummary>(); private _onResultSet = this._register(new Emitter<sqlops.ResultSetSummary>());
private _debouncedResultSet = debounceEvent<sqlops.ResultSetSummary, sqlops.ResultSetSummary[]>(this._onResultSet.event, (l, e) => { private _debouncedResultSet = debounceEvent<sqlops.ResultSetSummary, sqlops.ResultSetSummary[]>(this._onResultSet.event, (l, e) => {
// on first run // on first run
if (types.isUndefinedOrNull(l)) { if (types.isUndefinedOrNull(l)) {
@@ -100,16 +100,16 @@ export default class QueryRunner {
private _echoedResultSet = echo(this._debouncedResultSet.event); private _echoedResultSet = echo(this._debouncedResultSet.event);
public readonly onResultSet = this._echoedResultSet.event; public readonly onResultSet = this._echoedResultSet.event;
private _onQueryStart = new Emitter<void>(); private _onQueryStart = this._register(new Emitter<void>());
public readonly onQueryStart: Event<void> = this._onQueryStart.event; public readonly onQueryStart: Event<void> = this._onQueryStart.event;
private _onQueryEnd = new Emitter<string>(); private _onQueryEnd = this._register(new Emitter<string>());
public readonly onQueryEnd: Event<string> = this._onQueryEnd.event; public readonly onQueryEnd: Event<string> = this._onQueryEnd.event;
private _onBatchStart = new Emitter<sqlops.BatchSummary>(); private _onBatchStart = this._register(new Emitter<sqlops.BatchSummary>());
public readonly onBatchStart: Event<sqlops.BatchSummary> = this._onBatchStart.event; public readonly onBatchStart: Event<sqlops.BatchSummary> = this._onBatchStart.event;
private _onBatchEnd = new Emitter<sqlops.BatchSummary>(); private _onBatchEnd = this._register(new Emitter<sqlops.BatchSummary>());
public readonly onBatchEnd: Event<sqlops.BatchSummary> = this._onBatchEnd.event; public readonly onBatchEnd: Event<sqlops.BatchSummary> = this._onBatchEnd.event;
private _queryStartTime: Date; private _queryStartTime: Date;
@@ -124,13 +124,14 @@ export default class QueryRunner {
// CONSTRUCTOR ///////////////////////////////////////////////////////// // CONSTRUCTOR /////////////////////////////////////////////////////////
constructor( constructor(
public uri: string, public uri: string,
public title: string,
@IQueryManagementService private _queryManagementService: IQueryManagementService, @IQueryManagementService private _queryManagementService: IQueryManagementService,
@INotificationService private _notificationService: INotificationService, @INotificationService private _notificationService: INotificationService,
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService, @IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
@IClipboardService private _clipboardService: IClipboardService, @IClipboardService private _clipboardService: IClipboardService,
@IInstantiationService private instantiationService: IInstantiationService @IInstantiationService private instantiationService: IInstantiationService
) { } ) {
super();
}
get isExecuting(): boolean { get isExecuting(): boolean {
return this._isExecuting; return this._isExecuting;
@@ -504,10 +505,16 @@ export default class QueryRunner {
/** /**
* Disposes the Query from the service client * Disposes the Query from the service client
* @returns A promise that will be rejected if a problem occured
*/ */
public disposeQuery(): void { public disposeQuery(): void {
this._queryManagementService.disposeQuery(this.uri); this._queryManagementService.disposeQuery(this.uri).then(() => {
this.dispose();
});
}
public dispose() {
this._batchSets = undefined;
super.dispose();
} }
get totalElapsedMilliseconds(): number { get totalElapsedMilliseconds(): number {

View File

@@ -152,12 +152,6 @@ export class QueryEditorService implements IQueryEditorService {
}); });
} }
/**
* Clears any QueryEditor data for the given URI held by this service
*/
public onQueryInputClosed(uri: string): void {
}
onSaveAsCompleted(oldResource: URI, newResource: URI): void { onSaveAsCompleted(oldResource: URI, newResource: URI): void {
let oldResourceString: string = oldResource.toString(); let oldResourceString: string = oldResource.toString();

View File

@@ -15,6 +15,9 @@ import { dispose, Disposable } from 'vs/base/common/lifecycle';
export class QueryPlanState { export class QueryPlanState {
xml: string; xml: string;
dispose() {
}
} }
export class QueryPlanTab implements IPanelTab { export class QueryPlanTab implements IPanelTab {
@@ -29,6 +32,10 @@ export class QueryPlanTab implements IPanelTab {
public dispose() { public dispose() {
dispose(this.view); dispose(this.view);
} }
public clear() {
this.view.clear();
}
} }
export class QueryPlanView implements IPanelView { export class QueryPlanView implements IPanelView {
@@ -59,6 +66,12 @@ export class QueryPlanView implements IPanelView {
this.container.style.height = dimension.height + 'px'; this.container.style.height = dimension.height + 'px';
} }
public clear() {
if (this.qp) {
this.qp.xml = undefined;
}
}
public showPlan(xml: string) { public showPlan(xml: string) {
if (this.qp) { if (this.qp) {
this.qp.xml = xml; this.qp.xml = xml;

View File

@@ -16,6 +16,18 @@
min-width: 800px; min-width: 800px;
} }
.dialog-message-and-page-container {
display: flex;
flex-direction: column;
flex: 1 1;
overflow: hidden;
}
.dialogModal-page-container {
flex: 1 1;
overflow: hidden;
}
.dialogModal-pane { .dialogModal-pane {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -34,6 +34,9 @@ export class WizardModal extends Modal {
// Wizard HTML elements // Wizard HTML elements
private _body: HTMLElement; private _body: HTMLElement;
private _messageAndPageContainer: HTMLElement;
private _pageContainer: HTMLElement;
// Buttons // Buttons
private _previousButton: Button; private _previousButton: Button;
private _nextButton: Button; private _nextButton: Button;
@@ -53,6 +56,7 @@ export class WizardModal extends Modal {
@IClipboardService clipboardService: IClipboardService @IClipboardService clipboardService: IClipboardService
) { ) {
super(_wizard.title, name, partService, telemetryService, clipboardService, themeService, contextKeyService, options); super(_wizard.title, name, partService, telemetryService, clipboardService, themeService, contextKeyService, options);
this._useDefaultMessageBoxLocation = false;
} }
public layout(): void { public layout(): void {
@@ -126,12 +130,21 @@ export class WizardModal extends Modal {
} }
protected renderBody(container: HTMLElement): void { protected renderBody(container: HTMLElement): void {
let bodyBuilderObj;
new Builder(container).div({ class: 'dialogModal-body' }, (bodyBuilder) => { new Builder(container).div({ class: 'dialogModal-body' }, (bodyBuilder) => {
bodyBuilderObj = bodyBuilder;
this._body = bodyBuilder.getHTMLElement(); this._body = bodyBuilder.getHTMLElement();
}); });
this.initializeNavigation(this._body); this.initializeNavigation(this._body);
bodyBuilderObj.div({ class: 'dialog-message-and-page-container' }, (mpContainer) => {
this._messageAndPageContainer = mpContainer.getHTMLElement();
mpContainer.append(this._messageElement);
this._pageContainer = mpContainer.div({ class: 'dialogModal-page-container' }).getHTMLElement();
});
this._wizard.pages.forEach(page => { this._wizard.pages.forEach(page => {
this.registerPage(page); this.registerPage(page);
}); });
@@ -159,7 +172,7 @@ export class WizardModal extends Modal {
private registerPage(page: WizardPage): void { private registerPage(page: WizardPage): void {
let dialogPane = new DialogPane(page.title, page.content, valid => page.notifyValidityChanged(valid), this._instantiationService, this._wizard.displayPageTitles, page.description); let dialogPane = new DialogPane(page.title, page.content, valid => page.notifyValidityChanged(valid), this._instantiationService, this._wizard.displayPageTitles, page.description);
dialogPane.createBody(this._body); dialogPane.createBody(this._pageContainer);
this._dialogPanes.set(page, dialogPane); this._dialogPanes.set(page, dialogPane);
page.onUpdate(() => this.setButtonsForPage(this._wizard.currentPage)); page.onUpdate(() => this.setButtonsForPage(this._wizard.currentPage));
} }

View File

@@ -28,6 +28,7 @@ import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectEx
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { QueryInput } from 'sql/parts/query/common/queryInput'; import { QueryInput } from 'sql/parts/query/common/queryInput';
import { DashboardInput } from 'sql/parts/dashboard/dashboardInput'; import { DashboardInput } from 'sql/parts/dashboard/dashboardInput';
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
// map for the version of SQL Server (default is 140) // map for the version of SQL Server (default is 140)
const scriptCompatibilityOptionMap = { const scriptCompatibilityOptionMap = {
@@ -400,6 +401,9 @@ export function getCurrentGlobalConnection(objectExplorerService: IObjectExplore
if (activeInput instanceof QueryInput || activeInput instanceof EditDataInput || activeInput instanceof DashboardInput) { if (activeInput instanceof QueryInput || activeInput instanceof EditDataInput || activeInput instanceof DashboardInput) {
connection = connectionManagementService.getConnectionProfile(activeInput.uri); connection = connectionManagementService.getConnectionProfile(activeInput.uri);
} }
else if (activeInput instanceof ProfilerInput) {
connection = activeInput.connection;
}
} }
return connection; return connection;

View File

@@ -14,7 +14,7 @@ import { attachButtonStyler, attachModalDialogStyler } from 'sql/common/theme/st
import { Builder } from 'vs/base/browser/builder'; import { Builder } from 'vs/base/browser/builder';
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IThemeService } from 'vs/platform/theme/common/themeService';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/theme';
import { IPartService } from 'vs/workbench/services/part/common/partService'; import { IPartService } from 'vs/workbench/services/part/common/partService';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -76,7 +76,7 @@ export class ErrorMessageDialog extends Modal {
this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails), 'left'); this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails), 'left');
this._copyButton.icon = 'icon scriptToClipboard'; this._copyButton.icon = 'icon scriptToClipboard';
this._copyButton.element.title = copyButtonLabel; this._copyButton.element.title = copyButtonLabel;
this._register(attachButtonStyler(this._copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND })); this._register(attachButtonStyler(this._copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND, buttonForeground: SIDE_BAR_FOREGROUND }));
} }
private createStandardButton(label: string, onSelect: () => void): Button { private createStandardButton(label: string, onSelect: () => void): Button {

View File

@@ -141,6 +141,8 @@ suite('SQL QueryEditor Tests', () => {
connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined); connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined);
connectionManagementService.callBase = true; connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false); connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false);
connectionManagementService.setup(x => x.disconnectEditor(TypeMoq.It.isAny())).returns(() => void 0);
connectionManagementService.setup(x => x.ensureDefaultLanguageFlavor(TypeMoq.It.isAnyString())).returns(() => void 0);
// Create a QueryModelService // Create a QueryModelService
queryModelService = new QueryModelService(instantiationService.object, notificationService.object); queryModelService = new QueryModelService(instantiationService.object, notificationService.object);
@@ -328,6 +330,9 @@ suite('SQL QueryEditor Tests', () => {
queryConnectionService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined); queryConnectionService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined);
queryConnectionService.callBase = true; queryConnectionService.callBase = true;
queryConnectionService.setup(x => x.disconnectEditor(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => void 0);
queryConnectionService.setup(x => x.ensureDefaultLanguageFlavor(TypeMoq.It.isAnyString())).returns(() => void 0);
// Mock InstantiationService to give us the actions // Mock InstantiationService to give us the actions
queryActionInstantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Loose); queryActionInstantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Loose);
@@ -354,12 +359,13 @@ suite('SQL QueryEditor Tests', () => {
let fileInput = new UntitledEditorInput(URI.parse('testUri'), false, '', '', '', instantiationService.object, undefined, undefined, undefined); let fileInput = new UntitledEditorInput(URI.parse('testUri'), false, '', '', '', instantiationService.object, undefined, undefined, undefined);
queryModelService = TypeMoq.Mock.ofType(QueryModelService, TypeMoq.MockBehavior.Loose, undefined, undefined); queryModelService = TypeMoq.Mock.ofType(QueryModelService, TypeMoq.MockBehavior.Loose, undefined, undefined);
queryModelService.callBase = true; queryModelService.callBase = true;
queryModelService.setup(x => x.disposeQuery(TypeMoq.It.isAny())).returns(() => void 0);
queryInput = new QueryInput( queryInput = new QueryInput(
'', '',
fileInput, fileInput,
undefined, undefined,
undefined, undefined,
undefined, connectionManagementService.object,
queryModelService.object, queryModelService.object,
undefined, undefined,
undefined undefined
@@ -395,7 +401,7 @@ suite('SQL QueryEditor Tests', () => {
test('Test that we attempt to dispose query when the queryInput is disposed', (done) => { test('Test that we attempt to dispose query when the queryInput is disposed', (done) => {
let queryResultsInput = new QueryResultsInput('testUri', configurationService.object); let queryResultsInput = new QueryResultsInput('testUri', configurationService.object);
queryInput['_results'] = queryResultsInput; queryInput['_results'] = queryResultsInput;
queryInput.dispose(); queryInput.close();
queryModelService.verify(x => x.disposeQuery(TypeMoq.It.isAnyString()), TypeMoq.Times.once()); queryModelService.verify(x => x.disposeQuery(TypeMoq.It.isAnyString()), TypeMoq.Times.once());
done(); done();
}); });

View File

@@ -199,7 +199,7 @@ suite('Keybindings Editor Model test', () => {
}); });
}); });
test('convert with title and wihtout binding to entry', () => { test('convert with title and without binding to entry', () => {
const id = 'a' + uuid.generateUuid(); const id = 'a' + uuid.generateUuid();
registerCommandWithTitle(id, 'some title'); registerCommandWithTitle(id, 'some title');
prepareKeybindingService(); prepareKeybindingService();