diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:05:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:25:44 +0200 |
commit | 978c87e7f58b6673fe60f04f1767bc9e02ea4936 (patch) | |
tree | e7d48735d4099fec8c7732f33e7dadb09c0eac80 /client/src/app/shared | |
parent | 7e76cc380040e40a2292a9dc825f037c9b538030 (diff) | |
download | PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.gz PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.zst PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.zip |
Add channel filters for my videos/followers
Diffstat (limited to 'client/src/app/shared')
4 files changed, 54 insertions, 25 deletions
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 | ||