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 --- client/src/app/admin/friends/friend-list/friend-list.component.html | 2 +- client/src/app/admin/friends/shared/friend.model.ts | 2 +- .../app/admin/requests/request-stats/request-stats.component.html | 2 +- .../src/app/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 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'client/src/app/admin') 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' }} -- cgit v1.2.3 From 55fa55a9be566cca2ba95322f2ae23b434aed62a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Jan 2017 20:59:23 +0100 Subject: Server: add video abuse support --- .../admin/friends/friend-list/friend-list.component.ts | 2 +- client/src/app/admin/friends/shared/friend.service.ts | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'client/src/app/admin') 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 88c4800ee..bec10162c 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 @@ -30,7 +30,7 @@ export class FriendListComponent implements OnInit { private getFriends() { this.friendService.getFriends().subscribe( - friends => this.friends = friends, + res => this.friends = res.friends, err => alert(err.text) ); diff --git a/client/src/app/admin/friends/shared/friend.service.ts b/client/src/app/admin/friends/shared/friend.service.ts index 8a1ba6b02..85ac04ba0 100644 --- a/client/src/app/admin/friends/shared/friend.service.ts +++ b/client/src/app/admin/friends/shared/friend.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Friend } from './friend.model'; -import { AuthHttp, RestExtractor } from '../../../shared'; +import { AuthHttp, RestExtractor, ResultList } from '../../../shared'; @Injectable() export class FriendService { @@ -13,11 +13,10 @@ export class FriendService { private restExtractor: RestExtractor ) {} - getFriends(): Observable { + getFriends() { return this.authHttp.get(FriendService.BASE_FRIEND_URL) - // Not implemented as a data list by the server yet - // .map(this.restExtractor.extractDataList) - .map((res) => res.json()) + .map(this.restExtractor.extractDataList) + .map(this.extractFriends) .catch((res) => this.restExtractor.handleError(res)); } @@ -36,4 +35,11 @@ export class FriendService { .map(res => res.status) .catch((res) => this.restExtractor.handleError(res)); } + + private extractFriends(result: ResultList) { + const friends: Friend[] = result.data; + const totalFriends = result.total; + + return { friends, totalFriends }; + } } -- cgit v1.2.3