mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-4041] [ADW] Sort order doesn't work correctly after opening a document (#1738)
* [ACA-4041] [ADW] Sort order doesn't work correctly after opening a document * fixed header * * fix test and improvements Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
parent
8430ea0929
commit
b949aad9d4
@ -241,6 +241,13 @@ describe('FilesComponent', () => {
|
||||
expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'favourites', node.id]);
|
||||
});
|
||||
|
||||
it('should remove the header filters param on click of folders', () => {
|
||||
router.url = '/personal-files?name=abc';
|
||||
component.navigate(node.id);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(['personal-files', node.id]);
|
||||
});
|
||||
|
||||
it('should navigates to node when id provided', () => {
|
||||
router.url = '/personal-files';
|
||||
component.navigate(node.id);
|
||||
|
@ -124,18 +124,19 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
|
||||
navigate(nodeId: string = null) {
|
||||
const uuidRegEx = /[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-4[0-9A-Za-z]{3}-[89ABab][0-9A-Za-z]{3}-[0-9A-Za-z]{12}/gi;
|
||||
let urlToNavigate;
|
||||
let urlToNavigate: string[];
|
||||
const urlWithoutParams = this.router.url.split('?')[0];
|
||||
|
||||
if (this.router.url.match(uuidRegEx)) {
|
||||
if (urlWithoutParams.match(uuidRegEx)) {
|
||||
if (nodeId && !this.isRootNode(nodeId)) {
|
||||
urlToNavigate = this.router.url.replace(uuidRegEx, nodeId).split('/');
|
||||
urlToNavigate = urlWithoutParams.replace(uuidRegEx, nodeId).split('/');
|
||||
} else {
|
||||
urlToNavigate = this.router.url.replace(uuidRegEx, '').split('/');
|
||||
urlToNavigate = urlWithoutParams.replace(uuidRegEx, '').split('/');
|
||||
urlToNavigate.pop();
|
||||
}
|
||||
urlToNavigate.shift();
|
||||
} else {
|
||||
urlToNavigate = this.router.url.split('/');
|
||||
urlToNavigate = urlWithoutParams.split('/');
|
||||
if (nodeId && !this.isRootNode(nodeId)) {
|
||||
urlToNavigate.push(nodeId);
|
||||
}
|
||||
@ -296,6 +297,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
this.showHeader = ShowHeaderMode.Always;
|
||||
this.navigateToFilter(activeFilters);
|
||||
} else {
|
||||
this.router.navigate(['.'], { relativeTo: this.route });
|
||||
this.showHeader = ShowHeaderMode.Data;
|
||||
this.onAllFilterCleared();
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
this.navigationPath = params.path;
|
||||
this.navigationPath = params.path || params.location;
|
||||
});
|
||||
|
||||
if (this.route.snapshot.data && this.route.snapshot.data.navigateSource) {
|
||||
@ -420,7 +420,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private getFileLocation(): string {
|
||||
return this.router.parseUrl(this.navigationPath || this.router.url).root.children[PRIMARY_OUTLET].toString();
|
||||
return this.navigationPath || this.router.parseUrl(this.router.url).root.children[PRIMARY_OUTLET].toString();
|
||||
}
|
||||
|
||||
private shouldNavigate(element: HTMLElement): boolean {
|
||||
|
Loading…
x
Reference in New Issue
Block a user