diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:36:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:36:16 +0100 |
commit | ab998f7b6dffbe461d830d3696cb46491ad6afb0 (patch) | |
tree | f819e4049ca62b5389fd31ebfcbcb6ffbe0eaf0b /client/src/app/+admin/video-blacklist | |
parent | 621d99f53f47a11919ec243e05273ecf5907b444 (diff) | |
download | PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.tar.gz PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.tar.zst PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.zip |
Improve admin tables
Diffstat (limited to 'client/src/app/+admin/video-blacklist')
2 files changed, 38 insertions, 26 deletions
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html index 942f7c9f1..ac30cec39 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html | |||
@@ -1,23 +1,35 @@ | |||
1 | <div class="row"> | 1 | <div class="admin-sub-header"> |
2 | <div class="content-padding"> | 2 | <div class="admin-sub-title">Blacklisted videos</div> |
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="views" header="Views" [sortable]="true"></p-column> | ||
13 | <p-column field="nsfw" header="NSFW"></p-column> | ||
14 | <p-column field="uuid" header="UUID" [sortable]="true"></p-column> | ||
15 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> | ||
16 | <p-column header="Delete" styleClass="action-cell"> | ||
17 | <ng-template pTemplate="body" let-entry="rowData"> | ||
18 | <my-delete-button (click)="removeVideoFromBlacklist(entry)"></my-delete-button> | ||
19 | </ng-template> | ||
20 | </p-column> | ||
21 | </p-dataTable> | ||
22 | </div> | ||
23 | </div> | 3 | </div> |
4 | |||
5 | <p-table | ||
6 | [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" | ||
7 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" | ||
8 | > | ||
9 | <ng-template pTemplate="header"> | ||
10 | <tr> | ||
11 | <th pSortableColumn="name">Name <p-sortIcon field="name"></p-sortIcon></th> | ||
12 | <th>Description</th> | ||
13 | <th pSortableColumn="views">Views <p-sortIcon field="views"></p-sortIcon></th> | ||
14 | <th>NSFW</th> | ||
15 | <th>UUID</th> | ||
16 | <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> | ||
17 | <th></th> | ||
18 | </tr> | ||
19 | </ng-template> | ||
20 | |||
21 | <ng-template pTemplate="body" let-videoBlacklist> | ||
22 | <tr> | ||
23 | <td>{{ videoBlacklist.name }}</td> | ||
24 | <td>{{ videoBlacklist.description }}</td> | ||
25 | <td>{{ videoBlacklist.views }}</td> | ||
26 | <td>{{ videoBlacklist.nsfw }}</td> | ||
27 | <td>{{ videoBlacklist.uuid }}</td> | ||
28 | <td>{{ videoBlacklist.createdAt }}</td> | ||
29 | <td class="action-cell"> | ||
30 | <my-delete-button label="Unblacklist" (click)="removeVideoFromBlacklist(videoBlacklist)"></my-delete-button> | ||
31 | </td> | ||
32 | </tr> | ||
33 | </ng-template> | ||
34 | </p-table> | ||
35 | |||
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts index f4cf21259..7210e677c 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts | |||
@@ -16,7 +16,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
16 | blacklist: BlacklistedVideo[] = [] | 16 | blacklist: BlacklistedVideo[] = [] |
17 | totalRecords = 0 | 17 | totalRecords = 0 |
18 | rowsPerPage = 10 | 18 | rowsPerPage = 10 |
19 | sort: SortMeta = { field: 'id', order: 1 } | 19 | sort: SortMeta = { field: 'createdAt', order: 1 } |
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
21 | 21 | ||
22 | constructor ( | 22 | constructor ( |
@@ -28,13 +28,13 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
28 | } | 28 | } |
29 | 29 | ||
30 | ngOnInit () { | 30 | ngOnInit () { |
31 | this.loadData() | 31 | this.loadSort() |
32 | } | 32 | } |
33 | 33 | ||
34 | async removeVideoFromBlacklist (entry: BlacklistedVideo) { | 34 | async removeVideoFromBlacklist (entry: BlacklistedVideo) { |
35 | const confirmMessage = 'Do you really want to remove this video from the blacklist ? It will be available again in the video list.' | 35 | const confirmMessage = 'Do you really want to remove this video from the blacklist ? It will be available again in the videos list.' |
36 | 36 | ||
37 | const res = await this.confirmService.confirm(confirmMessage, 'Remove') | 37 | const res = await this.confirmService.confirm(confirmMessage, 'Unblacklist') |
38 | if (res === false) return | 38 | if (res === false) return |
39 | 39 | ||
40 | this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( | 40 | this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( |