aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/account/account.component.ts8
-rw-r--r--client/src/app/account/index.ts1
-rw-r--r--client/src/app/admin/admin.component.ts4
-rw-r--r--client/src/app/admin/admin.routes.ts4
-rw-r--r--client/src/app/admin/friends/friend-add/friend-add.component.ts14
-rw-r--r--client/src/app/admin/friends/friend-list/friend-list.component.ts4
-rw-r--r--client/src/app/admin/friends/friends.component.ts7
-rw-r--r--client/src/app/admin/friends/friends.routes.ts4
-rw-r--r--client/src/app/admin/friends/index.ts1
-rw-r--r--client/src/app/admin/index.ts1
-rw-r--r--client/src/app/admin/menu-admin.component.ts4
-rw-r--r--client/src/app/admin/users/user-add/user-add.component.ts6
-rw-r--r--client/src/app/admin/users/user-list/user-list.component.ts4
-rw-r--r--client/src/app/admin/users/users.component.ts7
-rw-r--r--client/src/app/admin/users/users.routes.ts4
-rw-r--r--client/src/app/app.component.ts11
-rw-r--r--client/src/app/app.module.ts130
-rw-r--r--client/src/app/app.routes.ts4
-rw-r--r--client/src/app/app.service.ts36
-rw-r--r--client/src/app/environment.ts50
-rw-r--r--client/src/app/index.ts1
-rw-r--r--client/src/app/login/login.component.ts6
-rw-r--r--client/src/app/menu.component.ts5
-rw-r--r--client/src/app/shared/search/search.component.ts7
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts11
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts12
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.ts6
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts9
-rw-r--r--client/src/app/videos/videos.component.ts4
-rw-r--r--client/src/app/videos/videos.routes.ts4
30 files changed, 265 insertions, 104 deletions
diff --git a/client/src/app/account/account.component.ts b/client/src/app/account/account.component.ts
index 54939f43b..a22738d3f 100644
--- a/client/src/app/account/account.component.ts
+++ b/client/src/app/account/account.component.ts
@@ -1,15 +1,13 @@
1import { Validators } from '@angular/common'; 1import { } from '@angular/common';
2import { Component, OnInit } from '@angular/core'; 2import { Component, OnInit } from '@angular/core';
3import { FormControl, FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms'; 3import { FormControl, FormGroup, Validators } from '@angular/forms';
4import { Router } from '@angular/router'; 4import { Router } from '@angular/router';
5 5
6import { AccountService } from './account.service'; 6import { AccountService } from './account.service';
7 7
8@Component({ 8@Component({
9 selector: 'my-account', 9 selector: 'my-account',
10 template: require('./account.component.html'), 10 template: require('./account.component.html')
11 providers: [ AccountService ],
12 directives: [ REACTIVE_FORM_DIRECTIVES ]
13}) 11})
14 12
15export class AccountComponent implements OnInit { 13export class AccountComponent implements OnInit {
diff --git a/client/src/app/account/index.ts b/client/src/app/account/index.ts
index 7445003fd..823d9fe5f 100644
--- a/client/src/app/account/index.ts
+++ b/client/src/app/account/index.ts
@@ -1,2 +1,3 @@
1export * from './account.component'; 1export * from './account.component';
2export * from './account.routes'; 2export * from './account.routes';
3export * from './account.service';
diff --git a/client/src/app/admin/admin.component.ts b/client/src/app/admin/admin.component.ts
index 82f2529ec..64a7400e7 100644
--- a/client/src/app/admin/admin.component.ts
+++ b/client/src/app/admin/admin.component.ts
@@ -1,9 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3 2
4@Component({ 3@Component({
5 template: '<router-outlet></router-outlet>', 4 template: '<router-outlet></router-outlet>'
6 directives: [ ROUTER_DIRECTIVES ]
7}) 5})
8 6
9export class AdminComponent { 7export class AdminComponent {
diff --git a/client/src/app/admin/admin.routes.ts b/client/src/app/admin/admin.routes.ts
index 80b3ecbc1..1fcace994 100644
--- a/client/src/app/admin/admin.routes.ts
+++ b/client/src/app/admin/admin.routes.ts
@@ -1,10 +1,10 @@
1import { RouterConfig } from '@angular/router'; 1import { Routes } from '@angular/router';
2 2
3import { AdminComponent } from './admin.component'; 3import { AdminComponent } from './admin.component';
4import { FriendsRoutes } from './friends'; 4import { FriendsRoutes } from './friends';
5import { UsersRoutes } from './users'; 5import { UsersRoutes } from './users';
6 6
7export const AdminRoutes: RouterConfig = [ 7export const AdminRoutes: Routes = [
8 { 8 {
9 path: 'admin', 9 path: 'admin',
10 component: AdminComponent, 10 component: AdminComponent,
diff --git a/client/src/app/admin/friends/friend-add/friend-add.component.ts b/client/src/app/admin/friends/friend-add/friend-add.component.ts
index 2b2aceb8a..55aed9156 100644
--- a/client/src/app/admin/friends/friend-add/friend-add.component.ts
+++ b/client/src/app/admin/friends/friend-add/friend-add.component.ts
@@ -1,5 +1,5 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { FormControl, FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms'; 2import { FormControl, FormGroup } from '@angular/forms';
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
4 4
5import { validateUrl } from '../../../shared'; 5import { validateUrl } from '../../../shared';
@@ -8,8 +8,7 @@ import { FriendService } from '../shared';
8@Component({ 8@Component({
9 selector: 'my-friend-add', 9 selector: 'my-friend-add',
10 template: require('./friend-add.component.html'), 10 template: require('./friend-add.component.html'),
11 styles: [ require('./friend-add.component.scss') ], 11 styles: [ require('./friend-add.component.scss') ]
12 directives: [ REACTIVE_FORM_DIRECTIVES ]
13}) 12})
14export class FriendAddComponent implements OnInit { 13export class FriendAddComponent implements OnInit {
15 friendAddForm: FormGroup; 14 friendAddForm: FormGroup;
@@ -80,12 +79,13 @@ export class FriendAddComponent implements OnInit {
80 79
81 this.friendService.makeFriends(notEmptyUrls).subscribe( 80 this.friendService.makeFriends(notEmptyUrls).subscribe(
82 status => { 81 status => {
83 if (status === 409) { 82 // TODO: extractdatastatus
84 alert('Already made friends!'); 83 // if (status === 409) {
85 } else { 84 // alert('Already made friends!');
85 // } else {
86 alert('Make friends request sent!'); 86 alert('Make friends request sent!');
87 this.router.navigate([ '/admin/friends/list' ]); 87 this.router.navigate([ '/admin/friends/list' ]);
88 } 88 // }
89 }, 89 },
90 error => alert(error) 90 error => alert(error)
91 ); 91 );
diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.ts b/client/src/app/admin/friends/friend-list/friend-list.component.ts
index 38d4799a6..c76fc4df2 100644
--- a/client/src/app/admin/friends/friend-list/friend-list.component.ts
+++ b/client/src/app/admin/friends/friend-list/friend-list.component.ts
@@ -1,13 +1,11 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3 2
4import { Friend, FriendService } from '../shared'; 3import { Friend, FriendService } from '../shared';
5 4
6@Component({ 5@Component({
7 selector: 'my-friend-list', 6 selector: 'my-friend-list',
8 template: require('./friend-list.component.html'), 7 template: require('./friend-list.component.html'),
9 styles: [ require('./friend-list.component.scss') ], 8 styles: [ require('./friend-list.component.scss') ]
10 directives: [ ROUTER_DIRECTIVES ]
11}) 9})
12export class FriendListComponent implements OnInit { 10export class FriendListComponent implements OnInit {
13 friends: Friend[]; 11 friends: Friend[];
diff --git a/client/src/app/admin/friends/friends.component.ts b/client/src/app/admin/friends/friends.component.ts
index e66280f01..bc3f54158 100644
--- a/client/src/app/admin/friends/friends.component.ts
+++ b/client/src/app/admin/friends/friends.component.ts
@@ -1,12 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3
4import { FriendService } from './shared';
5 2
6@Component({ 3@Component({
7 template: '<router-outlet></router-outlet>', 4 template: '<router-outlet></router-outlet>'
8 directives: [ ROUTER_DIRECTIVES ],
9 providers: [ FriendService ]
10}) 5})
11 6
12export class FriendsComponent { 7export class FriendsComponent {
diff --git a/client/src/app/admin/friends/friends.routes.ts b/client/src/app/admin/friends/friends.routes.ts
index 42b4a6c14..7fdef68f9 100644
--- a/client/src/app/admin/friends/friends.routes.ts
+++ b/client/src/app/admin/friends/friends.routes.ts
@@ -1,10 +1,10 @@
1import { RouterConfig } from '@angular/router'; 1import { Routes } from '@angular/router';
2 2
3import { FriendsComponent } from './friends.component'; 3import { FriendsComponent } from './friends.component';
4import { FriendAddComponent } from './friend-add'; 4import { FriendAddComponent } from './friend-add';
5import { FriendListComponent } from './friend-list'; 5import { FriendListComponent } from './friend-list';
6 6
7export const FriendsRoutes: RouterConfig = [ 7export const FriendsRoutes: Routes = [
8 { 8 {
9 path: 'friends', 9 path: 'friends',
10 component: FriendsComponent, 10 component: FriendsComponent,
diff --git a/client/src/app/admin/friends/index.ts b/client/src/app/admin/friends/index.ts
index f3110e31d..dd4df2538 100644
--- a/client/src/app/admin/friends/index.ts
+++ b/client/src/app/admin/friends/index.ts
@@ -1,4 +1,5 @@
1export * from './friend-add'; 1export * from './friend-add';
2export * from './friend-list'; 2export * from './friend-list';
3export * from './shared'; 3export * from './shared';
4export * from './friends.component';
4export * from './friends.routes'; 5export * from './friends.routes';
diff --git a/client/src/app/admin/index.ts b/client/src/app/admin/index.ts
index 292973681..3d0e67b15 100644
--- a/client/src/app/admin/index.ts
+++ b/client/src/app/admin/index.ts
@@ -1,3 +1,4 @@
1export * from './friends';
1export * from './users'; 2export * from './users';
2export * from './admin.component'; 3export * from './admin.component';
3export * from './admin.routes'; 4export * from './admin.routes';
diff --git a/client/src/app/admin/menu-admin.component.ts b/client/src/app/admin/menu-admin.component.ts
index 788592872..a9115d49f 100644
--- a/client/src/app/admin/menu-admin.component.ts
+++ b/client/src/app/admin/menu-admin.component.ts
@@ -1,9 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3 2
4@Component({ 3@Component({
5 selector: 'my-menu-admin', 4 selector: 'my-menu-admin',
6 template: require('./menu-admin.component.html'), 5 template: require('./menu-admin.component.html')
7 directives: [ ROUTER_DIRECTIVES ]
8}) 6})
9export class MenuAdminComponent { } 7export class MenuAdminComponent { }
diff --git a/client/src/app/admin/users/user-add/user-add.component.ts b/client/src/app/admin/users/user-add/user-add.component.ts
index 8dd98cc5c..e3f4b2e1a 100644
--- a/client/src/app/admin/users/user-add/user-add.component.ts
+++ b/client/src/app/admin/users/user-add/user-add.component.ts
@@ -1,14 +1,12 @@
1import { Validators } from '@angular/common';
2import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
3import { FormGroup, FormControl, REACTIVE_FORM_DIRECTIVES } from '@angular/forms'; 2import { FormGroup, FormControl, Validators } from '@angular/forms';
4import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
5 4
6import { UserService } from '../shared'; 5import { UserService } from '../shared';
7 6
8@Component({ 7@Component({
9 selector: 'my-user-add', 8 selector: 'my-user-add',
10 template: require('./user-add.component.html'), 9 template: require('./user-add.component.html')
11 directives: [ REACTIVE_FORM_DIRECTIVES ]
12}) 10})
13export class UserAddComponent implements OnInit { 11export class UserAddComponent implements OnInit {
14 userAddForm: FormGroup; 12 userAddForm: FormGroup;
diff --git a/client/src/app/admin/users/user-list/user-list.component.ts b/client/src/app/admin/users/user-list/user-list.component.ts
index c89a61bca..d3827eb28 100644
--- a/client/src/app/admin/users/user-list/user-list.component.ts
+++ b/client/src/app/admin/users/user-list/user-list.component.ts
@@ -1,5 +1,4 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3 2
4import { User } from '../../../shared'; 3import { User } from '../../../shared';
5import { UserService } from '../shared'; 4import { UserService } from '../shared';
@@ -7,8 +6,7 @@ import { UserService } from '../shared';
7@Component({ 6@Component({
8 selector: 'my-user-list', 7 selector: 'my-user-list',
9 template: require('./user-list.component.html'), 8 template: require('./user-list.component.html'),
10 styles: [ require('./user-list.component.scss') ], 9 styles: [ require('./user-list.component.scss') ]
11 directives: [ ROUTER_DIRECTIVES ]
12}) 10})
13export class UserListComponent implements OnInit { 11export class UserListComponent implements OnInit {
14 totalUsers: number; 12 totalUsers: number;
diff --git a/client/src/app/admin/users/users.component.ts b/client/src/app/admin/users/users.component.ts
index 46aa0862f..37e3b158d 100644
--- a/client/src/app/admin/users/users.component.ts
+++ b/client/src/app/admin/users/users.component.ts
@@ -1,12 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3
4import { UserService } from './shared';
5 2
6@Component({ 3@Component({
7 template: '<router-outlet></router-outlet>', 4 template: '<router-outlet></router-outlet>'
8 directives: [ ROUTER_DIRECTIVES ],
9 providers: [ UserService ]
10}) 5})
11 6
12export class UsersComponent { 7export class UsersComponent {
diff --git a/client/src/app/admin/users/users.routes.ts b/client/src/app/admin/users/users.routes.ts
index 0457c3843..eb71bd0ae 100644
--- a/client/src/app/admin/users/users.routes.ts
+++ b/client/src/app/admin/users/users.routes.ts
@@ -1,10 +1,10 @@
1import { RouterConfig } from '@angular/router'; 1import { Routes } from '@angular/router';
2 2
3import { UsersComponent } from './users.component'; 3import { UsersComponent } from './users.component';
4import { UserAddComponent } from './user-add'; 4import { UserAddComponent } from './user-add';
5import { UserListComponent } from './user-list'; 5import { UserListComponent } from './user-list';
6 6
7export const UsersRoutes: RouterConfig = [ 7export const UsersRoutes: Routes = [
8 { 8 {
9 path: 'users', 9 path: 'users',
10 component: UsersComponent, 10 component: UsersComponent,
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 9d05c272f..e81993a3f 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,17 +1,10 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core';
2import { Router, ROUTER_DIRECTIVES } from '@angular/router'; 2import { Router } from '@angular/router';
3
4import { MenuAdminComponent } from './admin';
5import { MenuComponent } from './menu.component';
6import { RestExtractor, RestService, SearchComponent, SearchService } from './shared';
7import { VideoService } from './videos';
8 3
9@Component({ 4@Component({
10 selector: 'my-app', 5 selector: 'my-app',
11 template: require('./app.component.html'), 6 template: require('./app.component.html'),
12 styles: [ require('./app.component.scss') ], 7 styles: [ require('./app.component.scss') ]
13 directives: [ MenuAdminComponent, MenuComponent, ROUTER_DIRECTIVES, SearchComponent ],
14 providers: [ RestExtractor, RestService, VideoService, SearchService ]
15}) 8})
16 9
17export class AppComponent { 10export class AppComponent {
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
new file mode 100644
index 000000000..950b3c48e
--- /dev/null
+++ b/client/src/app/app.module.ts
@@ -0,0 +1,130 @@
1import { NgModule, ApplicationRef } from '@angular/core';
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';
7
8import { FileSelectDirective } from 'ng2-file-upload/ng2-file-upload';
9import { ProgressbarModule } from 'ng2-bootstrap/components/progressbar';
10import { PaginationModule } from 'ng2-bootstrap/components/pagination';
11import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
12
13/*
14 * Platform and Environment providers/directives/pipes
15 */
16import { ENV_PROVIDERS } from './environment';
17import { routes } from './app.routes';
18// App is our top level component
19import { AppComponent } from './app.component';
20import { AppState } from './app.service';
21import { AccountComponent, AccountService } from './account';
22import { LoginComponent } from './login';
23import {
24 LoaderComponent,
25 VideosComponent,
26 VideoAddComponent,
27 VideoListComponent,
28 VideoMiniatureComponent,
29 VideoSortComponent,
30 VideoWatchComponent,
31 VideoService
32} from './videos';
33import {
34 FriendsComponent,
35 FriendAddComponent,
36 FriendListComponent,
37 FriendService,
38 UsersComponent,
39 UserAddComponent,
40 UserListComponent,
41 UserService,
42 AdminComponent,
43 MenuAdminComponent
44} from './admin';
45import { MenuComponent } from './menu.component';
46import { AuthService, AuthHttp, RestExtractor, RestService, SearchComponent, SearchService } from './shared';
47
48// Application wide providers
49const APP_PROVIDERS = [
50 AppState,
51
52 {
53 provide: AuthHttp,
54 useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
55 return new AuthHttp(backend, defaultOptions, authService);
56 },
57 deps: [ XHRBackend, RequestOptions, AuthService ]
58 },
59
60 AuthService,
61 RestExtractor,
62 RestExtractor, RestService, VideoService, SearchService, FriendService, UserService, AccountService
63];
64/**
65 * `AppModule` is the main entry point into Angular2's bootstraping process
66 */
67@NgModule({
68 bootstrap: [ AppComponent ],
69 declarations: [
70 AppComponent,
71 BytesPipe,
72 FileSelectDirective,
73 AccountComponent,
74 LoginComponent,
75 LoaderComponent,
76 VideosComponent,
77 VideoAddComponent,
78 VideoListComponent,
79 VideoSortComponent,
80 VideoMiniatureComponent,
81 VideoWatchComponent,
82 FriendsComponent,
83 FriendAddComponent,
84 FriendListComponent,
85 UsersComponent,
86 UserAddComponent,
87 UserListComponent,
88 AdminComponent,
89 MenuAdminComponent,
90 MenuComponent,
91 SearchComponent
92 ],
93 imports: [ // import Angular's modules
94 BrowserModule,
95 FormsModule,
96 ReactiveFormsModule,
97 HttpModule,
98 RouterModule.forRoot(routes),
99 ProgressbarModule,
100 PaginationModule
101 ],
102 providers: [ // expose our Services and Providers into Angular's dependency injection
103 ENV_PROVIDERS,
104 APP_PROVIDERS
105 ]
106})
107export class AppModule {
108 constructor(public appRef: ApplicationRef, public appState: AppState) {}
109 hmrOnInit(store) {
110 if (!store || !store.state) return;
111 console.log('HMR store', store);
112 this.appState._state = store.state;
113 this.appRef.tick();
114 delete store.state;
115 }
116 hmrOnDestroy(store) {
117 const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
118 // recreate elements
119 const state = this.appState._state;
120 store.state = state;
121 store.disposeOldHosts = createNewHosts(cmpLocation);
122 // remove styles
123 removeNgStyles();
124 }
125 hmrAfterDestroy(store) {
126 // display new elements
127 store.disposeOldHosts();
128 delete store.disposeOldHosts;
129 }
130}
diff --git a/client/src/app/app.routes.ts b/client/src/app/app.routes.ts
index d7194cb4f..03e2bce51 100644
--- a/client/src/app/app.routes.ts
+++ b/client/src/app/app.routes.ts
@@ -1,11 +1,11 @@
1import { RouterConfig } from '@angular/router'; 1import { Routes } from '@angular/router';
2 2
3import { AccountRoutes } from './account'; 3import { AccountRoutes } from './account';
4import { LoginRoutes } from './login'; 4import { LoginRoutes } from './login';
5import { AdminRoutes } from './admin'; 5import { AdminRoutes } from './admin';
6import { VideosRoutes } from './videos'; 6import { VideosRoutes } from './videos';
7 7
8export const routes: RouterConfig = [ 8export const routes: Routes = [
9 { 9 {
10 path: '', 10 path: '',
11 redirectTo: '/videos/list', 11 redirectTo: '/videos/list',
diff --git a/client/src/app/app.service.ts b/client/src/app/app.service.ts
new file mode 100644
index 000000000..033c21900
--- /dev/null
+++ b/client/src/app/app.service.ts
@@ -0,0 +1,36 @@
1
2import { Injectable } from '@angular/core';
3
4@Injectable()
5export class AppState {
6 _state = { };
7
8 constructor() { ; }
9
10 // already return a clone of the current state
11 get state() {
12 return this._state = this._clone(this._state);
13 }
14 // never allow mutation
15 set state(value) {
16 throw new Error('do not mutate the `.state` directly');
17 }
18
19
20 get(prop?: any) {
21 // use our state getter for the clone
22 const state = this.state;
23 return state.hasOwnProperty(prop) ? state[prop] : state;
24 }
25
26 set(prop: string, value: any) {
27 // internally mutate our state
28 return this._state[prop] = value;
29 }
30
31
32 _clone(object) {
33 // simple object clone
34 return JSON.parse(JSON.stringify( object ));
35 }
36}
diff --git a/client/src/app/environment.ts b/client/src/app/environment.ts
new file mode 100644
index 000000000..8bba89c4e
--- /dev/null
+++ b/client/src/app/environment.ts
@@ -0,0 +1,50 @@
1
2// Angular 2
3// rc2 workaround
4import { enableDebugTools, disableDebugTools } from '@angular/platform-browser';
5import { enableProdMode, ApplicationRef } from '@angular/core';
6// Environment Providers
7let PROVIDERS = [
8 // common env directives
9];
10
11// Angular debug tools in the dev console
12// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
13let _decorateModuleRef = function identity(value) { return value; };
14
15if ('production' === ENV) {
16 // Production
17 disableDebugTools();
18 enableProdMode();
19
20 PROVIDERS = [
21 ...PROVIDERS,
22 // custom providers in production
23 ];
24
25} else {
26
27 _decorateModuleRef = (modRef: any) => {
28 const appRef = modRef.injector.get(ApplicationRef);
29 const cmpRef = appRef.components[0];
30
31 let _ng = (<any>window).ng;
32 enableDebugTools(cmpRef);
33 (<any>window).ng.probe = _ng.probe;
34 (<any>window).ng.coreTokens = _ng.coreTokens;
35 return modRef;
36 };
37
38 // Development
39 PROVIDERS = [
40 ...PROVIDERS,
41 // custom providers in development
42 ];
43
44}
45
46export const decorateModuleRef = _decorateModuleRef;
47
48export const ENV_PROVIDERS = [
49 ...PROVIDERS
50];
diff --git a/client/src/app/index.ts b/client/src/app/index.ts
new file mode 100644
index 000000000..da53f6aef
--- /dev/null
+++ b/client/src/app/index.ts
@@ -0,0 +1 @@
export * from './app.module';
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 1e0ba0fe8..7a4e15c2c 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -1,14 +1,12 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { Validators } from '@angular/common'; 2import { FormControl, FormGroup, Validators } from '@angular/forms';
3import { FormControl, FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms';
4import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
5 4
6import { AuthService } from '../shared'; 5import { AuthService } from '../shared';
7 6
8@Component({ 7@Component({
9 selector: 'my-login', 8 selector: 'my-login',
10 template: require('./login.component.html'), 9 template: require('./login.component.html')
11 directives: [ REACTIVE_FORM_DIRECTIVES ]
12}) 10})
13 11
14export class LoginComponent implements OnInit { 12export class LoginComponent implements OnInit {
diff --git a/client/src/app/menu.component.ts b/client/src/app/menu.component.ts
index 6b08301df..425a12e5d 100644
--- a/client/src/app/menu.component.ts
+++ b/client/src/app/menu.component.ts
@@ -1,12 +1,11 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { Router, ROUTER_DIRECTIVES } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4import { AuthService, AuthStatus } from './shared'; 4import { AuthService, AuthStatus } from './shared';
5 5
6@Component({ 6@Component({
7 selector: 'my-menu', 7 selector: 'my-menu',
8 template: require('./menu.component.html'), 8 template: require('./menu.component.html')
9 directives: [ ROUTER_DIRECTIVES ]
10}) 9})
11export class MenuComponent implements OnInit { 10export class MenuComponent implements OnInit {
12 isLoggedIn: boolean; 11 isLoggedIn: boolean;
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index 853f5dc7c..7878471dc 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -1,16 +1,13 @@
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 { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
5
6import { Search } from './search.model'; 4import { Search } from './search.model';
7import { SearchField } from './search-field.type'; 5import { SearchField } from './search-field.type';
8import { SearchService } from './search.service'; 6import { SearchService } from './search.service';
9 7
10@Component({ 8@Component({
11 selector: 'my-search', 9 selector: 'my-search',
12 template: require('./search.component.html'), 10 template: require('./search.component.html')
13 directives: [ DROPDOWN_DIRECTIVES ]
14}) 11})
15 12
16export class SearchComponent implements OnInit { 13export class SearchComponent implements OnInit {
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 900ef1da3..f0695d768 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -1,20 +1,15 @@
1import { Validators } from '@angular/common';
2import { Component, ElementRef, OnInit } from '@angular/core'; 1import { Component, ElementRef, OnInit } from '@angular/core';
3import { FormControl, FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms'; 2import { FormControl, FormGroup, Validators } from '@angular/forms';
4import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
5 4
6import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; 5import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
7import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
8import { FileSelectDirective, FileUploader } from 'ng2-file-upload/ng2-file-upload';
9 6
10import { AuthService } from '../../shared'; 7import { AuthService } from '../../shared';
11 8
12@Component({ 9@Component({
13 selector: 'my-videos-add', 10 selector: 'my-videos-add',
14 styles: [ require('./video-add.component.scss') ], 11 styles: [ require('./video-add.component.scss') ],
15 template: require('./video-add.component.html'), 12 template: require('./video-add.component.html')
16 directives: [ FileSelectDirective, PROGRESSBAR_DIRECTIVES, REACTIVE_FORM_DIRECTIVES ],
17 pipes: [ BytesPipe ]
18}) 13})
19 14
20export class VideoAddComponent implements OnInit { 15export class VideoAddComponent implements OnInit {
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 9a9ffe29f..fa8e497aa 100644
--- a/client/src/app/videos/video-list/video-list.component.ts
+++ b/client/src/app/videos/video-list/video-list.component.ts
@@ -1,27 +1,19 @@
1import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; 1import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
2import { AsyncPipe } from '@angular/common'; 2import { ActivatedRoute, Router } from '@angular/router';
3import { ActivatedRoute, Router, ROUTER_DIRECTIVES } from '@angular/router';
4import { BehaviorSubject } from 'rxjs/BehaviorSubject'; 3import { BehaviorSubject } from 'rxjs/BehaviorSubject';
5 4
6import { PAGINATION_DIRECTIVES } from 'ng2-bootstrap/components/pagination';
7
8import { 5import {
9 LoaderComponent,
10 SortField, 6 SortField,
11 Video, 7 Video,
12 VideoService 8 VideoService
13} from '../shared'; 9} from '../shared';
14import { AuthService, AuthUser, RestPagination, Search, SearchField } from '../../shared'; 10import { AuthService, AuthUser, RestPagination, Search, SearchField } from '../../shared';
15import { VideoMiniatureComponent } from './video-miniature.component';
16import { VideoSortComponent } from './video-sort.component';
17import { SearchService } from '../../shared'; 11import { SearchService } from '../../shared';
18 12
19@Component({ 13@Component({
20 selector: 'my-videos-list', 14 selector: 'my-videos-list',
21 styles: [ require('./video-list.component.scss') ], 15 styles: [ require('./video-list.component.scss') ],
22 pipes: [ AsyncPipe ], 16 template: require('./video-list.component.html')
23 template: require('./video-list.component.html'),
24 directives: [ LoaderComponent, PAGINATION_DIRECTIVES, ROUTER_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent ]
25}) 17})
26 18
27export class VideoListComponent implements OnInit, OnDestroy { 19export class VideoListComponent implements OnInit, OnDestroy {
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts
index 84bab950e..38317f832 100644
--- a/client/src/app/videos/video-list/video-miniature.component.ts
+++ b/client/src/app/videos/video-list/video-miniature.component.ts
@@ -1,6 +1,4 @@
1import { DatePipe } from '@angular/common';
2import { Component, Input, Output, EventEmitter } from '@angular/core'; 1import { Component, Input, Output, EventEmitter } from '@angular/core';
3import { ROUTER_DIRECTIVES } from '@angular/router';
4 2
5import { SortField, Video, VideoService } from '../shared'; 3import { SortField, Video, VideoService } from '../shared';
6import { User } from '../../shared'; 4import { User } from '../../shared';
@@ -8,9 +6,7 @@ import { User } from '../../shared';
8@Component({ 6@Component({
9 selector: 'my-video-miniature', 7 selector: 'my-video-miniature',
10 styles: [ require('./video-miniature.component.scss') ], 8 styles: [ require('./video-miniature.component.scss') ],
11 template: require('./video-miniature.component.html'), 9 template: require('./video-miniature.component.html')
12 directives: [ ROUTER_DIRECTIVES ],
13 pipes: [ DatePipe ]
14}) 10})
15 11
16export class VideoMiniatureComponent { 12export class VideoMiniatureComponent {
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index d260e55c7..2a60e9327 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,18 +1,13 @@
1import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core'; 1import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute } from '@angular/router';
3 3
4import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; 4import { Video, VideoService } from '../shared';
5
6import { LoaderComponent, Video, VideoService } from '../shared';
7import { WebTorrentService } from './webtorrent.service'; 5import { WebTorrentService } from './webtorrent.service';
8 6
9@Component({ 7@Component({
10 selector: 'my-video-watch', 8 selector: 'my-video-watch',
11 template: require('./video-watch.component.html'), 9 template: require('./video-watch.component.html'),
12 styles: [ require('./video-watch.component.scss') ], 10 styles: [ require('./video-watch.component.scss') ]
13 providers: [ WebTorrentService ],
14 directives: [ LoaderComponent ],
15 pipes: [ BytesPipe ]
16}) 11})
17 12
18export class VideoWatchComponent implements OnInit, OnDestroy { 13export class VideoWatchComponent implements OnInit, OnDestroy {
diff --git a/client/src/app/videos/videos.component.ts b/client/src/app/videos/videos.component.ts
index 76252afbb..591e7523d 100644
--- a/client/src/app/videos/videos.component.ts
+++ b/client/src/app/videos/videos.component.ts
@@ -1,9 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core';
2import { ROUTER_DIRECTIVES } from '@angular/router';
3 2
4@Component({ 3@Component({
5 template: '<router-outlet></router-outlet>', 4 template: '<router-outlet></router-outlet>'
6 directives: [ ROUTER_DIRECTIVES ]
7}) 5})
8 6
9export class VideosComponent { 7export class VideosComponent {
diff --git a/client/src/app/videos/videos.routes.ts b/client/src/app/videos/videos.routes.ts
index 1f088b376..074f96596 100644
--- a/client/src/app/videos/videos.routes.ts
+++ b/client/src/app/videos/videos.routes.ts
@@ -1,11 +1,11 @@
1import { RouterConfig } from '@angular/router'; 1import { Routes } from '@angular/router';
2 2
3import { VideoAddComponent } from './video-add'; 3import { VideoAddComponent } from './video-add';
4import { VideoListComponent } from './video-list'; 4import { VideoListComponent } from './video-list';
5import { VideosComponent } from './videos.component'; 5import { VideosComponent } from './videos.component';
6import { VideoWatchComponent } from './video-watch'; 6import { VideoWatchComponent } from './video-watch';
7 7
8export const VideosRoutes: RouterConfig = [ 8export const VideosRoutes: Routes = [
9 { 9 {
10 path: 'videos', 10 path: 'videos',
11 component: VideosComponent, 11 component: VideosComponent,