From 3b1ed049b2c90e5baf01467df66749cfde20a7e4 Mon Sep 17 00:00:00 2001 From: SakshiS-harma Date: Fri, 1 Sep 2023 16:33:12 -0700 Subject: [PATCH 1/2] Add loading indicator when an XEL File is opened --- .../workbench/browser/editor/profiler/profilerInput.ts | 10 ++++++++++ .../contrib/profiler/browser/profilerEditor.ts | 10 +++++++++- .../contrib/profiler/browser/profilerTableEditor.ts | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/browser/editor/profiler/profilerInput.ts b/src/sql/workbench/browser/editor/profiler/profilerInput.ts index b40277252fa2..a0547d6f6028 100644 --- a/src/sql/workbench/browser/editor/profiler/profilerInput.ts +++ b/src/sql/workbench/browser/editor/profiler/profilerInput.ts @@ -41,6 +41,8 @@ export class ProfilerInput extends EditorInput implements IProfilerSession { private _onColumnsChanged = new Emitter[]>(); public onColumnsChanged: Event[]> = this._onColumnsChanged.event; + private _initializerSetup: boolean = true; + private _filter: ProfilerFilter = { clauses: [] }; constructor( @@ -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 diff --git a/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts b/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts index 4bdca522cc86..4d15a3798351 100644 --- a/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts +++ b/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts @@ -501,6 +501,12 @@ 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._profilerTableEditor.loadingSpinner.loadingMessage = nls.localize('Loading', "Loading..."); + this.input.setInitializerPhase(false); + } }); } @@ -546,7 +552,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) { @@ -583,6 +589,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 } } } diff --git a/src/sql/workbench/contrib/profiler/browser/profilerTableEditor.ts b/src/sql/workbench/contrib/profiler/browser/profilerTableEditor.ts index 1d8e4a8ec48a..eacdd7d2d32f 100644 --- a/src/sql/workbench/contrib/profiler/browser/profilerTableEditor.ts +++ b/src/sql/workbench/contrib/profiler/browser/profilerTableEditor.ts @@ -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; @@ -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(); public onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; @@ -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, { @@ -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 { From f75e539cf16bf4373f9342e51ff0302c8a317f48 Mon Sep 17 00:00:00 2001 From: SakshiS-harma Date: Tue, 5 Sep 2023 10:42:02 -0700 Subject: [PATCH 2/2] Remove custom loading message --- src/sql/workbench/contrib/profiler/browser/profilerEditor.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts b/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts index 4d15a3798351..d447732fa1b3 100644 --- a/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts +++ b/src/sql/workbench/contrib/profiler/browser/profilerEditor.ts @@ -504,7 +504,6 @@ export class ProfilerEditor extends EditorPane { if (this.input.isFileSession && this.input.isSetupPhase) { // Add loading indicator when opening a new file session this._profilerTableEditor.loadingSpinner.loading = true; - this._profilerTableEditor.loadingSpinner.loadingMessage = nls.localize('Loading', "Loading..."); this.input.setInitializerPhase(false); } });