mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5263] Empty page displayed all the time when load content fix (#6209)
* Make test run on API update Improve create librrary test * Fix empty page displayed always first * remvoe console * fix * fix * lint * fix * fix * fix * fix * fix
This commit is contained in:
@@ -1588,12 +1588,12 @@ describe('DocumentList', () => {
|
||||
|
||||
expect(nodeSelectedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<adf-document-list currentFolderId="-my-" #customDocumentList>
|
||||
<adf-document-list #customDocumentList>
|
||||
<adf-custom-loading-content-template>
|
||||
<span id="custom-loading-template">This is a custom loading template</span>
|
||||
</adf-custom-loading-content-template>
|
||||
@@ -1685,4 +1685,5 @@ describe('DocumentListComponent rendering', () => {
|
||||
const cell3 = fixture.nativeElement.querySelector('div[title="Id"][data-automation-id="Name 3"]');
|
||||
expect(cell3.innerText).toBe('3');
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -481,18 +481,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
}
|
||||
|
||||
if (changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
|
||||
if (this.data) {
|
||||
this.data.loadPage(null, false, null, this.getPreselectNodesBasedOnSelectionMode());
|
||||
this.onPreselectNodes();
|
||||
this.resetNewFolderPagination();
|
||||
}
|
||||
|
||||
if (changes['currentFolderId'].currentValue) {
|
||||
|
||||
this.loadFolder();
|
||||
}
|
||||
|
||||
if (this.currentFolderId && changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
|
||||
this.loadFolder();
|
||||
}
|
||||
|
||||
if (this.data) {
|
||||
@@ -659,14 +649,19 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
|
||||
private setLoadingState(value: boolean) {
|
||||
if (value) {
|
||||
clearTimeout(this.loadingTimeout);
|
||||
this.loadingTimeout = setTimeout(() => {
|
||||
this.loading = true;
|
||||
}, 1000);
|
||||
if (this.data?.getRows().length > 0) {
|
||||
if (value) {
|
||||
clearTimeout(this.loadingTimeout);
|
||||
this.loadingTimeout = setTimeout(() => {
|
||||
this.loading = true;
|
||||
}, 1000);
|
||||
} else {
|
||||
clearTimeout(this.loadingTimeout);
|
||||
this.loading = false;
|
||||
}
|
||||
} else {
|
||||
clearTimeout(this.loadingTimeout);
|
||||
this.loading = false;
|
||||
this.loading = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -127,7 +127,6 @@ export class DocumentListService implements DocumentListLoader {
|
||||
* @returns Details of the folder
|
||||
*/
|
||||
getNode(nodeId: string, includeFields: string[] = []): Observable<NodeEntry> {
|
||||
|
||||
const includeFieldsRequest = ['path', 'properties', 'allowableOperations', 'permissions', 'definition', ...includeFields]
|
||||
.filter((element, index, array) => index === array.indexOf(element));
|
||||
|
||||
@@ -146,7 +145,6 @@ export class DocumentListService implements DocumentListLoader {
|
||||
* @returns Details of the folder
|
||||
*/
|
||||
getFolderNode(nodeId: string, includeFields: string[] = []): Observable<NodeEntry> {
|
||||
|
||||
const includeFieldsRequest = ['path', 'properties', 'allowableOperations', 'permissions', 'aspectNames', ...includeFields]
|
||||
.filter((element, index, array) => index === array.indexOf(element));
|
||||
|
||||
@@ -184,7 +182,7 @@ export class DocumentListService implements DocumentListLoader {
|
||||
}
|
||||
|
||||
private retrieveDocumentNode(nodeId: string, pagination: PaginationModel, includeFields: string[], where?: string, orderBy?: string[]): Observable<DocumentLoaderNode> {
|
||||
return forkJoin(
|
||||
return forkJoin([
|
||||
this.getFolderNode(nodeId, includeFields),
|
||||
this.getFolder(null, {
|
||||
maxItems: pagination.maxItems,
|
||||
@@ -192,7 +190,7 @@ export class DocumentListService implements DocumentListLoader {
|
||||
orderBy: orderBy,
|
||||
rootFolderId: nodeId,
|
||||
where: where
|
||||
}, includeFields)).pipe(
|
||||
}, includeFields)]).pipe(
|
||||
map((results) => new DocumentLoaderNode(results[0], results[1]))
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user