diff options
Diffstat (limited to 'client/src/app/+admin')
14 files changed, 47 insertions, 97 deletions
diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts index 0cd3e54c2..c3e4895ac 100644 --- a/client/src/app/+admin/admin-routing.module.ts +++ b/client/src/app/+admin/admin-routing.module.ts | |||
@@ -9,7 +9,7 @@ import { RequestSchedulersRoutes } from './request-schedulers' | |||
9 | import { UsersRoutes } from './users' | 9 | import { UsersRoutes } from './users' |
10 | import { VideoAbusesRoutes } from './video-abuses' | 10 | import { VideoAbusesRoutes } from './video-abuses' |
11 | import { AdminGuard } from './admin-guard.service' | 11 | import { AdminGuard } from './admin-guard.service' |
12 | import { BlacklistRoutes } from './blacklist' | 12 | import { VideoBlacklistRoutes } from './video-blacklist' |
13 | 13 | ||
14 | const adminRoutes: Routes = [ | 14 | const adminRoutes: Routes = [ |
15 | { | 15 | { |
@@ -27,7 +27,7 @@ const adminRoutes: Routes = [ | |||
27 | ...RequestSchedulersRoutes, | 27 | ...RequestSchedulersRoutes, |
28 | ...UsersRoutes, | 28 | ...UsersRoutes, |
29 | ...VideoAbusesRoutes, | 29 | ...VideoAbusesRoutes, |
30 | ...BlacklistRoutes | 30 | ...VideoBlacklistRoutes |
31 | ] | 31 | ] |
32 | } | 32 | } |
33 | ] | 33 | ] |
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts index 93ec216bf..ecd62ee61 100644 --- a/client/src/app/+admin/admin.component.ts +++ b/client/src/app/+admin/admin.component.ts | |||
@@ -3,6 +3,5 @@ import { Component } from '@angular/core' | |||
3 | @Component({ | 3 | @Component({ |
4 | template: '<router-outlet></router-outlet>' | 4 | template: '<router-outlet></router-outlet>' |
5 | }) | 5 | }) |
6 | |||
7 | export class AdminComponent { | 6 | export class AdminComponent { |
8 | } | 7 | } |
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index c2dd60774..f29c501b0 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts | |||
@@ -6,7 +6,7 @@ import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendServic | |||
6 | import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers' | 6 | import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers' |
7 | import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users' | 7 | import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users' |
8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' | 8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' |
9 | import { BlacklistComponent, BlacklistListComponent, BlacklistService } from './blacklist' | 9 | import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist' |
10 | import { SharedModule } from '../shared' | 10 | import { SharedModule } from '../shared' |
11 | import { AdminGuard } from './admin-guard.service' | 11 | import { AdminGuard } from './admin-guard.service' |
12 | 12 | ||
@@ -31,8 +31,8 @@ import { AdminGuard } from './admin-guard.service' | |||
31 | UserUpdateComponent, | 31 | UserUpdateComponent, |
32 | UserListComponent, | 32 | UserListComponent, |
33 | 33 | ||
34 | BlacklistComponent, | 34 | VideoBlacklistComponent, |
35 | BlacklistListComponent, | 35 | VideoBlacklistListComponent, |
36 | 36 | ||
37 | VideoAbusesComponent, | 37 | VideoAbusesComponent, |
38 | VideoAbuseListComponent | 38 | VideoAbuseListComponent |
@@ -46,8 +46,7 @@ import { AdminGuard } from './admin-guard.service' | |||
46 | FriendService, | 46 | FriendService, |
47 | RequestSchedulersService, | 47 | RequestSchedulersService, |
48 | UserService, | 48 | UserService, |
49 | AdminGuard, | 49 | AdminGuard |
50 | BlacklistService | ||
51 | ] | 50 | ] |
52 | }) | 51 | }) |
53 | export class AdminModule { } | 52 | export class AdminModule { } |
diff --git a/client/src/app/+admin/blacklist/blacklist-list/index.ts b/client/src/app/+admin/blacklist/blacklist-list/index.ts deleted file mode 100644 index 45f60a2b9..000000000 --- a/client/src/app/+admin/blacklist/blacklist-list/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './blacklist-list.component' | ||
diff --git a/client/src/app/+admin/blacklist/blacklist.routes.ts b/client/src/app/+admin/blacklist/blacklist.routes.ts deleted file mode 100644 index 780347ca8..000000000 --- a/client/src/app/+admin/blacklist/blacklist.routes.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { Routes } from '@angular/router' | ||
2 | |||
3 | import { BlacklistComponent } from './blacklist.component' | ||
4 | import { BlacklistListComponent } from './blacklist-list' | ||
5 | |||
6 | export const BlacklistRoutes: Routes = [ | ||
7 | { | ||
8 | path: 'blacklist', | ||
9 | component: BlacklistComponent, | ||
10 | children: [ | ||
11 | { | ||
12 | path: '', | ||
13 | redirectTo: 'list', | ||
14 | pathMatch: 'full' | ||
15 | }, | ||
16 | { | ||
17 | path: 'list', | ||
18 | component: BlacklistListComponent, | ||
19 | data: { | ||
20 | meta: { | ||
21 | title: 'Blacklisted videos' | ||
22 | } | ||
23 | } | ||
24 | } | ||
25 | ] | ||
26 | } | ||
27 | ] | ||
diff --git a/client/src/app/+admin/blacklist/index.ts b/client/src/app/+admin/blacklist/index.ts deleted file mode 100644 index 675dc1263..000000000 --- a/client/src/app/+admin/blacklist/index.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export * from './shared' | ||
2 | export * from './blacklist-list' | ||
3 | export * from './blacklist.component' | ||
4 | export * from './blacklist.routes' | ||
diff --git a/client/src/app/+admin/blacklist/shared/blacklist.service.ts b/client/src/app/+admin/blacklist/shared/blacklist.service.ts deleted file mode 100644 index ee2bf82e9..000000000 --- a/client/src/app/+admin/blacklist/shared/blacklist.service.ts +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { HttpClient, HttpParams } from '@angular/common/http' | ||
3 | import { Observable } from 'rxjs/Observable' | ||
4 | import 'rxjs/add/operator/catch' | ||
5 | import 'rxjs/add/operator/map' | ||
6 | |||
7 | import { SortMeta } from 'primeng/components/common/sortmeta' | ||
8 | |||
9 | import { RestExtractor, RestPagination, RestService } from '../../../shared' | ||
10 | import { Utils } from '../../../shared' | ||
11 | import { BlacklistedVideo, ResultList } from '../../../../../../shared' | ||
12 | |||
13 | @Injectable() | ||
14 | export class BlacklistService { | ||
15 | private static BASE_BLACKLISTS_URL = API_URL + '/api/v1/blacklist/' | ||
16 | |||
17 | constructor ( | ||
18 | private authHttp: HttpClient, | ||
19 | private restService: RestService, | ||
20 | private restExtractor: RestExtractor | ||
21 | ) {} | ||
22 | |||
23 | getBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<BlacklistedVideo>> { | ||
24 | let params = new HttpParams() | ||
25 | params = this.restService.addRestGetParams(params, pagination, sort) | ||
26 | |||
27 | return this.authHttp.get<ResultList<BlacklistedVideo>>(BlacklistService.BASE_BLACKLISTS_URL, { params }) | ||
28 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) | ||
29 | .map(res => this.restExtractor.applyToResultListData(res, this.formatBlacklistedVideo.bind(this))) | ||
30 | .catch(res => this.restExtractor.handleError(res)) | ||
31 | } | ||
32 | |||
33 | removeVideoFromBlacklist (entry: BlacklistedVideo) { | ||
34 | return this.authHttp.delete(BlacklistService.BASE_BLACKLISTS_URL + entry.id) | ||
35 | .map(this.restExtractor.extractDataBool) | ||
36 | .catch(res => this.restExtractor.handleError(res)) | ||
37 | } | ||
38 | |||
39 | private formatBlacklistedVideo (blacklistedVideo: BlacklistedVideo) { | ||
40 | return Object.assign(blacklistedVideo, { | ||
41 | createdAt: Utils.dateToHuman(blacklistedVideo.createdAt) | ||
42 | }) | ||
43 | } | ||
44 | } | ||
diff --git a/client/src/app/+admin/blacklist/shared/index.ts b/client/src/app/+admin/blacklist/shared/index.ts deleted file mode 100644 index ad22e2d51..000000000 --- a/client/src/app/+admin/blacklist/shared/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './blacklist.service' | ||
diff --git a/client/src/app/+admin/video-blacklist/index.ts b/client/src/app/+admin/video-blacklist/index.ts new file mode 100644 index 000000000..a5451e2e1 --- /dev/null +++ b/client/src/app/+admin/video-blacklist/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-blacklist-list' | ||
2 | export * from './video-blacklist.component' | ||
3 | export * from './video-blacklist.routes' | ||
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/index.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/index.ts new file mode 100644 index 000000000..4daf64187 --- /dev/null +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './video-blacklist-list.component' | |||
diff --git a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html index 5d4636ee9..05d116798 100644 --- a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html | |||
@@ -18,8 +18,8 @@ | |||
18 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> | 18 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> |
19 | <p-column header="Delete" styleClass="action-cell"> | 19 | <p-column header="Delete" styleClass="action-cell"> |
20 | <ng-template pTemplate="body" let-entry="rowData"> | 20 | <ng-template pTemplate="body" let-entry="rowData"> |
21 | <span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video"></span> | 21 | <span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video from blacklist"></span> |
22 | </ng-template> | 22 | </ng-template> |
23 | </p-column> | 23 | </p-column> |
24 | </p-dataTable> | 24 | </p-dataTable> |
25 | </div> | 25 | </div> |
diff --git a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts index b308054ed..56024b247 100644 --- a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts | |||
@@ -4,16 +4,15 @@ import { SortMeta } from 'primeng/components/common/sortmeta' | |||
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
5 | 5 | ||
6 | import { ConfirmService } from '../../../core' | 6 | import { ConfirmService } from '../../../core' |
7 | import { RestTable, RestPagination } from '../../../shared' | 7 | import { VideoBlacklistService, RestTable, RestPagination } from '../../../shared' |
8 | import { BlacklistService } from '../shared' | ||
9 | import { BlacklistedVideo } from '../../../../../../shared' | 8 | import { BlacklistedVideo } from '../../../../../../shared' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
12 | selector: 'my-blacklist-list', | 11 | selector: 'my-video-blacklist-list', |
13 | templateUrl: './blacklist-list.component.html', | 12 | templateUrl: './video-blacklist-list.component.html', |
14 | styleUrls: [] | 13 | styleUrls: [] |
15 | }) | 14 | }) |
16 | export class BlacklistListComponent extends RestTable implements OnInit { | 15 | export class VideoBlacklistListComponent extends RestTable implements OnInit { |
17 | blacklist: BlacklistedVideo[] = [] | 16 | blacklist: BlacklistedVideo[] = [] |
18 | totalRecords = 0 | 17 | totalRecords = 0 |
19 | rowsPerPage = 10 | 18 | rowsPerPage = 10 |
@@ -23,7 +22,7 @@ export class BlacklistListComponent extends RestTable implements OnInit { | |||
23 | constructor ( | 22 | constructor ( |
24 | private notificationsService: NotificationsService, | 23 | private notificationsService: NotificationsService, |
25 | private confirmService: ConfirmService, | 24 | private confirmService: ConfirmService, |
26 | private blacklistService: BlacklistService | 25 | private videoBlacklistService: VideoBlacklistService |
27 | ) { | 26 | ) { |
28 | super() | 27 | super() |
29 | } | 28 | } |
@@ -39,7 +38,7 @@ export class BlacklistListComponent extends RestTable implements OnInit { | |||
39 | res => { | 38 | res => { |
40 | if (res === false) return | 39 | if (res === false) return |
41 | 40 | ||
42 | this.blacklistService.removeVideoFromBlacklist(entry).subscribe( | 41 | this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( |
43 | status => { | 42 | status => { |
44 | this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`) | 43 | this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`) |
45 | this.loadData() | 44 | this.loadData() |
@@ -52,7 +51,7 @@ export class BlacklistListComponent extends RestTable implements OnInit { | |||
52 | } | 51 | } |
53 | 52 | ||
54 | protected loadData () { | 53 | protected loadData () { |
55 | this.blacklistService.getBlacklist(this.pagination, this.sort) | 54 | this.videoBlacklistService.listBlacklist(this.pagination, this.sort) |
56 | .subscribe( | 55 | .subscribe( |
57 | resultList => { | 56 | resultList => { |
58 | this.blacklist = resultList.data | 57 | this.blacklist = resultList.data |
diff --git a/client/src/app/+admin/blacklist/blacklist.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist.component.ts index ce8fe4298..24b8c98f8 100644 --- a/client/src/app/+admin/blacklist/blacklist.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist.component.ts | |||
@@ -3,6 +3,5 @@ import { Component } from '@angular/core' | |||
3 | @Component({ | 3 | @Component({ |
4 | template: '<router-outlet></router-outlet>' | 4 | template: '<router-outlet></router-outlet>' |
5 | }) | 5 | }) |
6 | 6 | export class VideoBlacklistComponent { | |
7 | export class BlacklistComponent { | ||
8 | } | 7 | } |
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts b/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts new file mode 100644 index 000000000..682b6f8bd --- /dev/null +++ b/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | import { Routes } from '@angular/router' | ||
2 | |||
3 | import { VideoBlacklistComponent } from './video-blacklist.component' | ||
4 | import { VideoBlacklistListComponent } from './video-blacklist-list' | ||
5 | |||
6 | export const VideoBlacklistRoutes: Routes = [ | ||
7 | { | ||
8 | path: 'video-blacklist', | ||
9 | component: VideoBlacklistComponent, | ||
10 | children: [ | ||
11 | { | ||
12 | path: '', | ||
13 | redirectTo: 'list', | ||
14 | pathMatch: 'full' | ||
15 | }, | ||
16 | { | ||
17 | path: 'list', | ||
18 | component: VideoBlacklistListComponent, | ||
19 | data: { | ||
20 | meta: { | ||
21 | title: 'Blacklisted videos' | ||
22 | } | ||
23 | } | ||
24 | } | ||
25 | ] | ||
26 | } | ||
27 | ] | ||