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
This commit is contained in:
Madeline MacDonald
2018-06-15 13:39:46 -07:00
committed by GitHub
parent 8e72fdaa52
commit af2bc859d1
8 changed files with 44 additions and 48 deletions

View File

@@ -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'
}
]
};

View File

@@ -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<boolean> {
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<boolean> {
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 {

View File

@@ -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);
}
}

View File

@@ -503,6 +503,14 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).stopSession(sessionId);
}
/**
* Pause a profiler session
*/
public $pauseSession(handle: number, sessionId: string): Thenable<boolean> {
return this._resolveProvider<sqlops.ProfilerProvider>(handle).pauseSession(sessionId);
}
/**
* Profiler session events available notification
*/

View File

@@ -296,7 +296,7 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
return self._proxy.$stopSession(handle, sessionId);
},
pauseSession(sessionId: string): Thenable<boolean> {
return TPromise.as(true);
return self._proxy.$pauseSession(handle, sessionId);
},
connectSession(sessionId: string): Thenable<boolean> {
return TPromise.as(true);

View File

@@ -313,6 +313,11 @@ export abstract class ExtHostDataProtocolShape {
*/
$stopSession(handle: number, sessionId: string): Thenable<boolean> { throw ni(); }
/**
* Pause a profiler session
*/
$pauseSession(handle: number, sessionId: string): Thenable<boolean> { throw ni(); }
/**
* Get Agent Job list