mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
delayed document list spinner (#3907)
This commit is contained in:
committed by
Eugenio Romano
parent
ed7ce4574a
commit
72dab2400a
@@ -239,6 +239,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
private layoutPresets = {};
|
private layoutPresets = {};
|
||||||
private subscriptions: Subscription[] = [];
|
private subscriptions: Subscription[] = [];
|
||||||
private rowMenuCache: { [key: string]: ContentActionModel[] } = {};
|
private rowMenuCache: { [key: string]: ContentActionModel[] } = {};
|
||||||
|
private loadingTimeout;
|
||||||
|
|
||||||
constructor(private documentListService: DocumentListService,
|
constructor(private documentListService: DocumentListService,
|
||||||
private ngZone: NgZone,
|
private ngZone: NgZone,
|
||||||
@@ -571,9 +572,21 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setLoadingState(value: boolean) {
|
||||||
|
if (value) {
|
||||||
|
clearTimeout(this.loadingTimeout);
|
||||||
|
this.loadingTimeout = setTimeout(() => {
|
||||||
|
this.loading = true;
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
clearTimeout(this.loadingTimeout);
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loadFolder() {
|
loadFolder() {
|
||||||
if (!this.pagination.getValue().merge) {
|
if (!this.pagination.getValue().merge) {
|
||||||
this.loading = true;
|
this.setLoadingState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.hasCustomLayout) {
|
if (!this.hasCustomLayout) {
|
||||||
@@ -622,7 +635,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
nodePaging => {
|
nodePaging => {
|
||||||
this.data.loadPage(<NodePaging> nodePaging, this.pagination.getValue().merge);
|
this.data.loadPage(<NodePaging> nodePaging, this.pagination.getValue().merge);
|
||||||
this.loading = false;
|
this.setLoadingState(false);
|
||||||
this.onDataReady(nodePaging);
|
this.onDataReady(nodePaging);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}, err => {
|
}, err => {
|
||||||
@@ -640,7 +653,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
onPageLoaded(nodePaging: NodePaging) {
|
onPageLoaded(nodePaging: NodePaging) {
|
||||||
if (nodePaging) {
|
if (nodePaging) {
|
||||||
this.data.loadPage(nodePaging, this.pagination.getValue().merge);
|
this.data.loadPage(nodePaging, this.pagination.getValue().merge);
|
||||||
this.loading = false;
|
this.setLoadingState(false);
|
||||||
this.onDataReady(nodePaging);
|
this.onDataReady(nodePaging);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -829,7 +842,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
private handleError(err: any) {
|
private handleError(err: any) {
|
||||||
if (err.message) {
|
if (err.message) {
|
||||||
if (JSON.parse(err.message).error.statusCode === 403) {
|
if (JSON.parse(err.message).error.statusCode === 403) {
|
||||||
this.loading = false;
|
this.setLoadingState(false);
|
||||||
this.noPermission = true;
|
this.noPermission = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user