mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-9583] Strip details segment from url (#5294)
* [ACS-9583] Fix the routing to viewer * [ACS-9583] Splice all segments after details * [ACS-9583] Fix unit test
This commit is contained in:
@@ -89,5 +89,14 @@ describe('ViewerEffects', () => {
|
|||||||
|
|
||||||
expect(router.navigateByUrl['calls'].argsFor(0)[0].toString()).toEqual('/view/(viewer:nodeId)?path=absolute-path');
|
expect(router.navigateByUrl['calls'].argsFor(0)[0].toString()).toEqual('/view/(viewer:nodeId)?path=absolute-path');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should navigate to the parent route and preserve the original location when opening the viewer', fakeAsync(() => {
|
||||||
|
store.dispatch(new ViewNodeAction('nodeId', { location: 'personal-files/details/abc123/permissions' }));
|
||||||
|
tick(100);
|
||||||
|
|
||||||
|
expect(router.navigateByUrl['calls'].argsFor(0)[0].toString()).toEqual(
|
||||||
|
'/personal-files/(viewer:view/nodeId)?location=personal-files%2Fdetails%2Fabc123%2Fpermissions'
|
||||||
|
);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -215,6 +215,11 @@ export class ViewerEffects {
|
|||||||
|
|
||||||
const urlSegments: UrlSegment[] = urlSegmentGroup.segments;
|
const urlSegments: UrlSegment[] = urlSegmentGroup.segments;
|
||||||
|
|
||||||
|
const detailsIndex = urlSegments.findIndex((segment) => segment.path === 'details');
|
||||||
|
if (detailsIndex > -1) {
|
||||||
|
urlSegments.splice(detailsIndex);
|
||||||
|
}
|
||||||
|
|
||||||
return urlSegments.reduce(function (acc, item) {
|
return urlSegments.reduce(function (acc, item) {
|
||||||
acc.push(item.path, item.parameters);
|
acc.push(item.path, item.parameters);
|
||||||
return acc;
|
return acc;
|
||||||
|
|||||||
Reference in New Issue
Block a user