From 693b1aba4675f7e3d850e0f6d07dbfc7bdff9b8c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 20 Nov 2016 17:18:15 +0100 Subject: Client: split in angular modules --- client/src/app/videos/index.ts | 3 +- client/src/app/videos/shared/video.service.ts | 3 +- .../app/videos/video-add/video-add.component.ts | 3 +- .../app/videos/video-list/video-list.component.ts | 3 +- client/src/app/videos/videos-routing.module.ts | 44 ++++++++++++++++++++++ client/src/app/videos/videos.module.ts | 42 +++++++++++++++++++++ client/src/app/videos/videos.routes.ts | 37 ------------------ 7 files changed, 94 insertions(+), 41 deletions(-) create mode 100644 client/src/app/videos/videos-routing.module.ts create mode 100644 client/src/app/videos/videos.module.ts delete mode 100644 client/src/app/videos/videos.routes.ts (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/index.ts b/client/src/app/videos/index.ts index a9088a907..ca386a51d 100644 --- a/client/src/app/videos/index.ts +++ b/client/src/app/videos/index.ts @@ -2,5 +2,6 @@ export * from './shared'; export * from './video-add'; export * from './video-list'; export * from './video-watch'; +export * from './videos-routing.module'; export * from './videos.component'; -export * from './videos.routes'; +export * from './videos.module'; diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index b1f688095..f173ef06b 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -4,7 +4,8 @@ import { Observable } from 'rxjs/Observable'; import { Search } from '../../shared'; import { SortField } from './sort-field.type'; -import { AuthHttp, AuthService, RestExtractor, RestPagination, RestService, ResultList } from '../../shared'; +import { AuthService } from '../../core'; +import { AuthHttp, RestExtractor, RestPagination, RestService, ResultList } from '../../shared'; import { Video } from './video.model'; @Injectable() diff --git a/client/src/app/videos/video-add/video-add.component.ts b/client/src/app/videos/video-add/video-add.component.ts index b7bf1534f..6eab54f7e 100644 --- a/client/src/app/videos/video-add/video-add.component.ts +++ b/client/src/app/videos/video-add/video-add.component.ts @@ -4,7 +4,8 @@ import { Router } from '@angular/router'; import { FileUploader } from 'ng2-file-upload/ng2-file-upload'; -import { AuthService, FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared'; +import { AuthService } from '../../core'; +import { FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared'; @Component({ selector: 'my-videos-add', diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts index 6b086e938..a8b92480b 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts @@ -7,7 +7,8 @@ import { Video, VideoService } from '../shared'; -import { AuthService, AuthUser, RestPagination, Search, SearchField } from '../../shared'; +import { AuthService } from '../../core'; +import { AuthUser, RestPagination, Search, SearchField } from '../../shared'; import { SearchService } from '../../shared'; @Component({ diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts new file mode 100644 index 000000000..766d29d22 --- /dev/null +++ b/client/src/app/videos/videos-routing.module.ts @@ -0,0 +1,44 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +import { VideoAddComponent } from './video-add'; +import { VideoListComponent } from './video-list'; +import { VideosComponent } from './videos.component'; +import { VideoWatchComponent } from './video-watch'; + +const videosRoutes: Routes = [ + { + path: 'videos', + component: VideosComponent, + children: [ + { + path: 'list', + component: VideoListComponent, + data: { + meta: { + titleSuffix: ' - Videos list' + } + } + }, + { + path: 'add', + component: VideoAddComponent, + data: { + meta: { + titleSuffix: ' - Add a video' + } + } + }, + { + path: 'watch/:id', + component: VideoWatchComponent + } + ] + } +]; + +@NgModule({ + imports: [ RouterModule.forChild(videosRoutes) ], + exports: [ RouterModule ] +}) +export class VideosRoutingModule {} diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts new file mode 100644 index 000000000..fb2f453b0 --- /dev/null +++ b/client/src/app/videos/videos.module.ts @@ -0,0 +1,42 @@ +import { NgModule } from '@angular/core'; + +import { VideosRoutingModule } from './videos-routing.module'; +import { VideosComponent } from './videos.component'; +import { VideoAddComponent } from './video-add'; +import { VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list'; +import { VideoWatchComponent, VideoMagnetComponent, VideoShareComponent, WebTorrentService } from './video-watch'; +import { LoaderComponent, VideoService } from './shared'; +import { SharedModule } from '../shared'; + +@NgModule({ + imports: [ + VideosRoutingModule, + SharedModule + ], + + declarations: [ + VideosComponent, + + VideoAddComponent, + + VideoListComponent, + VideoMiniatureComponent, + VideoSortComponent, + + VideoWatchComponent, + VideoMagnetComponent, + VideoShareComponent, + + LoaderComponent + ], + + exports: [ + VideosComponent + ], + + providers: [ + VideoService, + WebTorrentService + ] +}) +export class VideosModule { } diff --git a/client/src/app/videos/videos.routes.ts b/client/src/app/videos/videos.routes.ts deleted file mode 100644 index ab68fbe0c..000000000 --- a/client/src/app/videos/videos.routes.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Routes } from '@angular/router'; - -import { VideoAddComponent } from './video-add'; -import { VideoListComponent } from './video-list'; -import { VideosComponent } from './videos.component'; -import { VideoWatchComponent } from './video-watch'; - -export const VideosRoutes: Routes = [ - { - path: 'videos', - component: VideosComponent, - children: [ - { - path: 'list', - component: VideoListComponent, - data: { - meta: { - titleSuffix: ' - Videos list' - } - } - }, - { - path: 'add', - component: VideoAddComponent, - data: { - meta: { - titleSuffix: ' - Add a video' - } - } - }, - { - path: 'watch/:id', - component: VideoWatchComponent - } - ] - } -]; -- cgit v1.2.3