[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 280 additions and 36 deletions

View File

@ -24,6 +24,7 @@
*/
import { BrowsingPage, Viewer, Utils } from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
@ -104,7 +105,7 @@ export async function checkMultipleSelToolbarActions(items: string[], expectedTo
export async function checkViewerActions(item: string, expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise<void> {
await dataTable.selectItem(item);
await toolbar.viewButton.click();
await BrowserActions.click(toolbar.viewButton);
await viewer.waitForViewerToOpen();
let actualPrimaryActions = await viewerToolbar.getButtons();

36
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@alfresco/adf-cli": {
"version": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274.tgz",
"integrity": "sha512-qIWBfbrdhmU/FO2RO0ndpE3UrjkOd2ymvlCSm2kHH+oXPKJ8Uc3r4GuhVV8vOADE9znviVHfiABb5uIxWyeunw==",
"version": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947.tgz",
"integrity": "sha512-Bv/+ap+TCp7trV6LN9NuXkqti9K4kMYlnrEym11Or9qyvxbF4Pkod/SvIDF3EMohYixe6hgNR6hNBd4eND8O7g==",
"dev": true,
"requires": {
"@angular-devkit/core": "^7.2.15",
@ -29,42 +29,42 @@
}
},
"@alfresco/adf-content-services": {
"version": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274.tgz",
"integrity": "sha512-nuA6DBSzg3BUxrBQBc7JguMjeZg0zzyL6EYugifMvgIq2jINmkoGtnawwmEUUYgQTE92BQy3ganBNnhF+vsFwg==",
"version": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947.tgz",
"integrity": "sha512-HoFyeql+6FPopthgB90Y1Ii7vFxbH/1NTGsVDdB/VlncVk6FR3cpVrwDCVITS0Fjz25H8vrqcyx09SoCZBaFpQ==",
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/adf-core": {
"version": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274.tgz",
"integrity": "sha512-SK50PK5WLp3KL9kxpagLGLI0kBRp1GyDXtU3b3e6+7RC+X3/5bGhR/CaNdvA4is1IZcjQfPio1+tYAfDgY1wkA==",
"version": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947.tgz",
"integrity": "sha512-xn+9lTIYc5v2UWtarjxT8Dcct5z98RFgIFQZBxJ4vqtFOg11JnRCatUvvzj+bzOEszt1oRdcqM0+6bAoriMqXA==",
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/adf-extensions": {
"version": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274.tgz",
"integrity": "sha512-aoqf2rabAMTC0JKZ9k7Erjh1vcv1MsK3XGpPdVut09x/DUs6aK/q9SYYcmzA1frwdSVCX+KE3Ze9Zdf23FKdaA==",
"version": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947.tgz",
"integrity": "sha512-yr1al9u01+CR8nlI4hvWKCH/zoyDSYCiTb3uKPPXxQQ793ady2I5oabKhU+Uwcxmd1cagy0AMPj7uLtNoHLgbA==",
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/adf-testing": {
"version": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274.tgz",
"integrity": "sha512-ZcUAqyoGarKTXModHuDpetSxHEe5pbTY7KHitsJLachnQwZHIcjtkpBXo/rbiQfwyjV/g62HgCjTd/OO3qPrVw==",
"version": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947.tgz",
"integrity": "sha512-MZD3ebjbsOi23TNUDjIh+l46uhvx4FhAo35//MdL5EkS9oI522d2SK2H7LRgDHoK8vl5lbM0lHEdgwnGj1VPxQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/js-api": {
"version": "3.9.0-3c60fbd55d299192dab288a28ec6e6e0b15ac9f3",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.9.0-3c60fbd55d299192dab288a28ec6e6e0b15ac9f3.tgz",
"integrity": "sha512-GjBQ2yAckDbrcmu31AEgLXOIyjbO7WQbg+fCI3shO/Rcujrl2y6r4uKABg3eHWGKy/EM7lfVQEmRS9wDmj7Bag==",
"version": "3.9.0-b00012541e652f35b0460ae8f9db91dba84ac6a0",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.9.0-b00012541e652f35b0460ae8f9db91dba84ac6a0.tgz",
"integrity": "sha512-8T/r8rig8eH7TgMj2+fIElTh7czi9OnCDRN82qTbaDk9dqy1oxEy8P7qAc1X92Y+/dtepCh/40fSJuuzdBaTog==",
"requires": {
"event-emitter": "^0.3.5",
"minimatch": "3.0.4",

View File

@ -31,10 +31,10 @@
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"@alfresco/adf-core": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"@alfresco/adf-extensions": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"@alfresco/js-api": "3.9.0-3c60fbd55d299192dab288a28ec6e6e0b15ac9f3",
"@alfresco/adf-content-services": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"@alfresco/adf-core": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"@alfresco/adf-extensions": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"@alfresco/js-api": "3.9.0-b00012541e652f35b0460ae8f9db91dba84ac6a0",
"@angular-custom-builders/lite-serve": "0.0.2",
"@angular/animations": "7.2.15",
"@angular/cdk": "^7.3.7",
@ -67,8 +67,8 @@
"zone.js": "0.8.29"
},
"devDependencies": {
"@alfresco/adf-cli": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"@alfresco/adf-testing": "3.9.0-2a5fa954bd780873c4edb0251bfd6ccae87f9274",
"@alfresco/adf-cli": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"@alfresco/adf-testing": "3.9.0-238521e9be4ebdaadb51f095f4fc632a744d3947",
"@angular-devkit/build-angular": "~0.13.9",
"@angular-devkit/build-ng-packagr": "^0.13.10",
"@angular/cli": "^7.3.9",

View File

@ -29,8 +29,10 @@ import {
UserPreferencesService,
AppConfigService,
PaginationComponent,
CoreModule,
PaginationModel
PaginationModel,
AlfrescoApiService,
AlfrescoApiServiceMock,
CoreTestingModule
} from '@alfresco/adf-core';
import { LibTestingModule } from '../testing/lib-testing-module';
import { SharedDirectivesModule } from './shared.directives.module';
@ -49,7 +51,10 @@ describe('PaginationDirective', () => {
TranslateModule.forRoot(),
LibTestingModule,
SharedDirectivesModule,
CoreModule.forRoot()
CoreTestingModule
],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
]
});

View File

@ -24,6 +24,7 @@
*/
import { ElementFinder, by, browser } from 'protractor';
import { BrowserActions } from '@alfresco/adf-testing';
import { Menu } from '../menu/menu';
import { Component } from '../component';
import { Utils } from '../../utilities/utils';
@ -86,7 +87,7 @@ export class Toolbar extends Component {
await this.isButtonPresent('More Actions');
const moreMenu = this.getButtonByTitleAttribute('More Actions');
await moreMenu.click();
await BrowserActions.click(moreMenu);
await this.menu.waitForMenuToOpen();
}

View File

@ -370,5 +370,175 @@
}
}
]
},
"search-headers": {
"app:fields": [
"cm:name",
"cm:title",
"cm:description",
"ia:whatEvent",
"ia:descriptionEvent",
"lnk:title",
"lnk:description",
"TEXT",
"TAG"
],
"categories": [
{
"id": "queryName",
"name": "Name",
"columnKey": "name",
"enabled": true,
"expanded": true,
"component": {
"selector": "text",
"settings": {
"pattern": "cm:name:'(.*?)'",
"field": "cm:name",
"placeholder": "Enter the name"
}
}
},
{
"id": "checkList",
"name": "Check List",
"columnKey":"$thumbnail",
"enabled": true,
"component": {
"selector": "check-list",
"settings": {
"pageSize": 5,
"operator": "OR",
"options": [
{
"name": "Folder",
"value": "TYPE:'cm:folder'"
},
{
"name": "Document",
"value": "TYPE:'cm:content'"
}
]
}
}
},
{
"id": "contentSizeRange",
"name": "Content Size (range)",
"enabled": true,
"component": {
"selector": "number-range",
"settings": {
"field": "cm:content.size",
"format": "[{FROM} TO {TO}]"
}
}
},
{
"id": "contentSize",
"name": "SEARCH.CATEGORIES.SIZE",
"columnKey":"content.sizeInBytes",
"enabled": true,
"component": {
"selector": "check-list",
"settings": {
"options": [
{
"name": "Small",
"value": "content.size:[0 TO 1048576>"
},
{
"name": "Medium",
"value": "content.size:[1048576 TO 52428800]"
},
{
"name": "Large",
"value": "content.size:<52428800 TO 524288000]"
},
{
"name": "Huge",
"value": "content.size:<524288000 TO MAX]"
}
]
}
}
},
{
"id": "createdDateRange",
"name": "Created Date (range)",
"columnKey": "createdAt",
"enabled": true,
"component": {
"selector": "date-range",
"settings": {
"field": "cm:created",
"dateFormat": "DD-MMM-YY",
"maxDate": "today"
}
}
}
],
"highlight": {
"prefix": " ",
"postfix": " ",
"mergeContiguous": true,
"fields": [
{
"field": "cm:title"
},
{
"field": "description",
"prefix": "(",
"postfix": ")"
}
]
},
"sorting": {
"options": [
{
"key": "name",
"label": "Name",
"type": "FIELD",
"field": "cm:name",
"ascending": true
},
{
"key": "content.sizeInBytes",
"label": "Size",
"type": "FIELD",
"field": "content.size",
"ascending": true
},
{
"key": "createdByUser",
"label": "Author",
"type": "FIELD",
"field": "cm:creator",
"ascending": true
},
{
"key": "createdAt",
"label": "Created",
"type": "FIELD",
"field": "cm:created",
"ascending": true
},
{
"key": "score",
"label": "Relevance",
"type": "FIELD",
"field": "score",
"ascending": false
}
],
"defaults": [
{
"key": "score",
"type": "FIELD",
"field": "score",
"ascending": false
}
]
}
}
}

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"