[ADF-4039] Copy/Move of the files/folders is not working when the root folder of the user is chosen. (#4280)

* fix infinite pagination test

* ready event only after full source

* infinite init to pagesize maxitems

* infinite init to pagesize maxitems

* infinite init to pagesize maxitems
This commit is contained in:
Eugenio Romano
2019-02-07 01:55:00 +00:00
committed by GitHub
parent 3fd6b5d230
commit 262b37b759
3 changed files with 14 additions and 11 deletions

View File

@@ -56,6 +56,7 @@ import { NodeEntityEvent, NodeEntryEvent } from './node.event';
import { CustomResourcesService } from './../services/custom-resources.service'; import { CustomResourcesService } from './../services/custom-resources.service';
import { NavigableComponentInterface } from '../../breadcrumb/navigable-component.interface'; import { NavigableComponentInterface } from '../../breadcrumb/navigable-component.interface';
import { RowFilter } from '../data/row-filter.model'; import { RowFilter } from '../data/row-filter.model';
import { Observable } from 'rxjs/index';
@Component({ @Component({
selector: 'adf-document-list', selector: 'adf-document-list',
@@ -624,19 +625,24 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
where: this.where where: this.where
}, this.includeFields) }, this.includeFields)
.subscribe((nodePaging: NodePaging) => { .subscribe((nodePaging: NodePaging) => {
this.onPageLoaded(nodePaging); this.getSourceNodeWithPath(nodeId).subscribe((nodeEntry: NodeEntry) => {
this.getSourceNodeWithPath(nodeId); this.onPageLoaded(nodePaging);
});
}, (err) => { }, (err) => {
this.handleError(err); this.handleError(err);
}); });
} }
} }
getSourceNodeWithPath(nodeId: string) { getSourceNodeWithPath(nodeId: string): Observable<NodeEntry> {
this.documentListService.getFolderNode(nodeId, this.includeFields).subscribe((nodeEntry: NodeEntry) => { let getSourceObservable = this.documentListService.getFolderNode(nodeId, this.includeFields);
getSourceObservable.subscribe((nodeEntry: NodeEntry) => {
this.folderNode = nodeEntry.entry; this.folderNode = nodeEntry.entry;
this.$folderNode.next(this.folderNode); this.$folderNode.next(this.folderNode);
}); });
return getSourceObservable;
} }
resetSelection() { resetSelection() {

View File

@@ -217,7 +217,7 @@ describe('InfinitePaginationComponent', () => {
expect(spyTarget).toHaveBeenCalledWith({ expect(spyTarget).toHaveBeenCalledWith({
skipCount: 0, skipCount: 0,
maxItems: 25, maxItems: 50,
hasMoreItems: false, hasMoreItems: false,
merge: false merge: false
}); });
@@ -231,7 +231,7 @@ describe('InfinitePaginationComponent', () => {
component.onLoadMore(); component.onLoadMore();
expect(spyTarget).toHaveBeenCalledWith({ expect(spyTarget).toHaveBeenCalledWith({
maxItems: 7, maxItems: 14,
skipCount: 0, skipCount: 0,
hasMoreItems: false, hasMoreItems: false,
merge: false merge: false

View File

@@ -84,6 +84,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
this.userPreferencesService.select(UserPreferenceValues.PaginationSize).subscribe((pagSize) => { this.userPreferencesService.select(UserPreferenceValues.PaginationSize).subscribe((pagSize) => {
this.pageSize = this.pageSize || pagSize; this.pageSize = this.pageSize || pagSize;
this.requestPaginationModel.maxItems = this.pageSize;
}); });
} }
@@ -91,11 +92,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
this.requestPaginationModel.skipCount = 0; this.requestPaginationModel.skipCount = 0;
this.requestPaginationModel.merge = false; this.requestPaginationModel.merge = false;
if (!this.requestPaginationModel.maxItems) { this.requestPaginationModel.maxItems += this.pageSize;
this.requestPaginationModel.maxItems = this.pageSize;
} else {
this.requestPaginationModel.maxItems += this.pageSize;
}
this.loadMore.next(this.requestPaginationModel); this.loadMore.next(this.requestPaginationModel);