Skip to content

Commit

Permalink
[ACA-2834][ACA-2837][ACA-2835] regression fixes (#1270)
Browse files Browse the repository at this point in the history
* disable lazy loading for certain routes

* backwards compatibility for old viewer routes

* remove old lazy modules
  • Loading branch information
Denys Vuika authored and Martin Muller committed Nov 28, 2019
1 parent 5ae1225 commit 961d389
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 207 deletions.
19 changes: 16 additions & 3 deletions projects/aca-shared/rules/src/navigation.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ import { RuleContext } from '@alfresco/adf-extensions';
*/
export function isPreview(context: RuleContext): boolean {
const { url } = context.navigation;
return url && (url.includes('viewer:view') || url.includes('/view/'));
return (
url &&
(url.includes('/preview/') ||
url.includes('viewer:view') ||
url.includes('/view/'))
);
}

/**
Expand Down Expand Up @@ -165,7 +170,11 @@ export function isNotSearchResults(context: RuleContext): boolean {
*/
export function isSharedPreview(context: RuleContext): boolean {
const { url } = context.navigation;
return url && url.startsWith('/shared') && url.includes('viewer:view');
return (
url &&
(url.startsWith('/shared/preview/') ||
(url.startsWith('/shared') && url.includes('viewer:view')))
);
}

/**
Expand All @@ -174,7 +183,11 @@ export function isSharedPreview(context: RuleContext): boolean {
*/
export function isFavoritesPreview(context: RuleContext): boolean {
const { url } = context.navigation;
return url && url.startsWith('/favorites') && url.includes('viewer:view');
return (
url &&
(url.startsWith('/favorites/preview/') ||
(url.startsWith('/favorites') && url.includes('viewer:view')))
);
}

/**
Expand Down
9 changes: 8 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ import { AppSearchResultsModule } from './components/search/search-results.modul
import { AppLoginModule } from './components/login/login.module';
import { AppHeaderModule } from './components/header/header.module';
import { AppNodeVersionModule } from './components/node-version/node-version.module';
import { FavoritesComponent } from './components/favorites/favorites.component';
import { RecentFilesComponent } from './components/recent-files/recent-files.component';
import { SharedFilesComponent } from './components/shared-files/shared-files.component';

import { environment } from '../environments/environment';

import { registerLocaleData } from '@angular/common';
Expand Down Expand Up @@ -151,7 +155,10 @@ registerLocaleData(localeSv);
LibrariesComponent,
FavoriteLibrariesComponent,
NodeVersionUploadDialogComponent,
NodeVersionsDialogComponent
NodeVersionsDialogComponent,
FavoritesComponent,
RecentFilesComponent,
SharedFilesComponent
],
providers: [
{ provide: RouteReuseStrategy, useClass: AppRouteReuseStrategy },
Expand Down
93 changes: 87 additions & 6 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ import {
GenericErrorComponent
} from '@alfresco/aca-shared';
import { AuthGuardEcm, AuthGuard } from '@alfresco/adf-core';
import { FavoritesComponent } from './components/favorites/favorites.component';
import { RecentFilesComponent } from './components/recent-files/recent-files.component';
import { SharedFilesComponent } from './components/shared-files/shared-files.component';

export const APP_ROUTES: Routes = [
{
Expand Down Expand Up @@ -92,6 +95,14 @@ export const APP_ROUTES: Routes = [
defaultNodeId: '-my-'
}
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'personal-files'
}
},
{
path: 'view/:nodeId',
outlet: 'viewer',
Expand Down Expand Up @@ -119,6 +130,22 @@ export const APP_ROUTES: Routes = [
sortingPreferenceKey: 'personal-files'
}
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'personal-files'
}
},
// deprecated, backwards compatibility with ACA 1.8
{
path: ':folderId/preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'personal-files'
}
},
{
path: 'view/:nodeId',
outlet: 'viewer',
Expand Down Expand Up @@ -159,6 +186,14 @@ export const APP_ROUTES: Routes = [
sortingPreferenceKey: 'libraries-files'
}
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'libraries'
}
},
{
path: 'view/:nodeId',
outlet: 'viewer',
Expand Down Expand Up @@ -196,8 +231,21 @@ export const APP_ROUTES: Routes = [
children: [
{
path: '',
loadChildren:
'./components/favorites/favorites.module#AppFavoritesModule'
component: FavoritesComponent,
data: {
title: 'APP.BROWSE.FAVORITES.TITLE',
sortingPreferenceKey: 'favorites'
}
// loadChildren:
// './components/favorites/favorites.module#AppFavoritesModule'
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'favorites'
}
},
{
path: 'view/:nodeId',
Expand All @@ -223,8 +271,20 @@ export const APP_ROUTES: Routes = [
children: [
{
path: '',
loadChildren:
'./components/recent-files/recent-files.module#AppRecentFilesModule'
component: RecentFilesComponent,
data: {
title: 'APP.BROWSE.RECENT.TITLE'
}
// loadChildren:
// './components/recent-files/recent-files.module#AppRecentFilesModule'
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'recent-files'
}
},
{
path: 'view/:nodeId',
Expand All @@ -247,8 +307,21 @@ export const APP_ROUTES: Routes = [
children: [
{
path: '',
loadChildren:
'./components/shared-files/shared-files.module#AppSharedFilesModule'
data: {
title: 'APP.BROWSE.SHARED.TITLE',
sortingPreferenceKey: 'shared-files'
},
component: SharedFilesComponent
// loadChildren:
// './components/shared-files/shared-files.module#AppSharedFilesModule'
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'shared'
}
},
{
path: 'view/:nodeId',
Expand Down Expand Up @@ -286,6 +359,14 @@ export const APP_ROUTES: Routes = [
title: 'APP.BROWSE.SEARCH.TITLE'
}
},
// deprecated, backwards compatibility with ACA 1.8
{
path: 'preview/:nodeId',
loadChildren: './components/preview/preview.module#PreviewModule',
data: {
navigateSource: 'search'
}
},
{
path: 'view/:nodeId',
outlet: 'viewer',
Expand Down
66 changes: 0 additions & 66 deletions src/app/components/favorites/favorites.module.ts

This file was deleted.

65 changes: 0 additions & 65 deletions src/app/components/recent-files/recent-files.module.ts

This file was deleted.

Loading

0 comments on commit 961d389

Please sign in to comment.