Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loading indicator when an XEL File is opened #24274

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/sql/workbench/browser/editor/profiler/profilerInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
private _onColumnsChanged = new Emitter<Slick.Column<Slick.SlickData>[]>();
public onColumnsChanged: Event<Slick.Column<Slick.SlickData>[]> = this._onColumnsChanged.event;

private _initializerSetup: boolean = true;

private _filter: ProfilerFilter = { clauses: [] };

constructor(
Expand Down Expand Up @@ -162,6 +164,14 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
return !!this.fileURI;
}

public get isSetupPhase(): boolean {
return this._initializerSetup;
}

public setInitializerPhase(isSetupPhase: boolean) {
this._initializerSetup = isSetupPhase;
}

public setConnectionState(isConnected: boolean): void {
this.state.change({
isConnected: isConnected
Expand Down
9 changes: 8 additions & 1 deletion src/sql/workbench/contrib/profiler/browser/profilerEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ export class ProfilerEditor extends EditorPane {
if (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);
}
});
}

Expand Down Expand Up @@ -546,7 +551,7 @@ export class ProfilerEditor extends EditorPane {
if (this.input.state.isConnected) {
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 previousSessionName = uiState && uiState.previousSessionName;
if (!this.input.sessionName && !previousSessionName && !this.input.isFileSession) {
Expand Down Expand Up @@ -583,6 +588,8 @@ export class ProfilerEditor extends EditorPane {
this._updateToolbar();
if (!this.input.isFileSession) { // skip updating session selector for File sessions to block starting another session from a non-connected file session
this._updateSessionSelector();
} else {
this._profilerTableEditor.loadingSpinner.loading = false; // Remove the loading indicator when the complete file is read
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessib
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { IComponentContextService } from 'sql/workbench/services/componentContext/browser/componentContextService';
import { defaultTableStyles } from 'sql/platform/theme/browser/defaultStyles';
import { LoadingSpinner } from 'sql/base/browser/ui/loadingSpinner/loadingSpinner';

export interface ProfilerTableViewState {
scrollTop: number;
Expand All @@ -57,6 +58,7 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
private _actionMap: { [x: string]: IEditorAction } = {};
private _statusbarItem: IDisposable;
private _showStatusBarItem: boolean;
public loadingSpinner: LoadingSpinner;

private _onDidChangeConfiguration = new Emitter<IConfigurationChangedEvent>();
public onDidChangeConfiguration: Event<IConfigurationChangedEvent> = this._onDidChangeConfiguration.event;
Expand Down Expand Up @@ -88,6 +90,7 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
this._overlay.className = 'overlayWidgets';
this._overlay.style.width = '100%';
this._overlay.style.zIndex = '4';
this._overlay.style.paddingTop = '50px';
parent.appendChild(this._overlay);

this._profilerTable = new Table(parent, this._accessibilityService, this._quickInputService, defaultTableStyles, {
Expand Down Expand Up @@ -129,6 +132,8 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
this._contextKeyService,
this._themeService
);

this.loadingSpinner = new LoadingSpinner(this._overlay, { showText: true, fullSize: false });
}

public override setInput(input: ProfilerInput): Promise<void> {
Expand Down