mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1992] Keep favorite libraries navigation under same path (#1474)
* [ACA-1992] Keep favorite libraries navigation under same path * Fix unit test
This commit is contained in:
@@ -47,7 +47,7 @@ export class CreateLibraryAction implements Action {
|
||||
export class NavigateLibraryAction implements Action {
|
||||
readonly type = LibraryActionTypes.Navigate;
|
||||
|
||||
constructor(public payload?: string) {}
|
||||
constructor(public payload?: string, public route?: string) {}
|
||||
}
|
||||
|
||||
export class UpdateLibraryAction implements Action {
|
||||
|
@@ -212,10 +212,15 @@ export const APP_ROUTES: Routes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'favorite/libraries',
|
||||
path: 'favorite',
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'libraries'
|
||||
},
|
||||
{
|
||||
path: 'libraries',
|
||||
component: FavoriteLibrariesComponent,
|
||||
data: {
|
||||
title: 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITLE',
|
||||
@@ -224,6 +229,33 @@ export const APP_ROUTES: Routes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'favorite/libraries/:folderId',
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: FilesComponent,
|
||||
data: {
|
||||
title: 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITLE',
|
||||
sortingPreferenceKey: 'libraries-files'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'view/:nodeId',
|
||||
outlet: 'viewer',
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
data: {
|
||||
navigateSource: 'libraries'
|
||||
},
|
||||
loadChildren:
|
||||
'./components/viewer/viewer.module#AppViewerModule'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'favorites',
|
||||
data: {
|
||||
|
@@ -144,7 +144,10 @@ describe('FavoriteLibrariesComponent', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
component.navigateTo({ entry: { guid: 'guid' } } as any);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(['libraries', 'libraryId']);
|
||||
expect(router.navigate).toHaveBeenCalledWith([
|
||||
'favorite/libraries',
|
||||
'libraryId'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -82,7 +82,9 @@ export class FavoriteLibrariesComponent extends PageComponent
|
||||
|
||||
navigateTo(node: SiteEntry) {
|
||||
if (node && node.entry && node.entry.guid) {
|
||||
this.store.dispatch(new NavigateLibraryAction(node.entry.guid));
|
||||
this.store.dispatch(
|
||||
new NavigateLibraryAction(node.entry.guid, 'favorite/libraries')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -107,7 +107,8 @@ export class LibraryEffects {
|
||||
.pipe(map(node => node.entry.id))
|
||||
.subscribe(
|
||||
id => {
|
||||
this.store.dispatch(new NavigateRouteAction(['libraries', id]));
|
||||
const route = action.route ? action.route : 'libraries';
|
||||
this.store.dispatch(new NavigateRouteAction([route, id]));
|
||||
},
|
||||
() => {
|
||||
this.store.dispatch(
|
||||
|
Reference in New Issue
Block a user