From 0a8438954b0b3f7b0d1ba805e9fd030ba6b36e45 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 17 Apr 2018 01:19:59 +0100 Subject: [PATCH] [ADF-2455] fix properly fall back datatable thumbnail fix search node selector drop down list style --- .travis.yml | 2 +- .../app/components/files/files.component.html | 2 +- .../dropdown-breadcrumb.component.html | 2 +- .../dropdown-breadcrumb.component.scss | 6 +++++- ...content-node-selector-panel.component.html | 1 + .../content-node-selector-panel.component.ts | 14 +++++++++++++ .../components/document-list.component.ts | 9 ++++++--- .../datatable/datatable.component.spec.ts | 4 ++-- .../datatable/datatable.component.ts | 20 +++++++++---------- .../infinite-pagination.component.ts | 1 - 10 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 012295c44f..361e9ad70e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ install: if ([ "$TRAVIS_BRANCH" = "master" ]); then (./scripts/npm-build-all.sh || exit 1;); else - (./scripts/npm-build-all.sh -vjsapi alpha || exit 1;); + (./scripts/npm-build-all.sh -vjsapi alpha -sb || exit 1;); fi fi diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index a98e66a05e..2de698f8f4 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -252,7 +252,7 @@ folder - chevron_right + chevron_right {{ 'ADF-DOCUMENT-LIST.LAYOUT.LOAD_MORE' | translate }} diff --git a/lib/content-services/content-node-selector/content-node-selector-panel.component.ts b/lib/content-services/content-node-selector/content-node-selector-panel.component.ts index 86d8f21488..c49cb30364 100644 --- a/lib/content-services/content-node-selector/content-node-selector-panel.component.ts +++ b/lib/content-services/content-node-selector/content-node-selector-panel.component.ts @@ -324,6 +324,20 @@ export class ContentNodeSelectorPanelComponent implements OnInit, PaginatedCompo return !this.showingSearchResults || this.chosenNode; } + /** + * Loads the next batch of search results + * + * @param event Pagination object + */ + getNextPageOfSearch(event: Pagination): void { + this.infiniteScroll = true; + this.skipCount = event.skipCount; + + if (this.searchTerm.length > 0) { + this.querySearch(); + } + } + /** * Selects node as chosen if it has the right permission, clears the selection otherwise * diff --git a/lib/content-services/document-list/components/document-list.component.ts b/lib/content-services/document-list/components/document-list.component.ts index 1eb0c316d8..cb7f237868 100644 --- a/lib/content-services/document-list/components/document-list.component.ts +++ b/lib/content-services/document-list/components/document-list.component.ts @@ -374,12 +374,15 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte this.resetNewFolderPagination(); this.loadFolder(); } else if (changes.currentFolderId && - changes.currentFolderId.currentValue && - changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) { + changes.currentFolderId.currentValue && + changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) { this.resetNewFolderPagination(); this.loadFolder(); } else if (this.data) { if (changes.node && changes.node.currentValue) { + if (changes.node.currentValue.list.pagination) { + changes.node.currentValue.list.pagination.skipCount = 0; + } this.data.loadPage(changes.node.currentValue); this.onDataReady(changes.node.currentValue); } else if (changes.rowFilter) { @@ -742,7 +745,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte this.currentFolderId = nodeId; this.resetNewFolderPagination(); this.loadFolder(); - this.folderChange.emit(new NodeEntryEvent({id: nodeId})); + this.folderChange.emit(new NodeEntryEvent({ id: nodeId })); } private resetNewFolderPagination() { diff --git a/lib/core/datatable/components/datatable/datatable.component.spec.ts b/lib/core/datatable/components/datatable/datatable.component.spec.ts index 2163e93b68..74bf3b050f 100644 --- a/lib/core/datatable/components/datatable/datatable.component.spec.ts +++ b/lib/core/datatable/components/datatable/datatable.component.spec.ts @@ -726,7 +726,7 @@ describe('DataTable', () => { expect(event.target.src).toBe(dataTable.fallbackThumbnail); }); - it('should replace image source only when fallback available', () => { + it('should replace image source with miscellaneous icon when fallback is not available', () => { const originalSrc = 'missing-image'; let event = { target: { @@ -736,7 +736,7 @@ describe('DataTable', () => { dataTable.fallbackThumbnail = null; dataTable.onImageLoadingError(event); - expect(event.target.src).toBe(originalSrc); + expect(event.target.src).toBe('./assets/images/ft_ic_miscellaneous.svg' ); }); it('should replace image source with icon if fallback is not available and mimeType is provided', () => { diff --git a/lib/core/datatable/components/datatable/datatable.component.ts b/lib/core/datatable/components/datatable/datatable.component.ts index 9cc9e52d7f..7475509ef2 100644 --- a/lib/core/datatable/components/datatable/datatable.component.ts +++ b/lib/core/datatable/components/datatable/datatable.component.ts @@ -162,11 +162,9 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck private singleClickStreamSub: Subscription; private multiClickStreamSub: Subscription; - constructor( - private elementRef: ElementRef, - differs: IterableDiffers, - private thumbnailService?: ThumbnailService - ) { + constructor(private elementRef: ElementRef, + differs: IterableDiffers, + private thumbnailService?: ThumbnailService) { if (differs) { this.differ = differs.find([]).create(null); } @@ -427,13 +425,15 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck } onImageLoadingError(event: Event, mimeType?: string) { - if (mimeType && !this.fallbackThumbnail) { - this.fallbackThumbnail = this.thumbnailService.getMimeTypeIcon(mimeType); - } - if (event && this.fallbackThumbnail) { + if (event) { let element = event.target; - element.src = this.fallbackThumbnail; + + if (this.fallbackThumbnail) { + element.src = this.fallbackThumbnail; + } else { + element.src = this.thumbnailService.getMimeTypeIcon(mimeType); + } } } diff --git a/lib/core/pagination/infinite-pagination.component.ts b/lib/core/pagination/infinite-pagination.component.ts index 458f956434..cd9733c3d6 100644 --- a/lib/core/pagination/infinite-pagination.component.ts +++ b/lib/core/pagination/infinite-pagination.component.ts @@ -62,7 +62,6 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio @Input('loading') isLoading: boolean = false; - /** @deprecated 2.3.0 use the paginated component interface to use it. */ /** Emitted when the "Load More" button is clicked. */ @Output() loadMore: EventEmitter = new EventEmitter();