mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-3506] - added refresh for filters (#1601)
* [ACA-3506] - added refresh for filters * Fix unit tests Co-authored-by: Vito Albano <vitoalbano@Vitos-MacBook-Pro.local> Co-authored-by: Cano <david.cano.nieto@gmail.com>
This commit is contained in:
parent
c4597e152a
commit
5c471ff34a
@ -39,10 +39,12 @@
|
||||
[col]="col"
|
||||
[currentFolderNodeId]="node?.id"
|
||||
[maxItems]="(documentList?.pagination | async)?.maxItems"
|
||||
[value]="queryParams ? queryParams[col.key] : null"
|
||||
[skipCount]="(documentList?.pagination | async)?.skipCount"
|
||||
[sorting]="filterSorting"
|
||||
(update)="onFilterUpdate($event)"
|
||||
(clear)="onAllFilterCleared()"
|
||||
(selection)="onFilterSelected($event)"
|
||||
>
|
||||
</adf-search-header>
|
||||
</ng-template>
|
||||
|
@ -67,7 +67,8 @@ describe('FilesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: {
|
||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
||||
params: of({ folderId: 'someId' })
|
||||
params: of({ folderId: 'someId' }),
|
||||
queryParamMap: of({})
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -51,6 +51,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
isSmallScreen = false;
|
||||
isAdmin = false;
|
||||
selectedNode: MinimalNodeEntity;
|
||||
queryParams = null;
|
||||
|
||||
private nodePath: PathElement[];
|
||||
|
||||
@ -78,6 +79,10 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.title = data.title;
|
||||
|
||||
route.queryParamMap.subscribe((queryMap: Params) => {
|
||||
this.queryParams = queryMap.params;
|
||||
});
|
||||
|
||||
route.params.subscribe(({ folderId }: Params) => {
|
||||
const nodeId = folderId || data.defaultNodeId;
|
||||
|
||||
@ -285,4 +290,19 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
onFilterSelected(currentActiveFilters: Map<string, string>) {
|
||||
const objectFromMap = {};
|
||||
currentActiveFilters.forEach((value: any, key) => {
|
||||
let paramValue = null;
|
||||
if (value && value.from && value.to) {
|
||||
paramValue = `${value.from}||${value.to}`;
|
||||
} else {
|
||||
paramValue = value;
|
||||
}
|
||||
objectFromMap[key] = paramValue;
|
||||
});
|
||||
|
||||
this.router.navigate([], { relativeTo: this.route, queryParams: objectFromMap });
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user