[ACA-3468] Enable Document List filters in ACA (#1495)

* [ACA-3471] too long french translation doesn't fix in the UI (#1499)

* [ACA-3538] Fix search result layout (#1500)

* [ACA-3468] Enable Document List filters in ACA

* [ACA-3468] Get pagination settings from document list

* [ACA-3468] Move event handlers and pagination to page component

* [ACA-3468] Remove useless OnChanges

* [ACA-3468] Fix linter

* [ACA-3468] Add test for document list definition

* [ACA-3468] Fix lint

* [ACA-3468] Remove identifier

* [ACA-3468] Update to lastest ADF alpha to fix search result

* [ACA-3468] Update to lastest ADF alpha

* Fixed unit test

* re-enable tests

* rollback changes to test

* fix reload

* * fixed search e2e

* fix issue with page reload on search results

* update tests

Co-authored-by: arditdomi <32884230+arditdomi@users.noreply.github.com>
Co-authored-by: PizzaVito <vito.albano.123@gmail.com>
Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
Co-authored-by: dhrn <dharan.g@muraai.com>
This commit is contained in:
Baptiste Mahé
2020-06-29 18:28:31 +02:00
committed by GitHub
parent ef5457875e
commit 2e8b863413
10 changed files with 280 additions and 36 deletions

View File

@@ -21,7 +21,11 @@
<aca-page-layout-content>
<div class="main-content">
<adf-upload-drag-area [rootFolderId]="node?.id" [disabled]="!canUpload" (updateFileVersion)="onUploadNewVersion($event)">
<adf-upload-drag-area
[rootFolderId]="node?.id"
[disabled]="!canUpload"
(updateFileVersion)="onUploadNewVersion($event)"
>
<adf-document-list
#documentList
acaDocumentList
@@ -30,12 +34,27 @@
[sorting]="['modifiedAt', 'desc']"
selectionMode="multiple"
[currentFolderId]="node?.id"
[showHeader]="showHeader"
[node]="nodeResult"
[allowDropFiles]="true"
[navigate]="false"
[imageResolver]="imageResolver"
(node-dblclick)="navigateTo($event.detail?.node)"
(name-click)="navigateTo($event.detail?.node)"
>
<adf-custom-header-filter-template>
<ng-template let-col>
<adf-search-header
[col]="col"
[currentFolderNodeId]="node?.id"
[maxItems]="pagination?.maxItems"
[skipCount]="pagination?.skipCount"
(update)="onFilterUpdate($event)"
(clear)="onAllFilterCleared()"
>
</adf-search-header>
</ng-template>
</adf-custom-header-filter-template>
<data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById">
<ng-container

View File

@@ -45,10 +45,20 @@ import {
} from '@alfresco/aca-shared/store';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { ShareDataRow } from '@alfresco/adf-content-services';
import {
ShareDataRow,
SEARCH_QUERY_SERVICE_TOKEN,
SearchHeaderQueryBuilderService
} from '@alfresco/adf-content-services';
@Component({
templateUrl: './files.component.html'
templateUrl: './files.component.html',
providers: [
{
provide: SEARCH_QUERY_SERVICE_TOKEN,
useClass: SearchHeaderQueryBuilderService
}
]
})
export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
isValidPath = true;

View File

@@ -27,10 +27,22 @@ import {
DocumentListComponent,
ShareDataRow
} from '@alfresco/adf-content-services';
import { ShowHeaderMode } from '@alfresco/adf-core';
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { OnDestroy, OnInit, ViewChild } from '@angular/core';
import {
OnDestroy,
OnInit,
OnChanges,
ViewChild,
SimpleChanges
} from '@angular/core';
import { Store } from '@ngrx/store';
import { MinimalNodeEntity, MinimalNodeEntryEntity } from '@alfresco/js-api';
import {
MinimalNodeEntity,
MinimalNodeEntryEntity,
Pagination,
NodePaging
} from '@alfresco/js-api';
import { Observable, Subject, Subscription } from 'rxjs';
import { takeUntil, map } from 'rxjs/operators';
import { ContentManagementService } from '../services/content-management.service';
@@ -48,7 +60,7 @@ import {
} from '@alfresco/aca-shared/store';
import { isLocked, isLibrary, AppExtensionService } from '@alfresco/aca-shared';
export abstract class PageComponent implements OnInit, OnDestroy {
export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
onDestroy$: Subject<boolean> = new Subject<boolean>();
@ViewChild(DocumentListComponent)
@@ -64,6 +76,9 @@ export abstract class PageComponent implements OnInit, OnDestroy {
viewerToolbarActions: Array<ContentActionRef> = [];
canUpdateNode = false;
canUpload = false;
nodeResult: NodePaging;
pagination: Pagination;
showHeader = ShowHeaderMode.Always;
protected subscriptions: Subscription[] = [];
@@ -101,6 +116,20 @@ export abstract class PageComponent implements OnInit, OnDestroy {
.subscribe(node => {
this.canUpload = node && this.content.canUploadContent(node);
});
if (this.documentList && this.documentList.pagination) {
this.documentList.pagination
.pipe(takeUntil(this.onDestroy$))
.subscribe((newPagination: Pagination) => {
this.pagination = newPagination;
});
}
}
ngOnChanges(changes: SimpleChanges) {
if (changes.nodeResult && changes.nodeResult.currentValue) {
this.nodeResult = changes.nodeResult.currentValue;
}
}
ngOnDestroy() {
@@ -158,4 +187,13 @@ export abstract class PageComponent implements OnInit, OnDestroy {
private isOutletPreviewUrl(): boolean {
return location.href.includes('viewer:view');
}
onFilterUpdate(newNodePaging: NodePaging) {
this.nodeResult = newNodePaging;
}
onAllFilterCleared() {
this.documentList.node = null;
this.store.dispatch(new ReloadDocumentListAction());
}
}

View File

@@ -48,7 +48,7 @@
#documentList
acaContextActions
acaDocumentList
[showHeader]="true"
[showHeader]="showHeader"
[selectionMode]="'single'"
[sorting]="['name', 'asc']"
[node]="data"