70090: Added trail for processes pages

This commit is contained in:
lotte
2020-03-27 17:34:49 +01:00
committed by Art Lowel
parent d4609b87ea
commit b666e3f208
6 changed files with 108 additions and 15 deletions

View File

@@ -1,4 +1,6 @@
import { Router } from '@angular/router';
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
import { hasValue } from '../empty.util';
import { URLCombiner } from '../../core/url-combiner/url-combiner';
/**
* Util function to retrieve the current path (without query parameters) the user is on
@@ -8,3 +10,11 @@ export function currentPath(router: Router) {
const urlTree = router.parseUrl(router.url);
return '/' + urlTree.root.children.primary.segments.map((it) => it.path).join('/')
}
export function currentPathFromSnapshot(route: ActivatedRouteSnapshot): string {
if (hasValue(route.parent)) {
const parentRoute: string = currentPathFromSnapshot(route.parent);
return new URLCombiner(parentRoute, route.routeConfig.path).toString();
}
return route.routeConfig ? route.routeConfig.path : '';
}