From 978c87e7f58b6673fe60f04f1767bc9e02ea4936 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Oct 2021 09:05:43 +0200 Subject: Add channel filters for my videos/followers --- .../abuse-list-table.component.ts | 41 ++++++++++++---------- .../advanced-input-filter.component.html | 10 +++--- .../advanced-input-filter.component.ts | 8 +++-- .../app/shared/shared-main/video/video.service.ts | 20 ++++++++++- 4 files changed, 54 insertions(+), 25 deletions(-) (limited to 'client/src/app/shared') 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 { inputFilters: AdvancedInputFilter[] = [ { - queryParams: { search: 'state:pending' }, - label: $localize`Unsolved reports` - }, - { - queryParams: { search: 'state:accepted' }, - label: $localize`Accepted reports` - }, - { - queryParams: { search: 'state:rejected' }, - label: $localize`Refused reports` - }, - { - queryParams: { search: 'videoIs:blacklisted' }, - label: $localize`Reports with blocked videos` - }, - { - queryParams: { search: 'videoIs:deleted' }, - label: $localize`Reports with deleted videos` + title: $localize`Advanced filters`, + children: [ + { + queryParams: { search: 'state:pending' }, + label: $localize`Unsolved reports` + }, + { + queryParams: { search: 'state:accepted' }, + label: $localize`Accepted reports` + }, + { + queryParams: { search: 'state:rejected' }, + label: $localize`Refused reports` + }, + { + queryParams: { search: 'videoIs:blacklisted' }, + label: $localize`Reports with blocked videos` + }, + { + queryParams: { search: 'videoIs:deleted' }, + label: $localize`Reports with deleted videos` + } + ] } ] 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 @@
- + + - - {{ filter.label }} - + + {{ filter.label }} + +
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 '@ import { ActivatedRoute, Params, Router } from '@angular/router' export type AdvancedInputFilter = { - label: string - queryParams: Params + title: string + + children: { + label: string + queryParams: Params + }[] } 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 { UserVideoRateType, UserVideoRateUpdate, Video as VideoServerModel, + VideoChannel as VideoChannelServerModel, VideoConstant, VideoDetails as VideoDetailsServerModel, VideoFileMetadata, @@ -122,7 +123,14 @@ export class VideoService { .pipe(catchError(err => this.restExtractor.handleError(err))) } - getMyVideos (videoPagination: ComponentPaginationLight, sort: VideoSortField, search?: string): Observable> { + getMyVideos (options: { + videoPagination: ComponentPaginationLight + sort: VideoSortField + userChannels?: VideoChannelServerModel[] + search?: string + }): Observable> { + const { videoPagination, sort, userChannels = [], search } = options + const pagination = this.restService.componentToRestPagination(videoPagination) let params = new HttpParams() @@ -133,6 +141,16 @@ export class VideoService { isLive: { prefix: 'isLive:', isBoolean: true + }, + channelId: { + prefix: 'channel:', + handler: (name: string) => { + const channel = userChannels.find(c => c.name === name) + + if (channel) return channel.id + + return undefined + } } }) -- cgit v1.2.3