aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/blacklist
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/blacklist')
-rw-r--r--client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html26
-rw-r--r--client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts65
-rw-r--r--client/src/app/+admin/blacklist/blacklist-list/index.ts1
-rw-r--r--client/src/app/+admin/blacklist/blacklist.component.ts8
-rw-r--r--client/src/app/+admin/blacklist/blacklist.routes.ts27
-rw-r--r--client/src/app/+admin/blacklist/index.ts4
-rw-r--r--client/src/app/+admin/blacklist/shared/blacklist.service.ts44
-rw-r--r--client/src/app/+admin/blacklist/shared/index.ts1
8 files changed, 0 insertions, 176 deletions
diff --git a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html b/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html
deleted file mode 100644
index 5d4636ee9..000000000
--- a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html
+++ /dev/null
@@ -1,26 +0,0 @@
1<div class="row">
2 <div class="content-padding">
3 <h3>Blacklisted videos</h3>
4
5 <p-dataTable
6 [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
7 sortField="id" (onLazyLoad)="loadLazy($event)"
8 >
9 <p-column field="id" header="ID" [sortable]="true"></p-column>
10 <p-column field="name" header="Name" [sortable]="true"></p-column>
11 <p-column field="description" header="Description"></p-column>
12 <p-column field="duration" header="Duration" [sortable]="true"></p-column>
13 <p-column field="views" header="Views" [sortable]="true"></p-column>
14 <p-column field="likes" header="Likes" [sortable]="true"></p-column>
15 <p-column field="dislikes" header="Dislikes" [sortable]="true"></p-column>
16 <p-column field="nsfw" header="NSFW"></p-column>
17 <p-column field="uuid" header="UUID" [sortable]="true"></p-column>
18 <p-column field="createdAt" header="Created date" [sortable]="true"></p-column>
19 <p-column header="Delete" styleClass="action-cell">
20 <ng-template pTemplate="body" let-entry="rowData">
21 <span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video"></span>
22 </ng-template>
23 </p-column>
24 </p-dataTable>
25 </div>
26</div>
diff --git a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts b/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts
deleted file mode 100644
index b308054ed..000000000
--- a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts
+++ /dev/null
@@ -1,65 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { SortMeta } from 'primeng/components/common/sortmeta'
3
4import { NotificationsService } from 'angular2-notifications'
5
6import { ConfirmService } from '../../../core'
7import { RestTable, RestPagination } from '../../../shared'
8import { BlacklistService } from '../shared'
9import { BlacklistedVideo } from '../../../../../../shared'
10
11@Component({
12 selector: 'my-blacklist-list',
13 templateUrl: './blacklist-list.component.html',
14 styleUrls: []
15})
16export class BlacklistListComponent extends RestTable implements OnInit {
17 blacklist: BlacklistedVideo[] = []
18 totalRecords = 0
19 rowsPerPage = 10
20 sort: SortMeta = { field: 'id', order: 1 }
21 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
22
23 constructor (
24 private notificationsService: NotificationsService,
25 private confirmService: ConfirmService,
26 private blacklistService: BlacklistService
27 ) {
28 super()
29 }
30
31 ngOnInit () {
32 this.loadData()
33 }
34
35 removeVideoFromBlacklist (entry: BlacklistedVideo) {
36 const confirmMessage = 'Do you really want to remove this video from the blacklist ? It will be available again in the video list.'
37
38 this.confirmService.confirm(confirmMessage, 'Remove').subscribe(
39 res => {
40 if (res === false) return
41
42 this.blacklistService.removeVideoFromBlacklist(entry).subscribe(
43 status => {
44 this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`)
45 this.loadData()
46 },
47
48 err => this.notificationsService.error('Error', err.message)
49 )
50 }
51 )
52 }
53
54 protected loadData () {
55 this.blacklistService.getBlacklist(this.pagination, this.sort)
56 .subscribe(
57 resultList => {
58 this.blacklist = resultList.data
59 this.totalRecords = resultList.total
60 },
61
62 err => this.notificationsService.error('Error', err.message)
63 )
64 }
65}
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 @@
1export * from './blacklist-list.component'
diff --git a/client/src/app/+admin/blacklist/blacklist.component.ts b/client/src/app/+admin/blacklist/blacklist.component.ts
deleted file mode 100644
index ce8fe4298..000000000
--- a/client/src/app/+admin/blacklist/blacklist.component.ts
+++ /dev/null
@@ -1,8 +0,0 @@
1import { Component } from '@angular/core'
2
3@Component({
4 template: '<router-outlet></router-outlet>'
5})
6
7export class BlacklistComponent {
8}
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 @@
1import { Routes } from '@angular/router'
2
3import { BlacklistComponent } from './blacklist.component'
4import { BlacklistListComponent } from './blacklist-list'
5
6export 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 @@
1export * from './shared'
2export * from './blacklist-list'
3export * from './blacklist.component'
4export * 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 @@
1import { Injectable } from '@angular/core'
2import { HttpClient, HttpParams } from '@angular/common/http'
3import { Observable } from 'rxjs/Observable'
4import 'rxjs/add/operator/catch'
5import 'rxjs/add/operator/map'
6
7import { SortMeta } from 'primeng/components/common/sortmeta'
8
9import { RestExtractor, RestPagination, RestService } from '../../../shared'
10import { Utils } from '../../../shared'
11import { BlacklistedVideo, ResultList } from '../../../../../../shared'
12
13@Injectable()
14export 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 @@
1export * from './blacklist.service'