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"
|
[col]="col"
|
||||||
[currentFolderNodeId]="node?.id"
|
[currentFolderNodeId]="node?.id"
|
||||||
[maxItems]="(documentList?.pagination | async)?.maxItems"
|
[maxItems]="(documentList?.pagination | async)?.maxItems"
|
||||||
|
[value]="queryParams ? queryParams[col.key] : null"
|
||||||
[skipCount]="(documentList?.pagination | async)?.skipCount"
|
[skipCount]="(documentList?.pagination | async)?.skipCount"
|
||||||
[sorting]="filterSorting"
|
[sorting]="filterSorting"
|
||||||
(update)="onFilterUpdate($event)"
|
(update)="onFilterUpdate($event)"
|
||||||
(clear)="onAllFilterCleared()"
|
(clear)="onAllFilterCleared()"
|
||||||
|
(selection)="onFilterSelected($event)"
|
||||||
>
|
>
|
||||||
</adf-search-header>
|
</adf-search-header>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -67,7 +67,8 @@ describe('FilesComponent', () => {
|
|||||||
provide: ActivatedRoute,
|
provide: ActivatedRoute,
|
||||||
useValue: {
|
useValue: {
|
||||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
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;
|
isSmallScreen = false;
|
||||||
isAdmin = false;
|
isAdmin = false;
|
||||||
selectedNode: MinimalNodeEntity;
|
selectedNode: MinimalNodeEntity;
|
||||||
|
queryParams = null;
|
||||||
|
|
||||||
private nodePath: PathElement[];
|
private nodePath: PathElement[];
|
||||||
|
|
||||||
@ -78,6 +79,10 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.title = data.title;
|
this.title = data.title;
|
||||||
|
|
||||||
|
route.queryParamMap.subscribe((queryMap: Params) => {
|
||||||
|
this.queryParams = queryMap.params;
|
||||||
|
});
|
||||||
|
|
||||||
route.params.subscribe(({ folderId }: Params) => {
|
route.params.subscribe(({ folderId }: Params) => {
|
||||||
const nodeId = folderId || data.defaultNodeId;
|
const nodeId = folderId || data.defaultNodeId;
|
||||||
|
|
||||||
@ -285,4 +290,19 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
return false;
|
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