From feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 11 Dec 2016 21:50:51 +0100 Subject: First version with PostgreSQL --- .../app/admin/friends/friend-list/friend-list.component.html | 2 +- client/src/app/admin/friends/shared/friend.model.ts | 2 +- .../admin/requests/request-stats/request-stats.component.html | 2 +- .../admin/requests/request-stats/request-stats.component.ts | 2 +- client/src/app/admin/requests/shared/request-stats.model.ts | 6 +++--- client/src/app/admin/users/user-list/user-list.component.html | 2 +- client/src/app/shared/auth/auth-user.model.ts | 9 +++------ client/src/app/shared/search/search-field.type.ts | 2 +- client/src/app/shared/search/search.component.ts | 4 ++-- client/src/app/shared/users/user.model.ts | 10 +++++----- client/src/app/videos/shared/sort-field.type.ts | 2 +- client/src/app/videos/shared/video.model.ts | 6 +++--- client/src/app/videos/video-list/video-list.component.ts | 2 +- .../src/app/videos/video-list/video-miniature.component.html | 2 +- .../src/app/videos/video-list/video-miniature.component.scss | 2 +- client/src/app/videos/video-list/video-sort.component.ts | 4 ++-- client/src/app/videos/video-watch/video-watch.component.html | 2 +- 17 files changed, 29 insertions(+), 32 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.html b/client/src/app/admin/friends/friend-list/friend-list.component.html index 4236fc5f6..06258f8c8 100644 --- a/client/src/app/admin/friends/friend-list/friend-list.component.html +++ b/client/src/app/admin/friends/friend-list/friend-list.component.html @@ -15,7 +15,7 @@ {{ friend.id }} {{ friend.host }} {{ friend.score }} - {{ friend.createdDate | date: 'medium' }} + {{ friend.createdAt | date: 'medium' }} diff --git a/client/src/app/admin/friends/shared/friend.model.ts b/client/src/app/admin/friends/shared/friend.model.ts index 3c23feebc..462cc82ed 100644 --- a/client/src/app/admin/friends/shared/friend.model.ts +++ b/client/src/app/admin/friends/shared/friend.model.ts @@ -2,5 +2,5 @@ export interface Friend { id: string; host: string; score: number; - createdDate: Date; + createdAt: Date; } diff --git a/client/src/app/admin/requests/request-stats/request-stats.component.html b/client/src/app/admin/requests/request-stats/request-stats.component.html index b5ac59a9a..6698eac48 100644 --- a/client/src/app/admin/requests/request-stats/request-stats.component.html +++ b/client/src/app/admin/requests/request-stats/request-stats.component.html @@ -18,6 +18,6 @@
Remaining requests: - {{ stats.requests.length }} + {{ stats.totalRequests }}
diff --git a/client/src/app/admin/requests/request-stats/request-stats.component.ts b/client/src/app/admin/requests/request-stats/request-stats.component.ts index d20b12199..9e2af219c 100644 --- a/client/src/app/admin/requests/request-stats/request-stats.component.ts +++ b/client/src/app/admin/requests/request-stats/request-stats.component.ts @@ -19,7 +19,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy { } ngOnDestroy() { - if (this.stats.secondsInterval !== null) { + if (this.stats !== null && this.stats.secondsInterval !== null) { clearInterval(this.interval); } } diff --git a/client/src/app/admin/requests/shared/request-stats.model.ts b/client/src/app/admin/requests/shared/request-stats.model.ts index 766e80836..49ecbc79e 100644 --- a/client/src/app/admin/requests/shared/request-stats.model.ts +++ b/client/src/app/admin/requests/shared/request-stats.model.ts @@ -7,18 +7,18 @@ export class RequestStats { maxRequestsInParallel: number; milliSecondsInterval: number; remainingMilliSeconds: number; - requests: Request[]; + totalRequests: number; constructor(hash: { maxRequestsInParallel: number, milliSecondsInterval: number, remainingMilliSeconds: number, - requests: Request[]; + totalRequests: number; }) { this.maxRequestsInParallel = hash.maxRequestsInParallel; this.milliSecondsInterval = hash.milliSecondsInterval; this.remainingMilliSeconds = hash.remainingMilliSeconds; - this.requests = hash.requests; + this.totalRequests = hash.totalRequests; } get remainingSeconds() { diff --git a/client/src/app/admin/users/user-list/user-list.component.html b/client/src/app/admin/users/user-list/user-list.component.html index 328b1be77..36193d119 100644 --- a/client/src/app/admin/users/user-list/user-list.component.html +++ b/client/src/app/admin/users/user-list/user-list.component.html @@ -14,7 +14,7 @@ {{ user.id }} {{ user.username }} - {{ user.createdDate | date: 'medium' }} + {{ user.createdAt | date: 'medium' }} diff --git a/client/src/app/shared/auth/auth-user.model.ts b/client/src/app/shared/auth/auth-user.model.ts index bdd5ea5a9..f560351f4 100644 --- a/client/src/app/shared/auth/auth-user.model.ts +++ b/client/src/app/shared/auth/auth-user.model.ts @@ -7,9 +7,6 @@ export class AuthUser extends User { USERNAME: 'username' }; - id: string; - role: string; - username: string; tokens: Tokens; static load() { @@ -17,7 +14,7 @@ export class AuthUser extends User { if (usernameLocalStorage) { return new AuthUser( { - id: localStorage.getItem(this.KEYS.ID), + id: parseInt(localStorage.getItem(this.KEYS.ID)), username: localStorage.getItem(this.KEYS.USERNAME), role: localStorage.getItem(this.KEYS.ROLE) }, @@ -35,7 +32,7 @@ export class AuthUser extends User { Tokens.flush(); } - constructor(userHash: { id: string, username: string, role: string }, hashTokens: any) { + constructor(userHash: { id: number, username: string, role: string }, hashTokens: any) { super(userHash); this.tokens = new Tokens(hashTokens); } @@ -58,7 +55,7 @@ export class AuthUser extends User { } save() { - localStorage.setItem(AuthUser.KEYS.ID, this.id); + localStorage.setItem(AuthUser.KEYS.ID, this.id.toString()); localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); localStorage.setItem(AuthUser.KEYS.ROLE, this.role); this.tokens.save(); diff --git a/client/src/app/shared/search/search-field.type.ts b/client/src/app/shared/search/search-field.type.ts index 5228ee68a..6be584ed1 100644 --- a/client/src/app/shared/search/search-field.type.ts +++ b/client/src/app/shared/search/search-field.type.ts @@ -1 +1 @@ -export type SearchField = "name" | "author" | "podUrl" | "magnetUri" | "tags"; +export type SearchField = "name" | "author" | "host" | "magnetUri" | "tags"; diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts index b6237469b..9f7e156ec 100644 --- a/client/src/app/shared/search/search.component.ts +++ b/client/src/app/shared/search/search.component.ts @@ -14,8 +14,8 @@ export class SearchComponent implements OnInit { fieldChoices = { name: 'Name', author: 'Author', - podUrl: 'Pod Url', - magnetUri: 'Magnet Uri', + host: 'Pod Host', + magnetUri: 'Magnet URI', tags: 'Tags' }; searchCriterias: Search = { diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 726495d11..52d89e004 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts @@ -1,16 +1,16 @@ export class User { - id: string; + id: number; username: string; role: string; - createdDate: Date; + createdAt: Date; - constructor(hash: { id: string, username: string, role: string, createdDate?: Date }) { + constructor(hash: { id: number, username: string, role: string, createdAt?: Date }) { this.id = hash.id; this.username = hash.username; this.role = hash.role; - if (hash.createdDate) { - this.createdDate = hash.createdDate; + if (hash.createdAt) { + this.createdAt = hash.createdAt; } } diff --git a/client/src/app/videos/shared/sort-field.type.ts b/client/src/app/videos/shared/sort-field.type.ts index 6e8cc7936..74908e344 100644 --- a/client/src/app/videos/shared/sort-field.type.ts +++ b/client/src/app/videos/shared/sort-field.type.ts @@ -1,3 +1,3 @@ export type SortField = "name" | "-name" | "duration" | "-duration" - | "createdDate" | "-createdDate"; + | "createdAt" | "-createdAt"; diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index b51a0e9de..fae001d78 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts @@ -1,7 +1,7 @@ export class Video { author: string; by: string; - createdDate: Date; + createdAt: Date; description: string; duration: string; id: string; @@ -27,7 +27,7 @@ export class Video { constructor(hash: { author: string, - createdDate: string, + createdAt: string, description: string, duration: number; id: string, @@ -39,7 +39,7 @@ export class Video { thumbnailPath: string }) { this.author = hash.author; - this.createdDate = new Date(hash.createdDate); + this.createdAt = new Date(hash.createdAt); this.description = hash.description; this.duration = Video.createDurationString(hash.duration); this.id = hash.id; 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 a8b92480b..6c42ba5be 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts @@ -145,7 +145,7 @@ export class VideoListComponent implements OnInit, OnDestroy { }; } - this.sort = routeParams['sort'] || '-createdDate'; + this.sort = routeParams['sort'] || '-createdAt'; if (routeParams['page'] !== undefined) { this.pagination.currentPage = parseInt(routeParams['page']); diff --git a/client/src/app/videos/video-list/video-miniature.component.html b/client/src/app/videos/video-list/video-miniature.component.html index 16513902b..f2f4a53a9 100644 --- a/client/src/app/videos/video-list/video-miniature.component.html +++ b/client/src/app/videos/video-list/video-miniature.component.html @@ -23,6 +23,6 @@ {{ video.by }} - {{ video.createdDate | date:'short' }} + {{ video.createdAt | date:'short' }} diff --git a/client/src/app/videos/video-list/video-miniature.component.scss b/client/src/app/videos/video-list/video-miniature.component.scss index 6b3fa3bf0..d70b1b50d 100644 --- a/client/src/app/videos/video-list/video-miniature.component.scss +++ b/client/src/app/videos/video-list/video-miniature.component.scss @@ -79,7 +79,7 @@ } } - .video-miniature-author, .video-miniature-created-date { + .video-miniature-author, .video-miniature-created-at { display: block; margin-left: 1px; font-size: 12px; diff --git a/client/src/app/videos/video-list/video-sort.component.ts b/client/src/app/videos/video-list/video-sort.component.ts index ca94b07c2..53951deb4 100644 --- a/client/src/app/videos/video-list/video-sort.component.ts +++ b/client/src/app/videos/video-list/video-sort.component.ts @@ -17,8 +17,8 @@ export class VideoSortComponent { '-name': 'Name - Desc', 'duration': 'Duration - Asc', '-duration': 'Duration - Desc', - 'createdDate': 'Created Date - Asc', - '-createdDate': 'Created Date - Desc' + 'createdAt': 'Created Date - Asc', + '-createdAt': 'Created Date - Desc' }; get choiceKeys() { diff --git a/client/src/app/videos/video-watch/video-watch.component.html b/client/src/app/videos/video-watch/video-watch.component.html index 0f0fa68cc..a726ef3ff 100644 --- a/client/src/app/videos/video-watch/video-watch.component.html +++ b/client/src/app/videos/video-watch/video-watch.component.html @@ -47,7 +47,7 @@ {{ video.by }} - on {{ video.createdDate | date:'short' }} + on {{ video.createdAt | date:'short' }} -- cgit v1.2.3