aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/angular/app/app.component.ts2
-rw-r--r--client/angular/app/search.component.ts20
-rw-r--r--client/angular/videos/components/list/video-sort.component.ts12
-rw-r--r--client/angular/videos/components/list/videos-list.component.ts4
-rw-r--r--client/angular/videos/video.ts39
-rw-r--r--client/angular/videos/videos.service.ts6
6 files changed, 41 insertions, 42 deletions
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts
index bfd5adaee..3a6df844a 100644
--- a/client/angular/app/app.component.ts
+++ b/client/angular/app/app.component.ts
@@ -2,8 +2,6 @@ import { Component } from '@angular/core';
2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated'; 2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
3import { HTTP_PROVIDERS } from '@angular/http'; 3import { HTTP_PROVIDERS } from '@angular/http';
4 4
5import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
6
7import { VideosAddComponent } from '../videos/components/add/videos-add.component'; 5import { VideosAddComponent } from '../videos/components/add/videos-add.component';
8import { VideosListComponent } from '../videos/components/list/videos-list.component'; 6import { VideosListComponent } from '../videos/components/list/videos-list.component';
9import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component'; 7import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component';
diff --git a/client/angular/app/search.component.ts b/client/angular/app/search.component.ts
index 3e8db70c0..e21b91fce 100644
--- a/client/angular/app/search.component.ts
+++ b/client/angular/app/search.component.ts
@@ -1,6 +1,4 @@
1import { Component, EventEmitter, Output } from '@angular/core'; 1import { Component, EventEmitter, Output } from '@angular/core';
2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
3import { HTTP_PROVIDERS } from '@angular/http';
4 2
5import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; 3import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
6 4
@@ -16,15 +14,15 @@ export class SearchComponent {
16 @Output() search: EventEmitter<Search> = new EventEmitter<Search>(); 14 @Output() search: EventEmitter<Search> = new EventEmitter<Search>();
17 15
18 searchCriterias: Search = { 16 searchCriterias: Search = {
19 field: "name", 17 field: 'name',
20 value: "" 18 value: ''
21 } 19 };
22 fieldChoices = { 20 fieldChoices = {
23 name: "Name", 21 name: 'Name',
24 author: "Author", 22 author: 'Author',
25 podUrl: "Pod Url", 23 podUrl: 'Pod Url',
26 magnetUri: "Magnet Uri" 24 magnetUri: 'Magnet Uri'
27 } 25 };
28 26
29 get choiceKeys() { 27 get choiceKeys() {
30 return Object.keys(this.fieldChoices); 28 return Object.keys(this.fieldChoices);
@@ -34,7 +32,7 @@ export class SearchComponent {
34 return this.fieldChoices[choiceKey]; 32 return this.fieldChoices[choiceKey];
35 } 33 }
36 34
37 choose($event:MouseEvent, choice: SearchField){ 35 choose($event:MouseEvent, choice: SearchField) {
38 $event.preventDefault(); 36 $event.preventDefault();
39 $event.stopPropagation(); 37 $event.stopPropagation();
40 38
diff --git a/client/angular/videos/components/list/video-sort.component.ts b/client/angular/videos/components/list/video-sort.component.ts
index e63a70e9e..0373cea38 100644
--- a/client/angular/videos/components/list/video-sort.component.ts
+++ b/client/angular/videos/components/list/video-sort.component.ts
@@ -15,12 +15,12 @@ export class VideoSortComponent {
15 15
16 sortChoices = { 16 sortChoices = {
17 'name': 'Name - Asc', 17 'name': 'Name - Asc',
18 '-name': "Name - Desc", 18 '-name': 'Name - Desc',
19 'duration': "Duration - Asc", 19 'duration': 'Duration - Asc',
20 '-duration': "Duration - Desc", 20 '-duration': 'Duration - Desc',
21 'createdDate': "Created Date - Asc", 21 'createdDate': 'Created Date - Asc',
22 '-createdDate': "Created Date - Desc" 22 '-createdDate': 'Created Date - Desc'
23 } 23 };
24 24
25 get choiceKeys() { 25 get choiceKeys() {
26 return Object.keys(this.sortChoices); 26 return Object.keys(this.sortChoices);
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts
index 98fe7b153..db64a856e 100644
--- a/client/angular/videos/components/list/videos-list.component.ts
+++ b/client/angular/videos/components/list/videos-list.component.ts
@@ -27,7 +27,7 @@ export class VideosListComponent implements OnInit {
27 currentPage: 1, 27 currentPage: 1,
28 itemsPerPage: 9, 28 itemsPerPage: 9,
29 total: 0 29 total: 0
30 } 30 };
31 sort: SortField; 31 sort: SortField;
32 32
33 private search: Search; 33 private search: Search;
@@ -41,7 +41,7 @@ export class VideosListComponent implements OnInit {
41 this.search = { 41 this.search = {
42 value: this._routeParams.get('search'), 42 value: this._routeParams.get('search'),
43 field: <SearchField>this._routeParams.get('field') 43 field: <SearchField>this._routeParams.get('field')
44 } 44 };
45 45
46 this.sort = <SortField>this._routeParams.get('sort') || '-createdDate'; 46 this.sort = <SortField>this._routeParams.get('sort') || '-createdDate';
47 } 47 }
diff --git a/client/angular/videos/video.ts b/client/angular/videos/video.ts
index 32ff64eb3..eec537c9e 100644
--- a/client/angular/videos/video.ts
+++ b/client/angular/videos/video.ts
@@ -11,6 +11,27 @@ export class Video {
11 by: string; 11 by: string;
12 duration: string; 12 duration: string;
13 13
14 private static createDurationString(duration: number): string {
15 const minutes = Math.floor(duration / 60);
16 const seconds = duration % 60;
17 const minutes_padding = minutes >= 10 ? '' : '0';
18 const seconds_padding = seconds >= 10 ? '' : '0';
19
20 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
21 }
22
23 private static createByString(author: string, podUrl: string): string {
24 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
25
26 if (port === '80' || port === '443') {
27 port = '';
28 } else {
29 port = ':' + port;
30 }
31
32 return author + '@' + host + port;
33 }
34
14 constructor(hash: { 35 constructor(hash: {
15 id: string, 36 id: string,
16 name: string, 37 name: string,
@@ -39,22 +60,4 @@ export class Video {
39 isRemovableBy(user): boolean { 60 isRemovableBy(user): boolean {
40 return this.isLocal === true && user && this.author === user.username; 61 return this.isLocal === true && user && this.author === user.username;
41 } 62 }
42
43 private static createDurationString(duration: number): string {
44 const minutes = Math.floor(duration / 60);
45 const seconds = duration % 60;
46 const minutes_padding = minutes >= 10 ? '' : '0';
47 const seconds_padding = seconds >= 10 ? '' : '0'
48
49 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
50 }
51
52 private static createByString(author: string, podUrl: string): string {
53 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
54
55 if (port === '80' || port === '443') port = '';
56 else port = ':' + port;
57
58 return author + '@' + host + port;
59 }
60} 63}
diff --git a/client/angular/videos/videos.service.ts b/client/angular/videos/videos.service.ts
index 43e3346aa..d5438fd82 100644
--- a/client/angular/videos/videos.service.ts
+++ b/client/angular/videos/videos.service.ts
@@ -1,5 +1,5 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Http, Response, RequestOptions, URLSearchParams } from '@angular/http'; 2import { Http, Response, URLSearchParams } from '@angular/http';
3import { Observable } from 'rxjs/Rx'; 3import { Observable } from 'rxjs/Rx';
4 4
5import { Pagination } from './pagination'; 5import { Pagination } from './pagination';
@@ -17,7 +17,7 @@ export class VideosService {
17 getVideos(pagination: Pagination, sort: SortField) { 17 getVideos(pagination: Pagination, sort: SortField) {
18 const params = this.createPaginationParams(pagination); 18 const params = this.createPaginationParams(pagination);
19 19
20 if (sort) params.set('sort', sort) 20 if (sort) params.set('sort', sort);
21 21
22 return this.http.get(this._baseVideoUrl, { search: params }) 22 return this.http.get(this._baseVideoUrl, { search: params })
23 .map(res => res.json()) 23 .map(res => res.json())
@@ -42,7 +42,7 @@ export class VideosService {
42 const params = this.createPaginationParams(pagination); 42 const params = this.createPaginationParams(pagination);
43 43
44 if (search.field) params.set('field', search.field); 44 if (search.field) params.set('field', search.field);
45 if (sort) params.set('sort', sort) 45 if (sort) params.set('sort', sort);
46 46
47 return this.http.get(this._baseVideoUrl + 'search/' + encodeURIComponent(search.value), { search: params }) 47 return this.http.get(this._baseVideoUrl + 'search/' + encodeURIComponent(search.value), { search: params })
48 .map(res => res.json()) 48 .map(res => res.json())