[ACA-2834][ACA-2837][ACA-2835] regression fixes (#1270)

* disable lazy loading for certain routes

* backwards compatibility for old viewer routes

* remove old lazy modules
This commit is contained in:
Denys Vuika 2019-11-28 18:53:24 +00:00 committed by Martin Muller
parent 5ae12259d7
commit 961d3896e2
6 changed files with 111 additions and 207 deletions

View File

@ -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/'))
);
}
/**
@ -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')))
);
}
/**
@ -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')))
);
}
/**

View File

@ -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';
@ -151,7 +155,10 @@ registerLocaleData(localeSv);
LibrariesComponent,
FavoriteLibrariesComponent,
NodeVersionUploadDialogComponent,
NodeVersionsDialogComponent
NodeVersionsDialogComponent,
FavoritesComponent,
RecentFilesComponent,
SharedFilesComponent
],
providers: [
{ provide: RouteReuseStrategy, useClass: AppRouteReuseStrategy },

View File

@ -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 = [
{
@ -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',
@ -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',
@ -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',
@ -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',
@ -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',
@ -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',
@ -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',

View File

@ -1,66 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { NgModule } from '@angular/core';
import { FavoritesComponent } from './favorites.component';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { RouterModule, Routes } from '@angular/router';
import { ContentModule } from '@alfresco/adf-content-services';
import { DirectivesModule } from '../../directives/directives.module';
import { AppCommonModule } from '../common/common.module';
import { AppToolbarModule } from '../toolbar/toolbar.module';
import { ContextMenuModule } from '../context-menu/context-menu.module';
import { AppInfoDrawerModule } from '../info-drawer/info.drawer.module';
import { AppLayoutModule } from '../layout/layout.module';
const routes: Routes = [
{
path: '',
component: FavoritesComponent,
data: {
title: 'APP.BROWSE.FAVORITES.TITLE',
sortingPreferenceKey: 'favorites'
}
}
];
@NgModule({
imports: [
CommonModule,
CoreModule.forChild(),
RouterModule.forChild(routes),
ContentModule.forChild(),
DirectivesModule,
AppCommonModule,
AppToolbarModule,
ContextMenuModule,
AppInfoDrawerModule,
AppLayoutModule
],
declarations: [FavoritesComponent],
exports: [FavoritesComponent]
})
export class AppFavoritesModule {}

View File

@ -1,65 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { RouterModule, Routes } from '@angular/router';
import { ContentModule } from '@alfresco/adf-content-services';
import { DirectivesModule } from '../../directives/directives.module';
import { AppCommonModule } from '../common/common.module';
import { AppToolbarModule } from '../toolbar/toolbar.module';
import { ContextMenuModule } from '../context-menu/context-menu.module';
import { RecentFilesComponent } from './recent-files.component';
import { AppInfoDrawerModule } from '../info-drawer/info.drawer.module';
import { AppLayoutModule } from '../layout/layout.module';
const routes: Routes = [
{
path: '',
component: RecentFilesComponent,
data: {
title: 'APP.BROWSE.RECENT.TITLE'
}
}
];
@NgModule({
imports: [
CommonModule,
CoreModule.forChild(),
RouterModule.forChild(routes),
ContentModule.forChild(),
DirectivesModule,
AppCommonModule,
AppToolbarModule,
ContextMenuModule,
AppInfoDrawerModule,
AppLayoutModule
],
declarations: [RecentFilesComponent],
exports: [RecentFilesComponent]
})
export class AppRecentFilesModule {}

View File

@ -1,66 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { NgModule } from '@angular/core';
import { SharedFilesComponent } from './shared-files.component';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { RouterModule, Routes } from '@angular/router';
import { ContentModule } from '@alfresco/adf-content-services';
import { DirectivesModule } from '../../directives/directives.module';
import { AppCommonModule } from '../common/common.module';
import { AppToolbarModule } from '../toolbar/toolbar.module';
import { ContextMenuModule } from '../context-menu/context-menu.module';
import { AppInfoDrawerModule } from '../info-drawer/info.drawer.module';
import { AppLayoutModule } from '../layout/layout.module';
const routes: Routes = [
{
path: '',
component: SharedFilesComponent,
data: {
title: 'APP.BROWSE.SHARED.TITLE',
sortingPreferenceKey: 'shared-files'
}
}
];
@NgModule({
imports: [
CommonModule,
CoreModule.forChild(),
RouterModule.forChild(routes),
ContentModule.forChild(),
DirectivesModule,
AppCommonModule,
AppToolbarModule,
ContextMenuModule,
AppInfoDrawerModule,
AppLayoutModule
],
declarations: [SharedFilesComponent],
exports: [SharedFilesComponent]
})
export class AppSharedFilesModule {}