Files
azuredatastudio/extensions/kusto/src/prompts/progressIndicator.ts
Shafiq Ur Rahman 2f94307635 Kusto extension for ADS (#11752)
* Kusto extension

* Add kusto to extensions.ts

* Remove objectExplorerNodeProvider

* Removed some BDC items + CR cleanup

* Cleanup unused strings in package.nls.json

* Remove unused svgs, and some cleanup

* Bringing objectExplorerNode back and hygiene changes

* rename to KustoObjectExplorerNodeProvider

* rename to KustoIconProvider

* Cleanup SQL code

* Fix compilation error

* Clean up in objectExplorerNodeProvider folder

* Some more clean up based on comments

* apiWrapper add

* changed to camelCase

* Remove unused functions/files

* Removed AgentServicesFeature

* dacfx, cms, schemacompare clean up

* Clean up and addressed few comments

* Remove apWrapper from kusto extension

* Addressed few comments

* credentialstore and escapeexception changes

* Added strict check for Kusto extension

* Fix error and addressed comment

* Saving Kusto files shoulf default to .kql

* package.json changes

* Fix objectExplorerNodeProvider

* Amir/kusto fix (#11972)

* Add the compiled extensions.js

* Fix strict compile rules

Co-authored-by: Monica Gupta <mogupt@microsoft.com>
Co-authored-by: Amir Omidi <amomidi@microsoft.com>
2020-08-26 14:13:31 -07:00

71 lines
1.7 KiB
TypeScript

'use strict';
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
import { window, StatusBarItem, StatusBarAlignment } from 'vscode';
export default class ProgressIndicator {
private _statusBarItem: StatusBarItem;
constructor() {
this._statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
}
private _tasks: string[] = [];
public beginTask(task: string): void {
this._tasks.push(task);
this.displayProgressIndicator();
}
public endTask(task: string): void {
if (this._tasks.length > 0) {
this._tasks.pop();
}
this.setMessage();
}
private setMessage(): void {
if (this._tasks.length === 0) {
this._statusBarItem.text = '';
this.hideProgressIndicator();
return;
}
this._statusBarItem.text = this._tasks[this._tasks.length - 1];
this._statusBarItem.show();
}
private _interval: any;
private displayProgressIndicator(): void {
this.setMessage();
this.hideProgressIndicator();
this._interval = setInterval(() => this.onDisplayProgressIndicator(), 100);
}
private hideProgressIndicator(): void {
if (this._interval) {
clearInterval(this._interval);
this._interval = undefined;
}
this.ProgressCounter = 0;
}
private ProgressText = ['|', '/', '-', '\\', '|', '/', '-', '\\'];
private ProgressCounter = 0;
private onDisplayProgressIndicator(): void {
if (this._tasks.length === 0) {
return;
}
let txt = this.ProgressText[this.ProgressCounter];
this._statusBarItem.text = this._tasks[this._tasks.length - 1] + ' ' + txt;
this.ProgressCounter++;
if (this.ProgressCounter >= this.ProgressText.length - 1) {
this.ProgressCounter = 0;
}
}
}