mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
114645: Add export in dsoPageSomeFeatureGuard and Fix some Lint issues
This commit is contained in:
@@ -18,7 +18,6 @@ describe('dsoPageSomeFeatureGuard and its functions', () => {
|
|||||||
let authorizationService: AuthorizationDataService;
|
let authorizationService: AuthorizationDataService;
|
||||||
let router: Router;
|
let router: Router;
|
||||||
let authService: AuthService;
|
let authService: AuthService;
|
||||||
// let resolver: Resolve<RemoteData<any>>;
|
|
||||||
let resolver: ResolveFn<Observable<RemoteData<any>>>;
|
let resolver: ResolveFn<Observable<RemoteData<any>>>;
|
||||||
let object: DSpaceObject;
|
let object: DSpaceObject;
|
||||||
let route;
|
let route;
|
||||||
@@ -74,14 +73,14 @@ describe('dsoPageSomeFeatureGuard and its functions', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
describe('getRouteWithDSOId', () => {
|
describe('getRouteWithDSOId', () => {
|
||||||
it('should return the route that has the UUID of the DSO', () => {
|
it('should return the route that has the UUID of the DSO', () => {
|
||||||
const foundRoute = getRouteWithDSOId(route);
|
const foundRoute = getRouteWithDSOId(route);
|
||||||
expect(foundRoute).toBe(parentRoute);
|
expect(foundRoute).toBe(parentRoute);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('dsoPageSomeFeatureGuard', () => {
|
describe('dsoPageSomeFeatureGuard', () => {
|
||||||
|
@@ -19,7 +19,7 @@ export declare type DSOGetObjectURlFn = <T extends DSpaceObject>(resolve: Resolv
|
|||||||
* Method to resolve resolve (parent) route that contains the UUID of the DSO
|
* Method to resolve resolve (parent) route that contains the UUID of the DSO
|
||||||
* @param route The current route
|
* @param route The current route
|
||||||
*/
|
*/
|
||||||
const getRouteWithDSOId = (route: ActivatedRouteSnapshot): ActivatedRouteSnapshot => {
|
export const getRouteWithDSOId = (route: ActivatedRouteSnapshot): ActivatedRouteSnapshot => {
|
||||||
let routeWithDSOId = route;
|
let routeWithDSOId = route;
|
||||||
while (hasNoValue(routeWithDSOId.params.id) && hasValue(routeWithDSOId.parent)) {
|
while (hasNoValue(routeWithDSOId.params.id) && hasValue(routeWithDSOId.parent)) {
|
||||||
routeWithDSOId = routeWithDSOId.parent;
|
routeWithDSOId = routeWithDSOId.parent;
|
||||||
@@ -29,7 +29,7 @@ const getRouteWithDSOId = (route: ActivatedRouteSnapshot): ActivatedRouteSnapsho
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const defaultDSOGetObjectUrl: DSOGetObjectURlFn = <T extends DSpaceObject>(resolve: ResolveFn<Observable<RemoteData<T>>>): StringGuardParamFn => {
|
export const defaultDSOGetObjectUrl: DSOGetObjectURlFn = <T extends DSpaceObject>(resolve: ResolveFn<Observable<RemoteData<T>>>): StringGuardParamFn => {
|
||||||
return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> => {
|
return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> => {
|
||||||
const routeWithObjectID = getRouteWithDSOId(route);
|
const routeWithObjectID = getRouteWithDSOId(route);
|
||||||
return (resolve(routeWithObjectID, state) as Observable<RemoteData<T>>).pipe(
|
return (resolve(routeWithObjectID, state) as Observable<RemoteData<T>>).pipe(
|
||||||
|
Reference in New Issue
Block a user