diff options
Diffstat (limited to 'client/src/app')
9 files changed, 130 insertions, 49 deletions
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 3edcb1c63..7baf34ca2 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 | |||
@@ -28,12 +28,17 @@ export class VideoBlockListComponent extends RestTable implements OnInit { | |||
28 | 28 | ||
29 | inputFilters: AdvancedInputFilter[] = [ | 29 | inputFilters: AdvancedInputFilter[] = [ |
30 | { | 30 | { |
31 | queryParams: { search: 'type:auto' }, | 31 | title: $localize`Advanced filters`, |
32 | label: $localize`Automatic blocks` | 32 | children: [ |
33 | }, | 33 | { |
34 | { | 34 | queryParams: { search: 'type:auto' }, |
35 | queryParams: { search: 'type:manual' }, | 35 | label: $localize`Automatic blocks` |
36 | label: $localize`Manual blocks` | 36 | }, |
37 | { | ||
38 | queryParams: { search: 'type:manual' }, | ||
39 | label: $localize`Manual blocks` | ||
40 | } | ||
41 | ] | ||
37 | } | 42 | } |
38 | ] | 43 | ] |
39 | 44 | ||
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 c09ce7293..a60b228af 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 | |||
@@ -44,12 +44,17 @@ export class VideoCommentListComponent extends RestTable implements OnInit { | |||
44 | 44 | ||
45 | inputFilters: AdvancedInputFilter[] = [ | 45 | inputFilters: AdvancedInputFilter[] = [ |
46 | { | 46 | { |
47 | queryParams: { search: 'local:true' }, | 47 | title: $localize`Advanced filters`, |
48 | label: $localize`Local comments` | 48 | children: [ |
49 | }, | 49 | { |
50 | { | 50 | queryParams: { search: 'local:true' }, |
51 | queryParams: { search: 'local:false' }, | 51 | label: $localize`Local comments` |
52 | label: $localize`Remote comments` | 52 | }, |
53 | { | ||
54 | queryParams: { search: 'local:false' }, | ||
55 | label: $localize`Remote comments` | ||
56 | } | ||
57 | ] | ||
53 | } | 58 | } |
54 | ] | 59 | ] |
55 | 60 | ||
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 1030759df..548e6e80f 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 | |||
@@ -36,8 +36,13 @@ export class UserListComponent extends RestTable implements OnInit { | |||
36 | 36 | ||
37 | inputFilters: AdvancedInputFilter[] = [ | 37 | inputFilters: AdvancedInputFilter[] = [ |
38 | { | 38 | { |
39 | queryParams: { search: 'banned:true' }, | 39 | title: $localize`Advanced filters`, |
40 | label: $localize`Banned users` | 40 | children: [ |
41 | { | ||
42 | queryParams: { search: 'banned:true' }, | ||
43 | label: $localize`Banned users` | ||
44 | } | ||
45 | ] | ||
41 | } | 46 | } |
42 | ] | 47 | ] |
43 | 48 | ||
diff --git a/client/src/app/+my-library/my-follows/my-followers.component.ts b/client/src/app/+my-library/my-follows/my-followers.component.ts index 413d524df..4a72b983f 100644 --- a/client/src/app/+my-library/my-follows/my-followers.component.ts +++ b/client/src/app/+my-library/my-follows/my-followers.component.ts | |||
@@ -37,12 +37,19 @@ export class MyFollowersComponent implements OnInit { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | this.auth.userInformationLoaded.subscribe(() => { | 39 | this.auth.userInformationLoaded.subscribe(() => { |
40 | this.inputFilters = this.auth.getUser().videoChannels.map(c => { | 40 | const channelFilters = this.auth.getUser().videoChannels.map(c => { |
41 | return { | 41 | return { |
42 | queryParams: { search: 'channel:' + c.name }, | 42 | queryParams: { search: 'channel:' + c.name }, |
43 | label: $localize`Followers of ${c.name}` | 43 | label: c.name |
44 | } | 44 | } |
45 | }) | 45 | }) |
46 | |||
47 | this.inputFilters = [ | ||
48 | { | ||
49 | title: $localize`Channel filters`, | ||
50 | children: channelFilters | ||
51 | } | ||
52 | ] | ||
46 | }) | 53 | }) |
47 | } | 54 | } |
48 | 55 | ||
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts index b1f3baf80..a117d0915 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.ts +++ b/client/src/app/+my-library/my-videos/my-videos.component.ts | |||
@@ -9,7 +9,7 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms' | |||
9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
10 | import { LiveStreamInformationComponent } from '@app/shared/shared-video-live' | 10 | import { LiveStreamInformationComponent } from '@app/shared/shared-video-live' |
11 | import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' | 11 | import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' |
12 | import { VideoSortField } from '@shared/models' | 12 | import { VideoChannel, VideoSortField } from '@shared/models' |
13 | import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component' | 13 | import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component' |
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
@@ -47,16 +47,12 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
47 | 47 | ||
48 | user: User | 48 | user: User |
49 | 49 | ||
50 | inputFilters: AdvancedInputFilter[] = [ | 50 | inputFilters: AdvancedInputFilter[] |
51 | { | ||
52 | queryParams: { search: 'isLive:true' }, | ||
53 | label: $localize`Only live videos` | ||
54 | } | ||
55 | ] | ||
56 | 51 | ||
57 | disabled = false | 52 | disabled = false |
58 | 53 | ||
59 | private search: string | 54 | private search: string |
55 | private userChannels: VideoChannel[] = [] | ||
60 | 56 | ||
61 | constructor ( | 57 | constructor ( |
62 | protected router: Router, | 58 | protected router: Router, |
@@ -79,6 +75,35 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
79 | if (this.route.snapshot.queryParams['search']) { | 75 | if (this.route.snapshot.queryParams['search']) { |
80 | this.search = this.route.snapshot.queryParams['search'] | 76 | this.search = this.route.snapshot.queryParams['search'] |
81 | } | 77 | } |
78 | |||
79 | this.authService.userInformationLoaded.subscribe(() => { | ||
80 | this.user = this.authService.getUser() | ||
81 | this.userChannels = this.user.videoChannels | ||
82 | |||
83 | const channelFilters = this.userChannels.map(c => { | ||
84 | return { | ||
85 | queryParams: { search: 'channel:' + c.name }, | ||
86 | label: c.name | ||
87 | } | ||
88 | }) | ||
89 | |||
90 | this.inputFilters = [ | ||
91 | { | ||
92 | title: $localize`Advanced filters`, | ||
93 | children: [ | ||
94 | { | ||
95 | queryParams: { search: 'isLive:true' }, | ||
96 | label: $localize`Only live videos` | ||
97 | } | ||
98 | ] | ||
99 | }, | ||
100 | |||
101 | { | ||
102 | title: $localize`Channel filters`, | ||
103 | children: channelFilters | ||
104 | } | ||
105 | ] | ||
106 | }) | ||
82 | } | 107 | } |
83 | 108 | ||
84 | onSearch (search: string) { | 109 | onSearch (search: string) { |
@@ -105,7 +130,12 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
105 | getVideosObservable (page: number) { | 130 | getVideosObservable (page: number) { |
106 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 131 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
107 | 132 | ||
108 | return this.videoService.getMyVideos(newPagination, this.sort, this.search) | 133 | return this.videoService.getMyVideos({ |
134 | videoPagination: newPagination, | ||
135 | sort: this.sort, | ||
136 | userChannels: this.userChannels, | ||
137 | search: this.search | ||
138 | }) | ||
109 | .pipe( | 139 | .pipe( |
110 | tap(res => this.pagination.totalItems = res.total) | 140 | tap(res => this.pagination.totalItems = res.total) |
111 | ) | 141 | ) |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 33e9fd8de..297993e39 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -39,24 +39,29 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
39 | 39 | ||
40 | inputFilters: AdvancedInputFilter[] = [ | 40 | inputFilters: AdvancedInputFilter[] = [ |
41 | { | 41 | { |
42 | queryParams: { search: 'state:pending' }, | 42 | title: $localize`Advanced filters`, |
43 | label: $localize`Unsolved reports` | 43 | children: [ |
44 | }, | 44 | { |
45 | { | 45 | queryParams: { search: 'state:pending' }, |
46 | queryParams: { search: 'state:accepted' }, | 46 | label: $localize`Unsolved reports` |
47 | label: $localize`Accepted reports` | 47 | }, |
48 | }, | 48 | { |
49 | { | 49 | queryParams: { search: 'state:accepted' }, |
50 | queryParams: { search: 'state:rejected' }, | 50 | label: $localize`Accepted reports` |
51 | label: $localize`Refused reports` | 51 | }, |
52 | }, | 52 | { |
53 | { | 53 | queryParams: { search: 'state:rejected' }, |
54 | queryParams: { search: 'videoIs:blacklisted' }, | 54 | label: $localize`Refused reports` |
55 | label: $localize`Reports with blocked videos` | 55 | }, |
56 | }, | 56 | { |
57 | { | 57 | queryParams: { search: 'videoIs:blacklisted' }, |
58 | queryParams: { search: 'videoIs:deleted' }, | 58 | label: $localize`Reports with blocked videos` |
59 | label: $localize`Reports with deleted videos` | 59 | }, |
60 | { | ||
61 | queryParams: { search: 'videoIs:deleted' }, | ||
62 | label: $localize`Reports with deleted videos` | ||
63 | } | ||
64 | ] | ||
60 | } | 65 | } |
61 | ] | 66 | ] |
62 | 67 | ||
diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.html b/client/src/app/shared/shared-forms/advanced-input-filter.component.html index 10d1296cf..c662b9bb6 100644 --- a/client/src/app/shared/shared-forms/advanced-input-filter.component.html +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.html | |||
@@ -5,11 +5,13 @@ | |||
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <div role="menu" ngbDropdownMenu> | 7 | <div role="menu" ngbDropdownMenu> |
8 | <h6 class="dropdown-header" i18n>Advanced filters</h6> | 8 | <ng-container *ngFor="let group of filters"> |
9 | <h6 class="dropdown-header">{{ group.title }}</h6> | ||
9 | 10 | ||
10 | <a *ngFor="let filter of filters" [routerLink]="[ '.' ]" [queryParams]="filter.queryParams" class="dropdown-item"> | 11 | <a *ngFor="let filter of group.children" [routerLink]="[ '.' ]" [queryParams]="filter.queryParams" class="dropdown-item"> |
11 | {{ filter.label }} | 12 | {{ filter.label }} |
12 | </a> | 13 | </a> |
14 | </ng-container> | ||
13 | </div> | 15 | </div> |
14 | </div> | 16 | </div> |
15 | 17 | ||
diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts index 8315662b4..a12dddf7a 100644 --- a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts | |||
@@ -5,8 +5,12 @@ import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output } from '@ | |||
5 | import { ActivatedRoute, Params, Router } from '@angular/router' | 5 | import { ActivatedRoute, Params, Router } from '@angular/router' |
6 | 6 | ||
7 | export type AdvancedInputFilter = { | 7 | export type AdvancedInputFilter = { |
8 | label: string | 8 | title: string |
9 | queryParams: Params | 9 | |
10 | children: { | ||
11 | label: string | ||
12 | queryParams: Params | ||
13 | }[] | ||
10 | } | 14 | } |
11 | 15 | ||
12 | const logger = debug('peertube:AdvancedInputFilterComponent') | 16 | const logger = debug('peertube:AdvancedInputFilterComponent') |
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 2f43f1b9d..7935569e7 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -13,6 +13,7 @@ import { | |||
13 | UserVideoRateType, | 13 | UserVideoRateType, |
14 | UserVideoRateUpdate, | 14 | UserVideoRateUpdate, |
15 | Video as VideoServerModel, | 15 | Video as VideoServerModel, |
16 | VideoChannel as VideoChannelServerModel, | ||
16 | VideoConstant, | 17 | VideoConstant, |
17 | VideoDetails as VideoDetailsServerModel, | 18 | VideoDetails as VideoDetailsServerModel, |
18 | VideoFileMetadata, | 19 | VideoFileMetadata, |
@@ -122,7 +123,14 @@ export class VideoService { | |||
122 | .pipe(catchError(err => this.restExtractor.handleError(err))) | 123 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
123 | } | 124 | } |
124 | 125 | ||
125 | getMyVideos (videoPagination: ComponentPaginationLight, sort: VideoSortField, search?: string): Observable<ResultList<Video>> { | 126 | getMyVideos (options: { |
127 | videoPagination: ComponentPaginationLight | ||
128 | sort: VideoSortField | ||
129 | userChannels?: VideoChannelServerModel[] | ||
130 | search?: string | ||
131 | }): Observable<ResultList<Video>> { | ||
132 | const { videoPagination, sort, userChannels = [], search } = options | ||
133 | |||
126 | const pagination = this.restService.componentToRestPagination(videoPagination) | 134 | const pagination = this.restService.componentToRestPagination(videoPagination) |
127 | 135 | ||
128 | let params = new HttpParams() | 136 | let params = new HttpParams() |
@@ -133,6 +141,16 @@ export class VideoService { | |||
133 | isLive: { | 141 | isLive: { |
134 | prefix: 'isLive:', | 142 | prefix: 'isLive:', |
135 | isBoolean: true | 143 | isBoolean: true |
144 | }, | ||
145 | channelId: { | ||
146 | prefix: 'channel:', | ||
147 | handler: (name: string) => { | ||
148 | const channel = userChannels.find(c => c.name === name) | ||
149 | |||
150 | if (channel) return channel.id | ||
151 | |||
152 | return undefined | ||
153 | } | ||
136 | } | 154 | } |
137 | }) | 155 | }) |
138 | 156 | ||