Add loading indicator when an XEL File is opened (#24274)

* Add loading indicator when an XEL File is opened

* Remove custom loading message
This commit is contained in:
Sakshi Sharma
2023-09-05 13:03:54 -07:00
committed by GitHub
parent b43a3a6b50
commit cceb0bafe2
3 changed files with 23 additions and 1 deletions

View File

@@ -41,6 +41,8 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
private _onColumnsChanged = new Emitter<Slick.Column<Slick.SlickData>[]>(); private _onColumnsChanged = new Emitter<Slick.Column<Slick.SlickData>[]>();
public onColumnsChanged: Event<Slick.Column<Slick.SlickData>[]> = this._onColumnsChanged.event; public onColumnsChanged: Event<Slick.Column<Slick.SlickData>[]> = this._onColumnsChanged.event;
private _initializerSetup: boolean = true;
private _filter: ProfilerFilter = { clauses: [] }; private _filter: ProfilerFilter = { clauses: [] };
constructor( constructor(
@@ -162,6 +164,14 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
return !!this.fileURI; return !!this.fileURI;
} }
public get isSetupPhase(): boolean {
return this._initializerSetup;
}
public setInitializerPhase(isSetupPhase: boolean) {
this._initializerSetup = isSetupPhase;
}
public setConnectionState(isConnected: boolean): void { public setConnectionState(isConnected: boolean): void {
this.state.change({ this.state.change({
isConnected: isConnected isConnected: isConnected

View File

@@ -501,6 +501,11 @@ export class ProfilerEditor extends EditorPane {
if (savedViewState) { if (savedViewState) {
this._profilerTableEditor.restoreViewState(savedViewState); this._profilerTableEditor.restoreViewState(savedViewState);
} }
if (this.input.isFileSession && this.input.isSetupPhase) { // Add loading indicator when opening a new file session
this._profilerTableEditor.loadingSpinner.loading = true;
this.input.setInitializerPhase(false);
}
}); });
} }
@@ -546,7 +551,7 @@ export class ProfilerEditor extends EditorPane {
if (this.input.state.isConnected) { if (this.input.state.isConnected) {
this._updateToolbar(); this._updateToolbar();
// Launch the create session dialog if openning a new window. // Launch the create session dialog if opening a new window.
let uiState = this._profilerService.getSessionViewState(this.input.id); let uiState = this._profilerService.getSessionViewState(this.input.id);
let previousSessionName = uiState && uiState.previousSessionName; let previousSessionName = uiState && uiState.previousSessionName;
if (!this.input.sessionName && !previousSessionName && !this.input.isFileSession) { if (!this.input.sessionName && !previousSessionName && !this.input.isFileSession) {
@@ -583,6 +588,8 @@ export class ProfilerEditor extends EditorPane {
this._updateToolbar(); this._updateToolbar();
if (!this.input.isFileSession) { // skip updating session selector for File sessions to block starting another session from a non-connected file session if (!this.input.isFileSession) { // skip updating session selector for File sessions to block starting another session from a non-connected file session
this._updateSessionSelector(); this._updateSessionSelector();
} else {
this._profilerTableEditor.loadingSpinner.loading = false; // Remove the loading indicator when the complete file is read
} }
} }
} }

View File

@@ -36,6 +36,7 @@ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessib
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { IComponentContextService } from 'sql/workbench/services/componentContext/browser/componentContextService'; import { IComponentContextService } from 'sql/workbench/services/componentContext/browser/componentContextService';
import { defaultTableStyles } from 'sql/platform/theme/browser/defaultStyles'; import { defaultTableStyles } from 'sql/platform/theme/browser/defaultStyles';
import { LoadingSpinner } from 'sql/base/browser/ui/loadingSpinner/loadingSpinner';
export interface ProfilerTableViewState { export interface ProfilerTableViewState {
scrollTop: number; scrollTop: number;
@@ -57,6 +58,7 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
private _actionMap: { [x: string]: IEditorAction } = {}; private _actionMap: { [x: string]: IEditorAction } = {};
private _statusbarItem: IDisposable; private _statusbarItem: IDisposable;
private _showStatusBarItem: boolean; private _showStatusBarItem: boolean;
public loadingSpinner: LoadingSpinner;
private _onDidChangeConfiguration = new Emitter<IConfigurationChangedEvent>(); private _onDidChangeConfiguration = new Emitter<IConfigurationChangedEvent>();
public onDidChangeConfiguration: Event<IConfigurationChangedEvent> = this._onDidChangeConfiguration.event; public onDidChangeConfiguration: Event<IConfigurationChangedEvent> = this._onDidChangeConfiguration.event;
@@ -88,6 +90,7 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
this._overlay.className = 'overlayWidgets'; this._overlay.className = 'overlayWidgets';
this._overlay.style.width = '100%'; this._overlay.style.width = '100%';
this._overlay.style.zIndex = '4'; this._overlay.style.zIndex = '4';
this._overlay.style.paddingTop = '50px';
parent.appendChild(this._overlay); parent.appendChild(this._overlay);
this._profilerTable = new Table(parent, this._accessibilityService, this._quickInputService, defaultTableStyles, { this._profilerTable = new Table(parent, this._accessibilityService, this._quickInputService, defaultTableStyles, {
@@ -129,6 +132,8 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
this._contextKeyService, this._contextKeyService,
this._themeService this._themeService
); );
this.loadingSpinner = new LoadingSpinner(this._overlay, { showText: true, fullSize: false });
} }
public override setInput(input: ProfilerInput): Promise<void> { public override setInput(input: ProfilerInput): Promise<void> {