Profiler toolbar fixes + creating connections (#1677)

* Fixing button enabling, connection selection

* Fixing spacing
This commit is contained in:
Madeline MacDonald
2018-06-19 13:54:47 -07:00
committed by Karl Burtram
parent e69158d9b2
commit 6b018c5d06
3 changed files with 10 additions and 22 deletions

View File

@@ -19,8 +19,10 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { IObjectExplorerService } from '../../objectExplorer/common/objectExplorerService';
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
import { TPromise } from 'vs/base/common/winjs.base';
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
// Contribute Global Actions
const category = nls.localize('profilerCategory', "Profiler");
@@ -37,20 +39,9 @@ CommandsRegistry.registerCommand({
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
let instantiationService: IInstantiationService = accessor.get(IInstantiationService);
let connectionService: IConnectionManagementService = accessor.get(IConnectionManagementService);
let objectExplorerService: IObjectExplorerService = accessor.get(IObjectExplorerService);
// 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;
let activeConnections = connectionService.getActiveConnections();
if (activeConnections) {
for (let i = 0; i < activeConnections.length; ++i) {
if (activeConnections[i].providerName === 'MSSQL') {
connectionProfile = activeConnections[i];
break;
}
}
}
let connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService);
let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile);
return editorService.openEditor(profilerInput, { pinned: true }, false).then(() => TPromise.as(true));
}

View File

@@ -202,8 +202,6 @@ export class ProfilerEditor extends BaseEditor {
this._register(attachSelectBoxStyler(this._sessionTemplateSelector, this.themeService));
this._actionBar.setContent([
{ action: this._connectAction },
{ element: Taskbar.createTaskbarSeparator() },
{ action: this._startAction },
{ action: this._stopAction },
{ element: dropdownContainer },
@@ -386,21 +384,20 @@ export class ProfilerEditor extends BaseEditor {
if (e.isConnected) {
this._connectAction.connected = this.input.state.isConnected;
this._startAction.enabled = this.input.state.isConnected;
this._stopAction.enabled = false;
this._pauseAction.enabled = false;
if (this.input.state.isConnected) {
this._sessionTemplateSelector.disable();
} else {
this._sessionTemplateSelector.enable();
this._startAction.enabled = this.input.state.isConnected;
this._stopAction.enabled = false;
this._pauseAction.enabled = false;
return;
}
return;
}
if (e.isPaused){
this._pauseAction.paused = this.input.state.isPaused;
this._pauseAction.enabled = !this.input.state.isStopped && (this.input.state.isRunning || this.input.state.isPaused);
}
if (e.isStopped || e.isRunning) {

View File

@@ -44,7 +44,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
// set inital state
this.state.change({
isConnected: true,
isStopped: false,
isStopped: true,
isPaused: false,
isRunning: false,
autoscroll: true