From af2bc859d1ae36671df7063e70da0f4d5e5b0bb0 Mon Sep 17 00:00:00 2001 From: Madeline MacDonald Date: Fri, 15 Jun 2018 13:39:46 -0700 Subject: [PATCH] Profiler toolbar changes (#1615) * Clear event view pane when starting new session * Removing debug logging * Handling pause button * Cleaning up comments from previous commit * Fixing comments from PR * Fixing a comment I forgot to delete * Bumping dataprotocolclient version * Bumping sqltoolsservice & sqlops-dataprotocolclient version --- extensions/mssql/package.json | 2 +- extensions/mssql/src/config.json | 2 +- .../profiler/contrib/profiler.contribution.ts | 27 ------------------- .../parts/profiler/contrib/profilerActions.ts | 22 +++++++++++---- .../parts/profiler/editor/profilerEditor.ts | 24 ++++++++--------- .../workbench/api/node/extHostDataProtocol.ts | 8 ++++++ .../api/node/mainThreadDataProtocol.ts | 2 +- .../workbench/api/node/sqlExtHost.protocol.ts | 5 ++++ 8 files changed, 44 insertions(+), 48 deletions(-) diff --git a/extensions/mssql/package.json b/extensions/mssql/package.json index de1129b243..faeba3d57c 100644 --- a/extensions/mssql/package.json +++ b/extensions/mssql/package.json @@ -658,7 +658,7 @@ } }, "dependencies": { - "dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.1.7", + "dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.1.8.2", "opener": "^1.4.3", "service-downloader": "github:anthonydresser/service-downloader#0.1.2", "vscode-extension-telemetry": "^0.0.15" diff --git a/extensions/mssql/src/config.json b/extensions/mssql/src/config.json index 9c779665b9..fb4dd8244b 100644 --- a/extensions/mssql/src/config.json +++ b/extensions/mssql/src/config.json @@ -1,6 +1,6 @@ { "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", - "version": "1.4.0-alpha.35", + "version": "1.4.0-alpha.44", "downloadFileNames": { "Windows_86": "win-x86-netcoreapp2.1.zip", "Windows_64": "win-x64-netcoreapp2.1.zip", diff --git a/src/sql/parts/profiler/contrib/profiler.contribution.ts b/src/sql/parts/profiler/contrib/profiler.contribution.ts index ddf89f5301..c77b21d962 100644 --- a/src/sql/parts/profiler/contrib/profiler.contribution.ts +++ b/src/sql/parts/profiler/contrib/profiler.contribution.ts @@ -92,33 +92,6 @@ const profilerSessionTemplateSchema: IJSONSchema = { } ] } - }, - { - name: 'TSQL' - }, - { - name: 'Blank' - }, - { - name: 'SP_Counts' - }, - { - name: 'TQL_Duration' - }, - { - name: 'TSQL_Grouped' - }, - { - name: 'TSQL_Locks' - }, - { - name: 'TSQL_Replay' - }, - { - name: 'TSQL_SPs' - }, - { - name: 'Tuning' } ] }; diff --git a/src/sql/parts/profiler/contrib/profilerActions.ts b/src/sql/parts/profiler/contrib/profilerActions.ts index 9a196411a2..406e867470 100644 --- a/src/sql/parts/profiler/contrib/profilerActions.ts +++ b/src/sql/parts/profiler/contrib/profilerActions.ts @@ -57,7 +57,7 @@ export class ProfilerConnect extends Action { public set connected(value: boolean) { this._connected = value; this._setClass(value ? 'disconnect' : 'connect'); - this._setLabel(value ? nls.localize('profilerAction.disconnect', 'Disconnected') : nls.localize('profilerAction.connect', "Connect")); + this._setLabel(value ? nls.localize('profilerAction.disconnect', 'Disconnect') : nls.localize('profilerAction.connect', "Connect")); } public get connected(): boolean { @@ -78,17 +78,19 @@ export class ProfilerStart extends Action { public run(input: ProfilerInput): TPromise { this.enabled = false; + input.data.clear(); return TPromise.wrap(this._profilerService.startSession(input.id).then(() => { input.state.change({ isRunning: true, isStopped: false, isPaused: false }); return true; })); } - } export class ProfilerPause extends Action { public static ID = 'profiler.pause'; - public static LABEL = nls.localize('pause', "Pause"); + public static LABEL = nls.localize('profiler.capture', "Pause Capture"); + + private _paused: boolean = false; constructor( id: string, label: string, @@ -98,12 +100,22 @@ export class ProfilerPause extends Action { } public run(input: ProfilerInput): TPromise { - this.enabled = false; return TPromise.wrap(this._profilerService.pauseSession(input.id).then(() => { - input.state.change({ isPaused: true, isStopped: false, isRunning: false }); + this.paused = !this._paused; + input.state.change({ isPaused: this.paused, isStopped: false, isRunning: !this.paused }); return true; })); } + + public set paused(value: boolean) { + this._paused = value; + this._setClass(value ? 'start' : 'stop'); + this._setLabel(value ? nls.localize('profilerAction.resumeCapture', "Resume Capture") : nls.localize('profilerAction.pauseCapture', "Pause Capture")); + } + + public get paused(): boolean { + return this._paused; + } } export class ProfilerStop extends Action { diff --git a/src/sql/parts/profiler/editor/profilerEditor.ts b/src/sql/parts/profiler/editor/profilerEditor.ts index 148f217b26..09cd05d8d7 100644 --- a/src/sql/parts/profiler/editor/profilerEditor.ts +++ b/src/sql/parts/profiler/editor/profilerEditor.ts @@ -202,15 +202,15 @@ export class ProfilerEditor extends BaseEditor { this._register(attachSelectBoxStyler(this._sessionTemplateSelector, this.themeService)); this._actionBar.setContent([ - { action: this._startAction }, - { action: this._pauseAction }, - { action: this._stopAction }, { action: this._connectAction }, { element: Taskbar.createTaskbarSeparator() }, - { action: this._autoscrollAction }, - { action: this._instantiationService.createInstance(Actions.ProfilerClear, Actions.ProfilerClear.ID, Actions.ProfilerClear.LABEL) }, + { action: this._startAction }, + { action: this._stopAction }, { element: dropdownContainer }, - { action: this._instantiationService.createInstance(Actions.ProfilerEditColumns, Actions.ProfilerEditColumns.ID, Actions.ProfilerEditColumns.LABEL) } + { element: Taskbar.createTaskbarSeparator() }, + { action: this._pauseAction }, + { action: this._autoscrollAction }, + { action: this._instantiationService.createInstance(Actions.ProfilerClear, Actions.ProfilerClear.ID, Actions.ProfilerClear.LABEL) } ]); } @@ -397,16 +397,14 @@ export class ProfilerEditor extends BaseEditor { return; } - if (e.isRunning) { - this._startAction.enabled = !this.input.state.isRunning; + if (e.isPaused){ + this._pauseAction.paused = this.input.state.isPaused; } if (e.isStopped || e.isRunning) { - this._stopAction.enabled = !this.input.state.isStopped && this.input.state.isRunning; - } - - if (e.isPaused || e.isRunning) { - this._pauseAction.enabled = !this.input.state.isPaused && this.input.state.isRunning; + this._startAction.enabled = !this.input.state.isRunning && !this.input.state.isPaused; + this._stopAction.enabled = !this.input.state.isStopped && (this.input.state.isRunning || this.input.state.isPaused); + this._pauseAction.enabled = !this.input.state.isStopped && (this.input.state.isRunning || this.input.state.isPaused); } } diff --git a/src/sql/workbench/api/node/extHostDataProtocol.ts b/src/sql/workbench/api/node/extHostDataProtocol.ts index c58d01e64d..ae7d85132c 100644 --- a/src/sql/workbench/api/node/extHostDataProtocol.ts +++ b/src/sql/workbench/api/node/extHostDataProtocol.ts @@ -503,6 +503,14 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape { return this._resolveProvider(handle).stopSession(sessionId); } + /** + * Pause a profiler session + */ + public $pauseSession(handle: number, sessionId: string): Thenable { + return this._resolveProvider(handle).pauseSession(sessionId); + } + + /** * Profiler session events available notification */ diff --git a/src/sql/workbench/api/node/mainThreadDataProtocol.ts b/src/sql/workbench/api/node/mainThreadDataProtocol.ts index de360a5b65..8de3337a90 100644 --- a/src/sql/workbench/api/node/mainThreadDataProtocol.ts +++ b/src/sql/workbench/api/node/mainThreadDataProtocol.ts @@ -296,7 +296,7 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape { return self._proxy.$stopSession(handle, sessionId); }, pauseSession(sessionId: string): Thenable { - return TPromise.as(true); + return self._proxy.$pauseSession(handle, sessionId); }, connectSession(sessionId: string): Thenable { return TPromise.as(true); diff --git a/src/sql/workbench/api/node/sqlExtHost.protocol.ts b/src/sql/workbench/api/node/sqlExtHost.protocol.ts index a623f7d21e..dbacbd14f2 100644 --- a/src/sql/workbench/api/node/sqlExtHost.protocol.ts +++ b/src/sql/workbench/api/node/sqlExtHost.protocol.ts @@ -313,6 +313,11 @@ export abstract class ExtHostDataProtocolShape { */ $stopSession(handle: number, sessionId: string): Thenable { throw ni(); } + /** + * Pause a profiler session + */ + $pauseSession(handle: number, sessionId: string): Thenable { throw ni(); } + /** * Get Agent Job list