Add loading spinner for connection tree element refresh (#20621)

* added loading status to tree elements during refresh

* added message

* added lambda function

* added async

* moved addtraits to below null check

* Added debug lines for now

* added wip stack

* moved loading icon logic to inside tree item code

* added dispose logic

* Added comment explaining actions

* removed reference to NodeJs Timeout

* added showLoading status to Tree creation utils

* fixed spaces

* removed unnecessary space

* removed unnecessary timer for more responsive results

* removed call in connectionTreeActions test

* added fix to test

* stick to refresh only

* added 100 ms timeout

* added request comment
This commit is contained in:
Alex Ma
2022-11-02 09:42:06 -07:00
committed by GitHub
parent bb701c4fcf
commit 8a51bc91b4
6 changed files with 36 additions and 30 deletions

View File

@@ -959,7 +959,7 @@ export class TreeModel {
return this.input ? this.input.getElement() : null;
}
public refresh(element: any = null, recursive: boolean = true): Promise<any> {
public async refresh(element: any = null, recursive: boolean = true): Promise<any> {
let item = this.getItem(element);
if (!item) {
@@ -968,9 +968,8 @@ export class TreeModel {
let eventData: IRefreshEvent = { item: item, recursive: recursive };
this._onRefresh.fire(eventData);
return item.refresh(recursive).then(() => {
this._onDidRefresh.fire(eventData);
});
await item.refresh(recursive);
this._onDidRefresh.fire(eventData);
}
public expand(element: any): Promise<any> {

View File

@@ -392,7 +392,13 @@ function reactionEquals(one: _.IDragOverReaction, other: _.IDragOverReaction | n
export class TreeView extends HeightMap {
static readonly BINDING = 'monaco-tree-row';
static readonly LOADING_DECORATION_DELAY = 800;
/**
* The delay here is used here to display the loading status after a certain number of milliseconds.
* It was changed from 800 as it turns out that refreshes happen instantly before the status
* can be notified to the user. With 100 ms, the refresh indicator will now be visible in most instances.
* */
static readonly LOADING_DECORATION_DELAY = 100;
private static counter: number = 0;
private instance: number;