Lazy load all routes

This commit is contained in:
Chocobozzz 2020-06-23 14:49:20 +02:00 committed by Chocobozzz
parent 67ed6552b8
commit 1942f11d5e
114 changed files with 94 additions and 56 deletions

View File

@ -3,6 +3,7 @@ import { Actor } from '@app/shared/shared-main'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoAbusePredefinedReasonsString } from '../../../../../../shared/models/videos/abuse/video-abuse-reason.model'
import { ProcessedVideoAbuse } from './video-abuse-list.component'
import { durationToString } from '@app/helpers'
@Component({
selector: 'my-video-abuse-details',

View File

@ -6,7 +6,7 @@ import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.s
const loginRoutes: Routes = [
{
path: 'login',
path: '',
component: LoginComponent,
canActivate: [ MetaGuard ],
data: {

View File

@ -5,7 +5,7 @@ import { ResetPasswordComponent } from './reset-password.component'
const resetPasswordRoutes: Routes = [
{
path: 'reset-password',
path: '',
component: ResetPasswordComponent,
canActivate: [ MetaGuard ],
data: {

View File

@ -1,7 +1,7 @@
import { map } from 'rxjs/operators'
import { Injectable } from '@angular/core'
import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router'
import { SearchService } from './search.service'
import { SearchService } from '@app/shared/shared-search'
@Injectable()
export class ChannelLazyLoadResolver implements Resolve<any> {

View File

@ -1,8 +1,8 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
import { ValidatorFn } from '@angular/forms'
import { ServerService } from '@app/core'
import { AdvancedSearch } from '@app/search/advanced-search.model'
import { VideoValidatorsService } from '@app/shared/shared-forms'
import { AdvancedSearch } from '@app/shared/shared-search'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, VideoConstant } from '@shared/models'

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { SearchComponent } from '@app/search/search.component'
import { MetaGuard } from '@ngx-meta/core'
import { VideoLazyLoadResolver } from './video-lazy-load.resolver'
import { ChannelLazyLoadResolver } from './channel-lazy-load.resolver'
import { SearchComponent } from './search.component'
import { VideoLazyLoadResolver } from './video-lazy-load.resolver'
const searchRoutes: Routes = [
{
path: 'search',
path: '',
component: SearchComponent,
canActivate: [ MetaGuard ],
data: {
@ -17,7 +17,7 @@ const searchRoutes: Routes = [
}
},
{
path: 'search/lazy-load-video',
path: 'lazy-load-video',
component: SearchComponent,
canActivate: [ MetaGuard ],
resolve: {
@ -25,7 +25,7 @@ const searchRoutes: Routes = [
}
},
{
path: 'search/lazy-load-channel',
path: 'lazy-load-channel',
component: SearchComponent,
canActivate: [ MetaGuard ],
resolve: {

View File

@ -4,12 +4,11 @@ import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, ComponentPagination, HooksService, Notifier, ServerService, User, UserService } from '@app/core'
import { immutableAssign } from '@app/helpers'
import { Video, VideoChannel } from '@app/shared/shared-main'
import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature'
import { MetaService } from '@ngx-meta/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { SearchTargetType, ServerConfig } from '@shared/models'
import { AdvancedSearch } from './advanced-search.model'
import { SearchService } from './search.service'
@Component({
selector: 'my-search',

View File

@ -2,14 +2,14 @@ import { TagInputModule } from 'ngx-chips'
import { NgModule } from '@angular/core'
import { SharedFormModule } from '@app/shared/shared-forms'
import { SharedMainModule } from '@app/shared/shared-main'
import { SharedSearchModule } from '@app/shared/shared-search'
import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
import { SearchService } from '../shared/shared-search/search.service'
import { ChannelLazyLoadResolver } from './channel-lazy-load.resolver'
import { HighlightPipe } from './highlight.pipe'
import { SearchFiltersComponent } from './search-filters.component'
import { SearchRoutingModule } from './search-routing.module'
import { SearchComponent } from './search.component'
import { SearchService } from './search.service'
import { VideoLazyLoadResolver } from './video-lazy-load.resolver'
@NgModule({
@ -17,7 +17,9 @@ import { VideoLazyLoadResolver } from './video-lazy-load.resolver'
TagInputModule,
SearchRoutingModule,
SharedMainModule,
SharedSearchModule,
SharedFormModule,
SharedUserSubscriptionModule,
SharedVideoMiniatureModule
@ -36,8 +38,7 @@ import { VideoLazyLoadResolver } from './video-lazy-load.resolver'
providers: [
SearchService,
VideoLazyLoadResolver,
ChannelLazyLoadResolver,
HighlightPipe
ChannelLazyLoadResolver
]
})
export class SearchModule { }

View File

@ -1,7 +1,7 @@
import { map } from 'rxjs/operators'
import { Injectable } from '@angular/core'
import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router'
import { SearchService } from './search.service'
import { SearchService } from '@app/shared/shared-search'
@Injectable()
export class VideoLazyLoadResolver implements Resolve<any> {

View File

@ -4,7 +4,7 @@ import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@a
import { scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send'
import { VideoSend } from './video-send'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy, VideoUpdate } from '@shared/models'

View File

@ -5,7 +5,7 @@ import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@a
import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send'
import { VideoSend } from './video-send'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy, VideoUpdate } from '@shared/models'

View File

@ -7,10 +7,10 @@ import { AuthService, CanComponentDeactivate, Notifier, ServerService, UserServi
import { scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy } from '@shared/models'
import { VideoSend } from './video-send'
@Component({
selector: 'my-video-upload',

View File

@ -1,9 +1,9 @@
import { NgModule } from '@angular/core'
import { CanDeactivateGuard } from '@app/core'
import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver'
import { VideoEditModule } from './shared/video-edit.module'
import { VideoUpdateRoutingModule } from './video-update-routing.module'
import { VideoUpdateComponent } from './video-update.component'
import { VideoUpdateResolver } from './video-update.resolver'
@NgModule({
imports: [

View File

@ -2,9 +2,8 @@ import { Observable, of } from 'rxjs'
import { map, switchMap } from 'rxjs/operators'
import { Injectable } from '@angular/core'
import { ServerService, UserService } from '@app/core'
import { AdvancedSearch } from '@app/search/advanced-search.model'
import { SearchService } from '@app/search/search.service'
import { Video, VideoService } from '@app/shared/shared-main'
import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
import { ServerConfig } from '@shared/models'
import { RecommendationInfo } from './recommendation-info.model'
import { RecommendationService } from './recommendations.service'

View File

@ -2,6 +2,7 @@ import { InputSwitchModule } from 'primeng/inputswitch'
import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { SharedMainModule } from '@app/shared/shared-main'
import { SharedSearchModule } from '@app/shared/shared-search'
import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
import { RecentVideosRecommendationService } from './recent-videos-recommendation.service'
@ -14,6 +15,7 @@ import { RecommendedVideosStore } from './recommended-videos.store'
InputSwitchModule,
SharedMainModule,
SharedSearchModule,
SharedVideoPlaylistModule,
SharedVideoMiniatureModule
],

View File

@ -7,7 +7,7 @@ import { SharedModerationModule } from '@app/shared/shared-moderation'
import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module'
import { RecommendationsModule } from './recommendations/recommendations.module'
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
import { VideoCommentAddComponent } from './comment/video-comment-add.component'
import { VideoCommentComponent } from './comment/video-comment.component'

View File

@ -1,17 +1,17 @@
import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { VideoLocalComponent } from '@app/videos/video-list/video-local.component'
import { MetaGuard } from '@ngx-meta/core'
import { VideoOverviewComponent } from './video-list/overview/video-overview.component'
import { VideoLocalComponent } from './video-list/video-local.component'
import { VideoMostLikedComponent } from './video-list/video-most-liked.component'
import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
import { VideoTrendingComponent } from './video-list/video-trending.component'
import { VideoMostLikedComponent } from './video-list/video-most-liked.component'
import { VideosComponent } from './videos.component'
import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component'
import { VideoOverviewComponent } from './video-list/overview/video-overview.component'
import { VideosComponent } from './videos.component'
const videosRoutes: Routes = [
{
path: 'videos',
path: '',
component: VideosComponent,
canActivateChild: [ MetaGuard ],
children: [
@ -91,7 +91,7 @@ const videosRoutes: Routes = [
},
{
path: 'upload',
loadChildren: () => import('@app/videos/+video-edit/video-add.module').then(m => m.VideoAddModule),
loadChildren: () => import('@app/+videos/+video-edit/video-add.module').then(m => m.VideoAddModule),
data: {
meta: {
title: 'Upload a video'
@ -100,7 +100,7 @@ const videosRoutes: Routes = [
},
{
path: 'update/:uuid',
loadChildren: () => import('@app/videos/+video-edit/video-update.module').then(m => m.VideoUpdateModule),
loadChildren: () => import('@app/+videos/+video-edit/video-update.module').then(m => m.VideoUpdateModule),
data: {
meta: {
title: 'Edit a video'
@ -109,7 +109,7 @@ const videosRoutes: Routes = [
},
{
path: 'watch',
loadChildren: () => import('@app/videos/+video-watch/video-watch.module').then(m => m.VideoWatchModule),
loadChildren: () => import('@app/+videos/+video-watch/video-watch.module').then(m => m.VideoWatchModule),
data: {
preload: 3000
}

Some files were not shown because too many files have changed in this diff Show More