mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-06-21 10:55:08 -04:00
move code from parts to contrib (#8319)
This commit is contained in:
15
src/sql/workbench/contrib/profiler/common/interfaces.ts
Normal file
15
src/sql/workbench/contrib/profiler/common/interfaces.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export interface IProfilerController {
|
||||
findNext(): void;
|
||||
findPrevious(): void;
|
||||
}
|
||||
|
||||
export const CONTEXT_PROFILER_EDITOR = new RawContextKey<boolean>('inProfilerTableEditor', false);
|
||||
|
||||
export const PROFILER_TABLE_COMMAND_SEARCH = 'profiler.table.action.search';
|
||||
107
src/sql/workbench/contrib/profiler/common/profilerState.ts
Normal file
107
src/sql/workbench/contrib/profiler/common/profilerState.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export interface IProfilerStateChangedEvent {
|
||||
isConnected?: boolean;
|
||||
isRunning?: boolean;
|
||||
isPaused?: boolean;
|
||||
isStopped?: boolean;
|
||||
autoscroll?: boolean;
|
||||
isPanelCollapsed?: boolean;
|
||||
}
|
||||
|
||||
export interface INewProfilerState {
|
||||
isConnected?: boolean;
|
||||
isRunning?: boolean;
|
||||
isPaused?: boolean;
|
||||
isStopped?: boolean;
|
||||
autoscroll?: boolean;
|
||||
isPanelCollapsed?: boolean;
|
||||
}
|
||||
|
||||
export class ProfilerState implements IDisposable {
|
||||
|
||||
private _isConnected: boolean;
|
||||
private _isRunning: boolean;
|
||||
private _isPaused: boolean;
|
||||
private _isStopped: boolean;
|
||||
private _autoscroll: boolean;
|
||||
private _isPanelCollapsed = true;
|
||||
|
||||
public get isConnected(): boolean { return this._isConnected; }
|
||||
public get isRunning(): boolean { return this._isRunning; }
|
||||
public get isPaused(): boolean { return this._isPaused; }
|
||||
public get isStopped(): boolean { return this._isStopped; }
|
||||
public get autoscroll(): boolean { return this._autoscroll; }
|
||||
public get isPanelCollapsed(): boolean { return this._isPanelCollapsed; }
|
||||
|
||||
private readonly _onProfilerStateChange = new Emitter<IProfilerStateChangedEvent>();
|
||||
public readonly onProfilerStateChange = this._onProfilerStateChange.event;
|
||||
|
||||
public dispose(): void {
|
||||
}
|
||||
|
||||
public change(newState: INewProfilerState): void {
|
||||
let changeEvent: IProfilerStateChangedEvent = {
|
||||
isConnected: false,
|
||||
isRunning: false,
|
||||
isPaused: false,
|
||||
isStopped: false,
|
||||
autoscroll: false,
|
||||
isPanelCollapsed: false
|
||||
};
|
||||
let somethingChanged = false;
|
||||
|
||||
if (typeof newState.isConnected !== 'undefined') {
|
||||
if (this._isConnected !== newState.isConnected) {
|
||||
this._isConnected = newState.isConnected;
|
||||
changeEvent.isConnected = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.isRunning !== 'undefined') {
|
||||
if (this._isRunning !== newState.isRunning) {
|
||||
this._isRunning = newState.isRunning;
|
||||
changeEvent.isRunning = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.isPaused !== 'undefined') {
|
||||
if (this._isPaused !== newState.isPaused) {
|
||||
this._isPaused = newState.isPaused;
|
||||
changeEvent.isPaused = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.isStopped !== 'undefined') {
|
||||
if (this._isStopped !== newState.isStopped) {
|
||||
this._isStopped = newState.isStopped;
|
||||
changeEvent.isStopped = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.autoscroll !== 'undefined') {
|
||||
if (this._autoscroll !== newState.autoscroll) {
|
||||
this._autoscroll = newState.autoscroll;
|
||||
changeEvent.autoscroll = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.isPanelCollapsed !== 'undefined') {
|
||||
if (this._isPanelCollapsed !== newState.isPanelCollapsed) {
|
||||
this._isPanelCollapsed = newState.isPanelCollapsed;
|
||||
changeEvent.isPanelCollapsed = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (somethingChanged) {
|
||||
this._onProfilerStateChange.fire(changeEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user