diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-03 11:06:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-03 16:42:15 +0200 |
commit | 1fd61899eaea245a5844e33e21f04b2562f16e5e (patch) | |
tree | 2a1d51b37b12219cade35e189d62686cd0fec105 /client/src/app/+admin | |
parent | dfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff) | |
download | PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip |
Add ability to filter my videos by live
Diffstat (limited to 'client/src/app/+admin')
8 files changed, 48 insertions, 100 deletions
diff --git a/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html b/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html index 9a6c124e1..a9e0931f8 100644 --- a/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html +++ b/client/src/app/+admin/moderation/abuse-list/abuse-list.component.html | |||
@@ -3,4 +3,4 @@ | |||
3 | <ng-container i18n>Reports</ng-container> | 3 | <ng-container i18n>Reports</ng-container> |
4 | </h1> | 4 | </h1> |
5 | 5 | ||
6 | <my-abuse-list-table viewType="admin" baseRoute="/admin/moderation/abuses/list"></my-abuse-list-table> | 6 | <my-abuse-list-table viewType="admin"></my-abuse-list-table> |
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html index c7275de1b..cf2466bdb 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html | |||
@@ -13,25 +13,7 @@ | |||
13 | <ng-template pTemplate="caption"> | 13 | <ng-template pTemplate="caption"> |
14 | <div class="caption"> | 14 | <div class="caption"> |
15 | <div class="ml-auto"> | 15 | <div class="ml-auto"> |
16 | <div class="input-group has-feedback has-clear"> | 16 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)" (resetTableFilter)="resetTableFilter()"></my-advanced-input-filter> |
17 | <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body"> | ||
18 | <div class="input-group-text" ngbDropdownToggle> | ||
19 | <span class="caret" aria-haspopup="menu" role="button"></span> | ||
20 | </div> | ||
21 | |||
22 | <div role="menu" ngbDropdownMenu> | ||
23 | <h6 class="dropdown-header" i18n>Advanced block filters</h6> | ||
24 | <a [routerLink]="[ '/admin/moderation/video-blocks/list' ]" [queryParams]="{ 'search': 'type:auto' }" class="dropdown-item" i18n>Automatic blocks</a> | ||
25 | <a [routerLink]="[ '/admin/moderation/video-blocks/list' ]" [queryParams]="{ 'search': 'type:manual' }" class="dropdown-item" i18n>Manual blocks</a> | ||
26 | </div> | ||
27 | </div> | ||
28 | <input | ||
29 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | ||
30 | (keyup)="onSearch($event)" | ||
31 | > | ||
32 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> | ||
33 | <span class="sr-only" i18n>Clear filters</span> | ||
34 | </div> | ||
35 | </div> | 17 | </div> |
36 | </div> | 18 | </div> |
37 | </ng-template> | 19 | </ng-template> |
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index d6aca10e7..dfd8dc745 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -6,6 +6,7 @@ import { AfterViewInit, Component, OnInit } from '@angular/core' | |||
6 | import { DomSanitizer } from '@angular/platform-browser' | 6 | import { DomSanitizer } from '@angular/platform-browser' |
7 | import { ActivatedRoute, Params, Router } from '@angular/router' | 7 | import { ActivatedRoute, Params, Router } from '@angular/router' |
8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
9 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | ||
9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 10 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
10 | import { VideoBlockService } from '@app/shared/shared-moderation' | 11 | import { VideoBlockService } from '@app/shared/shared-moderation' |
11 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' | 12 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' |
@@ -24,6 +25,17 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
24 | 25 | ||
25 | videoBlocklistActions: DropdownAction<VideoBlacklist>[][] = [] | 26 | videoBlocklistActions: DropdownAction<VideoBlacklist>[][] = [] |
26 | 27 | ||
28 | inputFilters: AdvancedInputFilter[] = [ | ||
29 | { | ||
30 | queryParams: { 'search': 'type:auto' }, | ||
31 | label: $localize`Automatic blocks` | ||
32 | }, | ||
33 | { | ||
34 | queryParams: { 'search': 'type:manual' }, | ||
35 | label: $localize`Manual blocks` | ||
36 | } | ||
37 | ] | ||
38 | |||
27 | constructor ( | 39 | constructor ( |
28 | protected route: ActivatedRoute, | 40 | protected route: ActivatedRoute, |
29 | protected router: Router, | 41 | protected router: Router, |
@@ -111,25 +123,6 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
111 | if (this.search) this.setTableFilter(this.search, false) | 123 | if (this.search) this.setTableFilter(this.search, false) |
112 | } | 124 | } |
113 | 125 | ||
114 | /* Table filter functions */ | ||
115 | onBlockSearch (event: Event) { | ||
116 | this.onSearch(event) | ||
117 | this.setQueryParams((event.target as HTMLInputElement).value) | ||
118 | } | ||
119 | |||
120 | setQueryParams (search: string) { | ||
121 | const queryParams: Params = {} | ||
122 | if (search) Object.assign(queryParams, { search }) | ||
123 | this.router.navigate([ '/admin/moderation/video-blocks/list' ], { queryParams }) | ||
124 | } | ||
125 | |||
126 | resetTableFilter () { | ||
127 | this.setTableFilter('') | ||
128 | this.setQueryParams('') | ||
129 | this.resetSearch() | ||
130 | } | ||
131 | /* END Table filter functions */ | ||
132 | |||
133 | getIdentifier () { | 126 | getIdentifier () { |
134 | return 'VideoBlockListComponent' | 127 | return 'VideoBlockListComponent' |
135 | } | 128 | } |
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html index b6cec9c51..5cc0ff137 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html | |||
@@ -26,25 +26,7 @@ | |||
26 | </div> | 26 | </div> |
27 | 27 | ||
28 | <div class="ml-auto"> | 28 | <div class="ml-auto"> |
29 | <div class="input-group has-feedback has-clear"> | 29 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)" (resetTableFilter)="resetTableFilter()"></my-advanced-input-filter> |
30 | <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body"> | ||
31 | <div class="input-group-text" ngbDropdownToggle> | ||
32 | <span class="caret" aria-haspopup="menu" role="button"></span> | ||
33 | </div> | ||
34 | |||
35 | <div role="menu" ngbDropdownMenu> | ||
36 | <h6 class="dropdown-header" i18n>Advanced comments filters</h6> | ||
37 | <a [routerLink]="[ '/admin/moderation/video-comments/list' ]" [queryParams]="{ 'search': 'local:true' }" class="dropdown-item" i18n>Local comments</a> | ||
38 | <a [routerLink]="[ '/admin/moderation/video-comments/list' ]" [queryParams]="{ 'search': 'local:false' }" class="dropdown-item" i18n>Remote comments</a> | ||
39 | </div> | ||
40 | </div> | ||
41 | <input | ||
42 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | ||
43 | (keyup)="onSearch($event)" | ||
44 | > | ||
45 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> | ||
46 | <span class="sr-only" i18n>Clear filters</span> | ||
47 | </div> | ||
48 | </div> | 30 | </div> |
49 | </div> | 31 | </div> |
50 | </ng-template> | 32 | </ng-template> |
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts index 63493d00d..ebbbddb43 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts | |||
@@ -2,6 +2,7 @@ import { SortMeta } from 'primeng/api' | |||
2 | import { AfterViewInit, Component, OnInit } from '@angular/core' | 2 | import { AfterViewInit, Component, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' | 4 | import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' |
5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | ||
5 | import { DropdownAction } from '@app/shared/shared-main' | 6 | import { DropdownAction } from '@app/shared/shared-main' |
6 | import { BulkService } from '@app/shared/shared-moderation' | 7 | import { BulkService } from '@app/shared/shared-moderation' |
7 | import { VideoCommentAdmin, VideoCommentService } from '@app/shared/shared-video-comment' | 8 | import { VideoCommentAdmin, VideoCommentService } from '@app/shared/shared-video-comment' |
@@ -43,6 +44,17 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte | |||
43 | selectedComments: VideoCommentAdmin[] = [] | 44 | selectedComments: VideoCommentAdmin[] = [] |
44 | bulkCommentActions: DropdownAction<VideoCommentAdmin[]>[] = [] | 45 | bulkCommentActions: DropdownAction<VideoCommentAdmin[]>[] = [] |
45 | 46 | ||
47 | inputFilters: AdvancedInputFilter[] = [ | ||
48 | { | ||
49 | queryParams: { 'search': 'local:true' }, | ||
50 | label: $localize`Local comments` | ||
51 | }, | ||
52 | { | ||
53 | queryParams: { 'search': 'local:false' }, | ||
54 | label: $localize`Remote comments` | ||
55 | } | ||
56 | ] | ||
57 | |||
46 | get authUser () { | 58 | get authUser () { |
47 | return this.auth.getUser() | 59 | return this.auth.getUser() |
48 | } | 60 | } |
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 f84d3fd0c..7170d7019 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 | |||
@@ -22,24 +22,7 @@ | |||
22 | </div> | 22 | </div> |
23 | 23 | ||
24 | <div class="ml-auto"> | 24 | <div class="ml-auto"> |
25 | <div class="input-group has-feedback has-clear"> | 25 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)" (resetTableFilter)="resetTableFilter()"></my-advanced-input-filter> |
26 | <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body"> | ||
27 | <div class="input-group-text" ngbDropdownToggle> | ||
28 | <span class="caret" aria-haspopup="menu" role="button"></span> | ||
29 | </div> | ||
30 | |||
31 | <div role="menu" ngbDropdownMenu> | ||
32 | <h6 class="dropdown-header" i18n>Advanced user filters</h6> | ||
33 | <a [routerLink]="[ '/admin/users/list' ]" [queryParams]="{ 'search': 'banned:true' }" class="dropdown-item" i18n>Banned users</a> | ||
34 | </div> | ||
35 | </div> | ||
36 | <input | ||
37 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | ||
38 | (keyup)="onSearch($event)" | ||
39 | > | ||
40 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> | ||
41 | <span class="sr-only" i18n>Clear filters</span> | ||
42 | </div> | ||
43 | </div> | 26 | </div> |
44 | 27 | ||
45 | </div> | 28 | </div> |
diff --git a/client/src/app/+admin/users/user-list/user-list.component.scss b/client/src/app/+admin/users/user-list/user-list.component.scss index f18747ec3..db4979a51 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.scss +++ b/client/src/app/+admin/users/user-list/user-list.component.scss | |||
@@ -11,6 +11,7 @@ tr.banned > td { | |||
11 | 11 | ||
12 | .table-email { | 12 | .table-email { |
13 | @include disable-default-a-behaviour; | 13 | @include disable-default-a-behaviour; |
14 | |||
14 | color: pvar(--mainForegroundColor); | 15 | color: pvar(--mainForegroundColor); |
15 | } | 16 | } |
16 | 17 | ||
@@ -28,14 +29,6 @@ tr.banned > td { | |||
28 | margin-left: 0.1rem; | 29 | margin-left: 0.1rem; |
29 | } | 30 | } |
30 | 31 | ||
31 | .caption { | ||
32 | justify-content: space-between; | ||
33 | |||
34 | input { | ||
35 | @include peertube-input-text(250px); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | p-tableCheckbox { | 32 | p-tableCheckbox { |
40 | position: relative; | 33 | position: relative; |
41 | top: -2.5px; | 34 | top: -2.5px; |
@@ -55,18 +48,7 @@ my-global-icon { | |||
55 | 48 | ||
56 | .progress { | 49 | .progress { |
57 | @include progressbar($small: true); | 50 | @include progressbar($small: true); |
51 | |||
58 | width: auto; | 52 | width: auto; |
59 | max-width: 100%; | 53 | max-width: 100%; |
60 | } | 54 | } |
61 | |||
62 | .input-group { | ||
63 | @include peertube-input-group(300px); | ||
64 | |||
65 | input { | ||
66 | flex: 1; | ||
67 | } | ||
68 | |||
69 | .dropdown-toggle::after { | ||
70 | margin-left: 0; | ||
71 | } | ||
72 | } | ||
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 339e18206..435bc17d7 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 2 | import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, Params, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' | 4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' |
5 | import { Account, DropdownAction } from '@app/shared/shared-main' | 5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
6 | import { DropdownAction } from '@app/shared/shared-main' | ||
6 | import { UserBanModalComponent } from '@app/shared/shared-moderation' | 7 | import { UserBanModalComponent } from '@app/shared/shared-moderation' |
7 | import { ServerConfig, User, UserRole } from '@shared/models' | 8 | import { ServerConfig, User, UserRole } from '@shared/models' |
8 | 9 | ||
@@ -18,19 +19,28 @@ type UserForList = User & { | |||
18 | templateUrl: './user-list.component.html', | 19 | templateUrl: './user-list.component.html', |
19 | styleUrls: [ './user-list.component.scss' ] | 20 | styleUrls: [ './user-list.component.scss' ] |
20 | }) | 21 | }) |
21 | export class UserListComponent extends RestTable implements OnInit { | 22 | export class UserListComponent extends RestTable implements OnInit, AfterViewInit { |
22 | @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent | 23 | @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent |
23 | 24 | ||
24 | users: User[] = [] | 25 | users: User[] = [] |
26 | |||
25 | totalRecords = 0 | 27 | totalRecords = 0 |
26 | sort: SortMeta = { field: 'createdAt', order: 1 } | 28 | sort: SortMeta = { field: 'createdAt', order: 1 } |
27 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 29 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
30 | |||
28 | highlightBannedUsers = false | 31 | highlightBannedUsers = false |
29 | 32 | ||
30 | selectedUsers: User[] = [] | 33 | selectedUsers: User[] = [] |
31 | bulkUserActions: DropdownAction<User[]>[][] = [] | 34 | bulkUserActions: DropdownAction<User[]>[][] = [] |
32 | columns: { id: string, label: string }[] | 35 | columns: { id: string, label: string }[] |
33 | 36 | ||
37 | inputFilters: AdvancedInputFilter[] = [ | ||
38 | { | ||
39 | queryParams: { 'search': 'banned:true' }, | ||
40 | label: $localize`Banned users` | ||
41 | } | ||
42 | ] | ||
43 | |||
34 | private _selectedColumns: string[] | 44 | private _selectedColumns: string[] |
35 | private serverConfig: ServerConfig | 45 | private serverConfig: ServerConfig |
36 | 46 | ||
@@ -117,6 +127,10 @@ export class UserListComponent extends RestTable implements OnInit { | |||
117 | this.columns.push({ id: 'lastLoginDate', label: 'Last login' }) | 127 | this.columns.push({ id: 'lastLoginDate', label: 'Last login' }) |
118 | } | 128 | } |
119 | 129 | ||
130 | ngAfterViewInit () { | ||
131 | if (this.search) this.setTableFilter(this.search, false) | ||
132 | } | ||
133 | |||
120 | getIdentifier () { | 134 | getIdentifier () { |
121 | return 'UserListComponent' | 135 | return 'UserListComponent' |
122 | } | 136 | } |