aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-20 17:18:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-21 22:09:45 +0100
commit693b1aba4675f7e3d850e0f6d07dbfc7bdff9b8c (patch)
treed6004d282a55d995eecba78bae95173bd0f11767 /client/src/app
parent2c8d4697db4b5a2d645b7bfcaf91093a64597958 (diff)
downloadPeerTube-693b1aba4675f7e3d850e0f6d07dbfc7bdff9b8c.tar.gz
PeerTube-693b1aba4675f7e3d850e0f6d07dbfc7bdff9b8c.tar.zst
PeerTube-693b1aba4675f7e3d850e0f6d07dbfc7bdff9b8c.zip
Client: split in angular modules
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/account/account-routing.module.ts22
-rw-r--r--client/src/app/account/account.module.ts26
-rw-r--r--client/src/app/account/account.routes.ts13
-rw-r--r--client/src/app/account/account.service.ts3
-rw-r--r--client/src/app/account/index.ts3
-rw-r--r--client/src/app/admin/admin-routing.module.ts (renamed from client/src/app/admin/admin.routes.ts)11
-rw-r--r--client/src/app/admin/admin.module.ts45
-rw-r--r--client/src/app/admin/index.ts3
-rw-r--r--client/src/app/app-routing.module.ts17
-rw-r--r--client/src/app/app.module.ts132
-rw-r--r--client/src/app/app.routes.ts18
-rw-r--r--client/src/app/core/auth/auth.service.ts (renamed from client/src/app/shared/auth/auth.service.ts)7
-rw-r--r--client/src/app/core/auth/index.ts1
-rw-r--r--client/src/app/core/core.module.ts21
-rw-r--r--client/src/app/core/index.ts2
-rw-r--r--client/src/app/core/module-import-guard.ts5
-rw-r--r--client/src/app/login/index.ts3
-rw-r--r--client/src/app/login/login-routing.module.ts22
-rw-r--r--client/src/app/login/login.component.ts3
-rw-r--r--client/src/app/login/login.module.ts24
-rw-r--r--client/src/app/login/login.routes.ts13
-rw-r--r--client/src/app/menu.component.ts3
-rw-r--r--client/src/app/shared/auth/auth-http.service.ts15
-rw-r--r--client/src/app/shared/auth/index.ts1
-rw-r--r--client/src/app/shared/index.ts1
-rw-r--r--client/src/app/shared/shared.module.ts62
-rw-r--r--client/src/app/videos/index.ts3
-rw-r--r--client/src/app/videos/shared/video.service.ts3
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts3
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts3
-rw-r--r--client/src/app/videos/videos-routing.module.ts (renamed from client/src/app/videos/videos.routes.ts)11
-rw-r--r--client/src/app/videos/videos.module.ts42
32 files changed, 369 insertions, 172 deletions
diff --git a/client/src/app/account/account-routing.module.ts b/client/src/app/account/account-routing.module.ts
new file mode 100644
index 000000000..8c1033cd2
--- /dev/null
+++ b/client/src/app/account/account-routing.module.ts
@@ -0,0 +1,22 @@
1import { NgModule } from '@angular/core';
2import { RouterModule, Routes } from '@angular/router';
3
4import { AccountComponent } from './account.component';
5
6const accountRoutes: Routes = [
7 {
8 path: 'account',
9 component: AccountComponent,
10 data: {
11 meta: {
12 titleSuffix: ' - My account'
13 }
14 }
15 }
16];
17
18@NgModule({
19 imports: [ RouterModule.forChild(accountRoutes) ],
20 exports: [ RouterModule ]
21})
22export class AccountRoutingModule {}
diff --git a/client/src/app/account/account.module.ts b/client/src/app/account/account.module.ts
new file mode 100644
index 000000000..53f6ba58e
--- /dev/null
+++ b/client/src/app/account/account.module.ts
@@ -0,0 +1,26 @@
1import { NgModule } from '@angular/core';
2
3import { AccountRoutingModule } from './account-routing.module';
4import { AccountComponent } from './account.component';
5import { AccountService } from './account.service';
6import { SharedModule } from '../shared';
7
8@NgModule({
9 imports: [
10 AccountRoutingModule,
11 SharedModule
12 ],
13
14 declarations: [
15 AccountComponent
16 ],
17
18 exports: [
19 AccountComponent
20 ],
21
22 providers: [
23 AccountService
24 ]
25})
26export class AccountModule { }
diff --git a/client/src/app/account/account.routes.ts b/client/src/app/account/account.routes.ts
deleted file mode 100644
index c382a6deb..000000000
--- a/client/src/app/account/account.routes.ts
+++ /dev/null
@@ -1,13 +0,0 @@
1import { AccountComponent } from './account.component';
2
3export const AccountRoutes = [
4 {
5 path: 'account',
6 component: AccountComponent,
7 data: {
8 meta: {
9 titleSuffix: ' - My account'
10 }
11 }
12 }
13];
diff --git a/client/src/app/account/account.service.ts b/client/src/app/account/account.service.ts
index 355bcef74..0635c2533 100644
--- a/client/src/app/account/account.service.ts
+++ b/client/src/app/account/account.service.ts
@@ -1,6 +1,7 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2 2
3import { AuthHttp, AuthService, RestExtractor } from '../shared'; 3import { AuthService } from '../core';
4import { AuthHttp, RestExtractor } from '../shared';
4 5
5@Injectable() 6@Injectable()
6export class AccountService { 7export class AccountService {
diff --git a/client/src/app/account/index.ts b/client/src/app/account/index.ts
index 823d9fe5f..be03713cb 100644
--- a/client/src/app/account/index.ts
+++ b/client/src/app/account/index.ts
@@ -1,3 +1,4 @@
1export * from './account-routing.module';
1export * from './account.component'; 2export * from './account.component';
2export * from './account.routes'; 3export * from './account.module';
3export * from './account.service'; 4export * from './account.service';
diff --git a/client/src/app/admin/admin.routes.ts b/client/src/app/admin/admin-routing.module.ts
index edb8ba49f..6bff25033 100644
--- a/client/src/app/admin/admin.routes.ts
+++ b/client/src/app/admin/admin-routing.module.ts
@@ -1,11 +1,12 @@
1import { Routes } from '@angular/router'; 1import { NgModule } from '@angular/core';
2import { RouterModule, Routes } from '@angular/router';
2 3
3import { AdminComponent } from './admin.component'; 4import { AdminComponent } from './admin.component';
4import { FriendsRoutes } from './friends'; 5import { FriendsRoutes } from './friends';
5import { RequestsRoutes } from './requests'; 6import { RequestsRoutes } from './requests';
6import { UsersRoutes } from './users'; 7import { UsersRoutes } from './users';
7 8
8export const AdminRoutes: Routes = [ 9const adminRoutes: Routes = [
9 { 10 {
10 path: 'admin', 11 path: 'admin',
11 component: AdminComponent, 12 component: AdminComponent,
@@ -21,3 +22,9 @@ export const AdminRoutes: Routes = [
21 ] 22 ]
22 } 23 }
23]; 24];
25
26@NgModule({
27 imports: [ RouterModule.forChild(adminRoutes) ],
28 exports: [ RouterModule ]
29})
30export class AdminRoutingModule {}
diff --git a/client/src/app/admin/admin.module.ts b/client/src/app/admin/admin.module.ts
new file mode 100644
index 000000000..63d99a3db
--- /dev/null
+++ b/client/src/app/admin/admin.module.ts
@@ -0,0 +1,45 @@
1import { NgModule } from '@angular/core';
2
3import { AdminComponent } from './admin.component';
4import { AdminRoutingModule } from './admin-routing.module';
5import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends';
6import { RequestsComponent, RequestStatsComponent, RequestService } from './requests';
7import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users';
8import { MenuAdminComponent } from './menu-admin.component';
9import { SharedModule } from '../shared';
10
11@NgModule({
12 imports: [
13 AdminRoutingModule,
14 SharedModule
15 ],
16
17 declarations: [
18 AdminComponent,
19
20 FriendsComponent,
21 FriendAddComponent,
22 FriendListComponent,
23
24 RequestsComponent,
25 RequestStatsComponent,
26
27 UsersComponent,
28 UserAddComponent,
29 UserListComponent,
30
31 MenuAdminComponent
32 ],
33
34 exports: [
35 AdminComponent,
36 MenuAdminComponent
37 ],
38
39 providers: [
40 FriendService,
41 RequestService,
42 UserService
43 ]
44})
45export class AdminModule { }
diff --git a/client/src/app/admin/index.ts b/client/src/app/admin/index.ts
index 493caed15..b75ff9b51 100644
--- a/client/src/app/admin/index.ts
+++ b/client/src/app/admin/index.ts
@@ -1,6 +1,7 @@
1export * from './friends'; 1export * from './friends';
2export * from './requests'; 2export * from './requests';
3export * from './users'; 3export * from './users';
4export * from './admin-routing.module';
5export * from './admin.module';
4export * from './admin.component'; 6export * from './admin.component';
5export * from './admin.routes';
6export * from './menu-admin.component'; 7export * from './menu-admin.component';
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
new file mode 100644
index 000000000..900a4c5b6
--- /dev/null
+++ b/client/src/app/app-routing.module.ts
@@ -0,0 +1,17 @@
1import { NgModule } from '@angular/core';
2import { Routes, RouterModule } from '@angular/router';
3
4const routes: Routes = [
5 {
6 path: '',
7 redirectTo: '/videos/list',
8 pathMatch: 'full'
9 }
10];
11
12@NgModule({
13 imports: [ RouterModule.forRoot(routes) ],
14 exports: [ RouterModule ]
15})
16export class AppRoutingModule {}
17
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 3f57897fb..555f412e7 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -1,62 +1,22 @@
1import { ApplicationRef, NgModule } from '@angular/core'; 1import { ApplicationRef, NgModule } from '@angular/core';
2import { BrowserModule } from '@angular/platform-browser'; 2import { BrowserModule } from '@angular/platform-browser';
3import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4import { HttpModule, RequestOptions, XHRBackend } from '@angular/http';
5import { RouterModule } from '@angular/router';
6import { removeNgStyles, createNewHosts } from '@angularclass/hmr'; 3import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
7 4
8import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; 5import { MetaModule, MetaConfig } from 'ng2-meta';
9 6
10import { DropdownModule } from 'ng2-bootstrap/components/dropdown';
11import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar';
12import { PaginationModule } from 'ng2-bootstrap/components/pagination';
13import { ModalModule } from 'ng2-bootstrap/components/modal';
14
15import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
16
17import { MetaConfig, MetaModule } from 'ng2-meta';
18
19/*
20 * Platform and Environment providers/directives/pipes
21 */
22import { ENV_PROVIDERS } from './environment'; 7import { ENV_PROVIDERS } from './environment';
23import { routes } from './app.routes'; 8import { AppRoutingModule } from './app-routing.module';
24// App is our top level component
25import { AppComponent } from './app.component'; 9import { AppComponent } from './app.component';
26import { AppState } from './app.service'; 10import { AppState } from './app.service';
27 11
28import { 12import { AccountModule } from './account';
29 AdminComponent, 13import { AdminModule } from './admin';
30 FriendsComponent, 14import { CoreModule } from './core';
31 FriendAddComponent, 15import { LoginModule } from './login';
32 FriendListComponent, 16import { SharedModule } from './shared';
33 FriendService, 17import { VideosModule } from './videos';
34 MenuAdminComponent, 18
35 RequestsComponent,
36 RequestStatsComponent,
37 RequestService,
38 UsersComponent,
39 UserAddComponent,
40 UserListComponent,
41 UserService
42} from './admin';
43import { AccountComponent, AccountService } from './account';
44import { LoginComponent } from './login';
45import { MenuComponent } from './menu.component'; 19import { MenuComponent } from './menu.component';
46import { AuthService, AuthHttp, RestExtractor, RestService, SearchComponent, SearchService } from './shared';
47import {
48 LoaderComponent,
49 VideosComponent,
50 VideoAddComponent,
51 VideoListComponent,
52 VideoMiniatureComponent,
53 VideoSortComponent,
54 VideoWatchComponent,
55 VideoShareComponent,
56 VideoMagnetComponent,
57 VideoService,
58 WebTorrentService
59} from './videos';
60 20
61const metaConfig: MetaConfig = { 21const metaConfig: MetaConfig = {
62 //Append a title suffix such as a site name to all titles 22 //Append a title suffix such as a site name to all titles
@@ -69,75 +29,31 @@ const metaConfig: MetaConfig = {
69 29
70// Application wide providers 30// Application wide providers
71const APP_PROVIDERS = [ 31const APP_PROVIDERS = [
72 AppState, 32 AppState
73
74 {
75 provide: AuthHttp,
76 useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
77 return new AuthHttp(backend, defaultOptions, authService);
78 },
79 deps: [ XHRBackend, RequestOptions, AuthService ]
80 },
81
82 AuthService,
83 RestExtractor,
84 RestService,
85
86 VideoService,
87 SearchService,
88 FriendService,
89 RequestService,
90 UserService,
91 AccountService,
92 WebTorrentService
93]; 33];
94/** 34
95 * `AppModule` is the main entry point into Angular2's bootstraping process
96 */
97@NgModule({ 35@NgModule({
98 bootstrap: [ AppComponent ], 36 bootstrap: [ AppComponent ],
99 declarations: [ 37 declarations: [
100 AccountComponent,
101 AdminComponent,
102 AppComponent, 38 AppComponent,
103 BytesPipe, 39 MenuComponent
104 FriendAddComponent,
105 FriendListComponent,
106 FriendsComponent,
107 LoaderComponent,
108 LoginComponent,
109 MenuAdminComponent,
110 MenuComponent,
111 RequestsComponent,
112 RequestStatsComponent,
113 SearchComponent,
114 UserAddComponent,
115 UserListComponent,
116 UsersComponent,
117 VideoAddComponent,
118 VideoListComponent,
119 VideoMiniatureComponent,
120 VideosComponent,
121 VideoSortComponent,
122 VideoWatchComponent,
123 VideoShareComponent,
124 VideoMagnetComponent
125 ], 40 ],
126 imports: [ // import Angular's modules 41 imports: [
127 BrowserModule, 42 BrowserModule,
128 FormsModule,
129 ReactiveFormsModule,
130 HttpModule,
131 RouterModule.forRoot(routes),
132 43
133 DropdownModule, 44 CoreModule,
134 ProgressbarModule, 45 SharedModule,
135 PaginationModule, 46
136 ModalModule, 47 AppRoutingModule,
137 48
138 FileUploadModule, 49 MetaModule.forRoot(metaConfig),
139 50
140 MetaModule.forRoot(metaConfig) 51 AccountModule,
52 AdminModule,
53 CoreModule,
54 LoginModule,
55 SharedModule,
56 VideosModule
141 ], 57 ],
142 providers: [ // expose our Services and Providers into Angular's dependency injection 58 providers: [ // expose our Services and Providers into Angular's dependency injection
143 ENV_PROVIDERS, 59 ENV_PROVIDERS,
diff --git a/client/src/app/app.routes.ts b/client/src/app/app.routes.ts
deleted file mode 100644
index 03e2bce51..000000000
--- a/client/src/app/app.routes.ts
+++ /dev/null
@@ -1,18 +0,0 @@
1import { Routes } from '@angular/router';
2
3import { AccountRoutes } from './account';
4import { LoginRoutes } from './login';
5import { AdminRoutes } from './admin';
6import { VideosRoutes } from './videos';
7
8export const routes: Routes = [
9 {
10 path: '',
11 redirectTo: '/videos/list',
12 pathMatch: 'full'
13 },
14 ...AdminRoutes,
15 ...AccountRoutes,
16 ...LoginRoutes,
17 ...VideosRoutes
18];
diff --git a/client/src/app/shared/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index b7e0a44a7..1f0e322a9 100644
--- a/client/src/app/shared/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -4,9 +4,10 @@ import { Router } from '@angular/router';
4import { Observable } from 'rxjs/Observable'; 4import { Observable } from 'rxjs/Observable';
5import { Subject } from 'rxjs/Subject'; 5import { Subject } from 'rxjs/Subject';
6 6
7import { AuthStatus } from './auth-status.model'; 7// Do not use the barrel (dependency loop)
8import { AuthUser } from './auth-user.model'; 8import { AuthStatus } from '../../shared/auth/auth-status.model';
9import { RestExtractor } from '../rest'; 9import { AuthUser } from '../../shared/auth/auth-user.model';
10import { RestExtractor } from '../../shared/rest';
10 11
11@Injectable() 12@Injectable()
12export class AuthService { 13export class AuthService {
diff --git a/client/src/app/core/auth/index.ts b/client/src/app/core/auth/index.ts
new file mode 100644
index 000000000..cf52c9c7c
--- /dev/null
+++ b/client/src/app/core/auth/index.ts
@@ -0,0 +1 @@
export * from './auth.service'
diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts
new file mode 100644
index 000000000..be29b88da
--- /dev/null
+++ b/client/src/app/core/core.module.ts
@@ -0,0 +1,21 @@
1import { NgModule, Optional, SkipSelf } from '@angular/core';
2import { CommonModule } from '@angular/common';
3import { HttpModule } from '@angular/http';
4
5import { AuthService } from './auth';
6import { throwIfAlreadyLoaded } from './module-import-guard';
7
8@NgModule({
9 imports: [
10 CommonModule,
11 HttpModule
12 ],
13 declarations: [ ],
14 exports: [ ],
15 providers: [ AuthService ]
16})
17export class CoreModule {
18 constructor( @Optional() @SkipSelf() parentModule: CoreModule) {
19 throwIfAlreadyLoaded(parentModule, 'CoreModule');
20 }
21}
diff --git a/client/src/app/core/index.ts b/client/src/app/core/index.ts
new file mode 100644
index 000000000..fa951b215
--- /dev/null
+++ b/client/src/app/core/index.ts
@@ -0,0 +1,2 @@
1export * from './auth';
2export * from './core.module'
diff --git a/client/src/app/core/module-import-guard.ts b/client/src/app/core/module-import-guard.ts
new file mode 100644
index 000000000..445640c4f
--- /dev/null
+++ b/client/src/app/core/module-import-guard.ts
@@ -0,0 +1,5 @@
1export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) {
2 if (parentModule) {
3 throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`);
4 }
5}
diff --git a/client/src/app/login/index.ts b/client/src/app/login/index.ts
index 64d3f2a3c..5639915f7 100644
--- a/client/src/app/login/index.ts
+++ b/client/src/app/login/index.ts
@@ -1,2 +1,3 @@
1export * from './login-routing.module';
1export * from './login.component'; 2export * from './login.component';
2export * from './login.routes'; 3export * from './login.module';
diff --git a/client/src/app/login/login-routing.module.ts b/client/src/app/login/login-routing.module.ts
new file mode 100644
index 000000000..da68519bd
--- /dev/null
+++ b/client/src/app/login/login-routing.module.ts
@@ -0,0 +1,22 @@
1import { NgModule } from '@angular/core';
2import { RouterModule, Routes } from '@angular/router';
3
4import { LoginComponent } from './login.component';
5
6const loginRoutes: Routes = [
7 {
8 path: 'login',
9 component: LoginComponent,
10 data: {
11 meta: {
12 titleSuffix: ' - Login'
13 }
14 }
15 }
16];
17
18@NgModule({
19 imports: [ RouterModule.forChild(loginRoutes) ],
20 exports: [ RouterModule ]
21})
22export class LoginRoutingModule {}
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index c4ff7050b..fd4a314cc 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core';
2import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 2import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
4 4
5import { AuthService, FormReactive } from '../shared'; 5import { AuthService } from '../core';
6import { FormReactive } from '../shared';
6 7
7@Component({ 8@Component({
8 selector: 'my-login', 9 selector: 'my-login',
diff --git a/client/src/app/login/login.module.ts b/client/src/app/login/login.module.ts
new file mode 100644
index 000000000..31a723b43
--- /dev/null
+++ b/client/src/app/login/login.module.ts
@@ -0,0 +1,24 @@
1import { NgModule } from '@angular/core';
2
3import { LoginRoutingModule } from './login-routing.module';
4import { LoginComponent } from './login.component';
5import { SharedModule } from '../shared';
6
7@NgModule({
8 imports: [
9 LoginRoutingModule,
10 SharedModule
11 ],
12
13 declarations: [
14 LoginComponent
15 ],
16
17 exports: [
18 LoginComponent
19 ],
20
21 providers: [
22 ]
23})
24export class LoginModule { }
diff --git a/client/src/app/login/login.routes.ts b/client/src/app/login/login.routes.ts
deleted file mode 100644
index 2f63af5e2..000000000
--- a/client/src/app/login/login.routes.ts
+++ /dev/null
@@ -1,13 +0,0 @@
1import { LoginComponent } from './login.component';
2
3export const LoginRoutes = [
4 {
5 path: 'login',
6 component: LoginComponent,
7 data: {
8 meta: {
9 titleSuffix: ' - Login'
10 }
11 }
12 }
13];
diff --git a/client/src/app/menu.component.ts b/client/src/app/menu.component.ts
index 6cfc854dd..d1a1d51e7 100644
--- a/client/src/app/menu.component.ts
+++ b/client/src/app/menu.component.ts
@@ -1,7 +1,8 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4import { AuthService, AuthStatus } from './shared'; 4import { AuthService } from './core';
5import { AuthStatus } from './shared';
5 6
6@Component({ 7@Component({
7 selector: 'my-menu', 8 selector: 'my-menu',
diff --git a/client/src/app/shared/auth/auth-http.service.ts b/client/src/app/shared/auth/auth-http.service.ts
index 2392898ca..602726570 100644
--- a/client/src/app/shared/auth/auth-http.service.ts
+++ b/client/src/app/shared/auth/auth-http.service.ts
@@ -7,11 +7,12 @@ import {
7 RequestMethod, 7 RequestMethod,
8 RequestOptions, 8 RequestOptions,
9 RequestOptionsArgs, 9 RequestOptionsArgs,
10 Response 10 Response,
11 XHRBackend
11} from '@angular/http'; 12} from '@angular/http';
12import { Observable } from 'rxjs/Observable'; 13import { Observable } from 'rxjs/Observable';
13 14
14import { AuthService } from './auth.service'; 15import { AuthService } from '../../core';
15 16
16@Injectable() 17@Injectable()
17export class AuthHttp extends Http { 18export class AuthHttp extends Http {
@@ -78,3 +79,13 @@ export class AuthHttp extends Http {
78 headers.set('Authorization', this.authService.getRequestHeaderValue()); 79 headers.set('Authorization', this.authService.getRequestHeaderValue());
79 } 80 }
80} 81}
82
83export const AUTH_HTTP_PROVIDERS = [
84 {
85 provide: AuthHttp,
86 useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
87 return new AuthHttp(backend, defaultOptions, authService);
88 },
89 deps: [ XHRBackend, RequestOptions, AuthService ]
90 },
91];
diff --git a/client/src/app/shared/auth/index.ts b/client/src/app/shared/auth/index.ts
index ebd9e14cd..ce0bd8adf 100644
--- a/client/src/app/shared/auth/index.ts
+++ b/client/src/app/shared/auth/index.ts
@@ -1,4 +1,3 @@
1export * from './auth-http.service'; 1export * from './auth-http.service';
2export * from './auth-status.model'; 2export * from './auth-status.model';
3export * from './auth.service';
4export * from './auth-user.model'; 3export * from './auth-user.model';
diff --git a/client/src/app/shared/index.ts b/client/src/app/shared/index.ts
index af34b4b64..52a647b83 100644
--- a/client/src/app/shared/index.ts
+++ b/client/src/app/shared/index.ts
@@ -3,3 +3,4 @@ export * from './forms';
3export * from './rest'; 3export * from './rest';
4export * from './search'; 4export * from './search';
5export * from './users'; 5export * from './users';
6export * from './shared.module';
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts
new file mode 100644
index 000000000..141922322
--- /dev/null
+++ b/client/src/app/shared/shared.module.ts
@@ -0,0 +1,62 @@
1import { NgModule } from '@angular/core';
2import { CommonModule } from '@angular/common';
3import { HttpModule } from '@angular/http';
4import { FormsModule, ReactiveFormsModule } from '@angular/forms';
5import { RouterModule } from '@angular/router';
6
7import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
8import { DropdownModule } from 'ng2-bootstrap/components/dropdown';
9import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar';
10import { PaginationModule } from 'ng2-bootstrap/components/pagination';
11import { ModalModule } from 'ng2-bootstrap/components/modal';
12import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
13
14import { AUTH_HTTP_PROVIDERS } from './auth';
15import { RestExtractor, RestService } from './rest';
16import { SearchComponent, SearchService } from './search';
17
18@NgModule({
19 imports: [
20 CommonModule,
21 FormsModule,
22 ReactiveFormsModule,
23 HttpModule,
24 RouterModule,
25
26 DropdownModule,
27 FileUploadModule,
28 ModalModule,
29 PaginationModule,
30 ProgressbarModule
31 ],
32
33 declarations: [
34 BytesPipe,
35 SearchComponent
36 ],
37
38 exports: [
39 CommonModule,
40 FormsModule,
41 ReactiveFormsModule,
42 HttpModule,
43 RouterModule,
44
45 DropdownModule,
46 FileUploadModule,
47 ModalModule,
48 PaginationModule,
49 ProgressbarModule,
50 BytesPipe,
51
52 SearchComponent
53 ],
54
55 providers: [
56 AUTH_HTTP_PROVIDERS,
57 RestExtractor,
58 RestService,
59 SearchService
60 ]
61})
62export class SharedModule { }
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';
2export * from './video-add'; 2export * from './video-add';
3export * from './video-list'; 3export * from './video-list';
4export * from './video-watch'; 4export * from './video-watch';
5export * from './videos-routing.module';
5export * from './videos.component'; 6export * from './videos.component';
6export * from './videos.routes'; 7export * 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';
4 4
5import { Search } from '../../shared'; 5import { Search } from '../../shared';
6import { SortField } from './sort-field.type'; 6import { SortField } from './sort-field.type';
7import { AuthHttp, AuthService, RestExtractor, RestPagination, RestService, ResultList } from '../../shared'; 7import { AuthService } from '../../core';
8import { AuthHttp, RestExtractor, RestPagination, RestService, ResultList } from '../../shared';
8import { Video } from './video.model'; 9import { Video } from './video.model';
9 10
10@Injectable() 11@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';
4 4
5import { FileUploader } from 'ng2-file-upload/ng2-file-upload'; 5import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
6 6
7import { AuthService, FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared'; 7import { AuthService } from '../../core';
8import { FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared';
8 9
9@Component({ 10@Component({
10 selector: 'my-videos-add', 11 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 {
7 Video, 7 Video,
8 VideoService 8 VideoService
9} from '../shared'; 9} from '../shared';
10import { AuthService, AuthUser, RestPagination, Search, SearchField } from '../../shared'; 10import { AuthService } from '../../core';
11import { AuthUser, RestPagination, Search, SearchField } from '../../shared';
11import { SearchService } from '../../shared'; 12import { SearchService } from '../../shared';
12 13
13@Component({ 14@Component({
diff --git a/client/src/app/videos/videos.routes.ts b/client/src/app/videos/videos-routing.module.ts
index ab68fbe0c..766d29d22 100644
--- a/client/src/app/videos/videos.routes.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -1,11 +1,12 @@
1import { Routes } from '@angular/router'; 1import { NgModule } from '@angular/core';
2import { RouterModule, Routes } from '@angular/router';
2 3
3import { VideoAddComponent } from './video-add'; 4import { VideoAddComponent } from './video-add';
4import { VideoListComponent } from './video-list'; 5import { VideoListComponent } from './video-list';
5import { VideosComponent } from './videos.component'; 6import { VideosComponent } from './videos.component';
6import { VideoWatchComponent } from './video-watch'; 7import { VideoWatchComponent } from './video-watch';
7 8
8export const VideosRoutes: Routes = [ 9const videosRoutes: Routes = [
9 { 10 {
10 path: 'videos', 11 path: 'videos',
11 component: VideosComponent, 12 component: VideosComponent,
@@ -35,3 +36,9 @@ export const VideosRoutes: Routes = [
35 ] 36 ]
36 } 37 }
37]; 38];
39
40@NgModule({
41 imports: [ RouterModule.forChild(videosRoutes) ],
42 exports: [ RouterModule ]
43})
44export 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 @@
1import { NgModule } from '@angular/core';
2
3import { VideosRoutingModule } from './videos-routing.module';
4import { VideosComponent } from './videos.component';
5import { VideoAddComponent } from './video-add';
6import { VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list';
7import { VideoWatchComponent, VideoMagnetComponent, VideoShareComponent, WebTorrentService } from './video-watch';
8import { LoaderComponent, VideoService } from './shared';
9import { SharedModule } from '../shared';
10
11@NgModule({
12 imports: [
13 VideosRoutingModule,
14 SharedModule
15 ],
16
17 declarations: [
18 VideosComponent,
19
20 VideoAddComponent,
21
22 VideoListComponent,
23 VideoMiniatureComponent,
24 VideoSortComponent,
25
26 VideoWatchComponent,
27 VideoMagnetComponent,
28 VideoShareComponent,
29
30 LoaderComponent
31 ],
32
33 exports: [
34 VideosComponent
35 ],
36
37 providers: [
38 VideoService,
39 WebTorrentService
40 ]
41})
42export class VideosModule { }