mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-8747] pass location as a query param (#4124)
This commit is contained in:
committed by
GitHub
parent
2286c722c8
commit
e206727121
@@ -98,7 +98,7 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
});
|
});
|
||||||
this.extensions
|
this.extensions
|
||||||
.getAllowedSidebarActions()
|
.getAllowedSidebarActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(first())
|
||||||
.subscribe((aspectActions) => {
|
.subscribe((aspectActions) => {
|
||||||
this.aspectActions = aspectActions;
|
this.aspectActions = aspectActions;
|
||||||
});
|
});
|
||||||
|
@@ -55,7 +55,7 @@ import {
|
|||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { RenditionService } from '@alfresco/adf-content-services';
|
import { RenditionService } from '@alfresco/adf-content-services';
|
||||||
import { ViewerEffects } from './viewer.effects';
|
import { ViewerEffects } from './viewer.effects';
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router, ActivatedRoute } from '@angular/router';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
@@ -75,7 +75,7 @@ describe('NodeEffects', () => {
|
|||||||
MatDialogModule,
|
MatDialogModule,
|
||||||
MatSnackBarModule
|
MatSnackBarModule
|
||||||
],
|
],
|
||||||
providers: [RenditionService]
|
providers: [RenditionService, { provide: ActivatedRoute, useValue: { queryParams: of({ location: 'test-page' }) } }]
|
||||||
});
|
});
|
||||||
|
|
||||||
store = TestBed.inject(Store);
|
store = TestBed.inject(Store);
|
||||||
@@ -561,7 +561,7 @@ describe('NodeEffects', () => {
|
|||||||
const node: any = { entry: { isFile: true, id: 'node-id' } };
|
const node: any = { entry: { isFile: true, id: 'node-id' } };
|
||||||
|
|
||||||
store.dispatch(new ExpandInfoDrawerAction(node));
|
store.dispatch(new ExpandInfoDrawerAction(node));
|
||||||
expect(store.dispatch).toHaveBeenCalledWith(new NavigateUrlAction('personal-files/details/node-id'));
|
expect(store.dispatch).toHaveBeenCalledWith(new NavigateUrlAction('personal-files/details/node-id?location=test-page'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Actions, ofType, createEffect } from '@ngrx/effects';
|
import { Actions, ofType, createEffect } from '@ngrx/effects';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable, SecurityContext } from '@angular/core';
|
||||||
import { first, map, take } from 'rxjs/operators';
|
import { first, map, take } from 'rxjs/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import {
|
import {
|
||||||
@@ -55,7 +55,8 @@ import {
|
|||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { ContentManagementService } from '../../services/content-management.service';
|
import { ContentManagementService } from '../../services/content-management.service';
|
||||||
import { RenditionService } from '@alfresco/adf-content-services';
|
import { RenditionService } from '@alfresco/adf-content-services';
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NodeEffects {
|
export class NodeEffects {
|
||||||
@@ -64,7 +65,9 @@ export class NodeEffects {
|
|||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private contentService: ContentManagementService,
|
private contentService: ContentManagementService,
|
||||||
private renditionViewer: RenditionService
|
private renditionViewer: RenditionService,
|
||||||
|
private activatedRoute: ActivatedRoute,
|
||||||
|
private sanitizer: DomSanitizer
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
shareNode$ = createEffect(
|
shareNode$ = createEffect(
|
||||||
@@ -314,20 +317,25 @@ export class NodeEffects {
|
|||||||
this.router.events
|
this.router.events
|
||||||
.pipe(first((event) => event instanceof NavigationEnd))
|
.pipe(first((event) => event instanceof NavigationEnd))
|
||||||
.subscribe(() => this.store.dispatch(new SetInfoDrawerStateAction(true)));
|
.subscribe(() => this.store.dispatch(new SetInfoDrawerStateAction(true)));
|
||||||
if (action?.payload) {
|
|
||||||
|
this.activatedRoute.queryParams.pipe(take(1)).subscribe((params) => {
|
||||||
|
const location = params.location || this.router.url;
|
||||||
|
const sanitizedLocation = this.sanitizer.sanitize(SecurityContext.URL, location);
|
||||||
const route = 'personal-files/details';
|
const route = 'personal-files/details';
|
||||||
this.store.dispatch(new NavigateUrlAction([route, action.payload.entry.id].join('/')));
|
|
||||||
|
if (action?.payload) {
|
||||||
|
this.store.dispatch(new NavigateUrlAction([route, action.payload.entry.id].join('/') + `?location=${sanitizedLocation}`));
|
||||||
} else {
|
} else {
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(take(1))
|
.pipe(take(1))
|
||||||
.subscribe((selection) => {
|
.subscribe((selection) => {
|
||||||
if (selection && !selection.isEmpty) {
|
if (selection && !selection.isEmpty) {
|
||||||
const route = 'personal-files/details';
|
this.store.dispatch(new NavigateUrlAction([route, selection.last.entry.id].join('/') + `?location=${sanitizedLocation}`));
|
||||||
this.store.dispatch(new NavigateUrlAction([route, selection.last.entry.id].join('/')));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
{ dispatch: false }
|
{ dispatch: false }
|
||||||
|
Reference in New Issue
Block a user