diff options
author | Green-Star <Green-Star@users.noreply.github.com> | 2017-09-22 09:13:43 +0200 |
---|---|---|
committer | Bigard Florian <florian.bigard@gmail.com> | 2017-09-22 09:13:43 +0200 |
commit | 792dbaf07f83fbe3f1d209cd9edf190442c7d2f3 (patch) | |
tree | f7edf9caf17baaaf95c219c3ac73d598e3fd3df8 /client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts | |
parent | c9d6d155c397d0da0cb2d50064264fc1716f0501 (diff) | |
download | PeerTube-792dbaf07f83fbe3f1d209cd9edf190442c7d2f3.tar.gz PeerTube-792dbaf07f83fbe3f1d209cd9edf190442c7d2f3.tar.zst PeerTube-792dbaf07f83fbe3f1d209cd9edf190442c7d2f3.zip |
Handle blacklist (#84)
* Client: Add list blacklist feature
* Server: Add list blacklist feature
* Client: Add videoId column
* Server: Add some video infos in the REST api
* Client: Add video information in the blacklist list
* Fix sortable columns :)
* Client: Add removeFromBlacklist feature
* Server: Add removeFromBlacklist feature
* Move to TypeScript
* Move to TypeScript and Promises
* Server: Fix blacklist list sort
* Server: Fetch videos informations
* Use common shared interface for client and server
* Add check-params remove blacklisted video tests
* Add check-params list blacklisted videos tests
* Add list blacklist tests
* Add remove from blacklist tests
* Add video blacklist management tests
* Fix rebase onto develop issues
* Server: Add sort on blacklist id column
* Server: Add blacklists library
* Add blacklist id sort test
* Add check-params tests for blacklist list pagination, count and sort
* Fix coding style
* Increase Remote API tests timeout
* Increase Request scheduler API tests timeout
* Fix typo
* Increase video transcoding API tests timeout
* Move tests to Typescript
* Use lodash orderBy method
* Fix typos
* Client: Remove optional tests in blacklist model attributes
* Move blacklist routes from 'blacklists' to 'blacklist'
* CLient: Remove blacklist-list.component.scss
* Rename 'blacklists' files to 'blacklist'
* Use only BlacklistedVideo interface
* Server: Use getFormattedObjects method in listBlacklist method
* Client: Use new coding style
* Server: Use new sort validator methods
* Server: Use new checkParams methods
* Client: Fix sortable columns
Diffstat (limited to 'client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts')
-rw-r--r-- | client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts | 65 |
1 files changed, 65 insertions, 0 deletions
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 new file mode 100644 index 000000000..b308054ed --- /dev/null +++ b/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts | |||
@@ -0,0 +1,65 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { SortMeta } from 'primeng/components/common/sortmeta' | ||
3 | |||
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | |||
6 | import { ConfirmService } from '../../../core' | ||
7 | import { RestTable, RestPagination } from '../../../shared' | ||
8 | import { BlacklistService } from '../shared' | ||
9 | import { BlacklistedVideo } from '../../../../../../shared' | ||
10 | |||
11 | @Component({ | ||
12 | selector: 'my-blacklist-list', | ||
13 | templateUrl: './blacklist-list.component.html', | ||
14 | styleUrls: [] | ||
15 | }) | ||
16 | export 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 | } | ||