From 7a22a0a56aa75fbb1ba986a5d2c606e1343f30c2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 5 May 2021 12:10:00 +0200 Subject: Add ability to search live videos --- .../src/app/+search/search-filters.component.html | 27 ++++++++++++--- client/src/app/+search/search-filters.component.ts | 40 +++++++++++++--------- 2 files changed, 47 insertions(+), 20 deletions(-) (limited to 'client/src/app/+search') diff --git a/client/src/app/+search/search-filters.component.html b/client/src/app/+search/search-filters.component.html index 1d1e7b868..421bc7f6f 100644 --- a/client/src/app/+search/search-filters.component.html +++ b/client/src/app/+search/search-filters.component.html @@ -16,6 +16,25 @@ +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
@@ -44,7 +63,7 @@
- +
@@ -60,7 +79,7 @@
- +
diff --git a/client/src/app/+search/search-filters.component.ts b/client/src/app/+search/search-filters.component.ts index a2af9a942..59aba22ff 100644 --- a/client/src/app/+search/search-filters.component.ts +++ b/client/src/app/+search/search-filters.component.ts @@ -3,6 +3,8 @@ import { ServerService } from '@app/core' import { AdvancedSearch } from '@app/shared/shared-search' import { ServerConfig, VideoConstant } from '@shared/models' +type FormOption = { id: string, label: string } + @Component({ selector: 'my-search-filters', styleUrls: [ './search-filters.component.scss' ], @@ -17,9 +19,10 @@ export class SearchFiltersComponent implements OnInit { videoLicences: VideoConstant[] = [] videoLanguages: VideoConstant[] = [] - publishedDateRanges: { id: string, label: string }[] = [] - sorts: { id: string, label: string }[] = [] - durationRanges: { id: string, label: string }[] = [] + publishedDateRanges: FormOption[] = [] + sorts: FormOption[] = [] + durationRanges: FormOption[] = [] + videoType: FormOption[] = [] publishedDateRange: string durationRange: string @@ -33,10 +36,6 @@ export class SearchFiltersComponent implements OnInit { private serverService: ServerService ) { this.publishedDateRanges = [ - { - id: 'any_published_date', - label: $localize`Any` - }, { id: 'today', label: $localize`Today` @@ -55,11 +54,18 @@ export class SearchFiltersComponent implements OnInit { } ] - this.durationRanges = [ + this.videoType = [ { - id: 'any_duration', - label: $localize`Any` + id: 'vod', + label: $localize`VOD videos` }, + { + id: 'live', + label: $localize`Live videos` + } + ] + + this.durationRanges = [ { id: 'short', label: $localize`Short (< 4 min)` @@ -104,24 +110,26 @@ export class SearchFiltersComponent implements OnInit { this.loadOriginallyPublishedAtYears() } - inputUpdated () { + onInputUpdated () { this.updateModelFromDurationRange() this.updateModelFromPublishedRange() this.updateModelFromOriginallyPublishedAtYears() } formUpdated () { - this.inputUpdated() + this.onInputUpdated() this.filtered.emit(this.advancedSearch) } reset () { this.advancedSearch.reset() + + this.resetOriginalPublicationYears() + this.durationRange = undefined this.publishedDateRange = undefined - this.originallyPublishedStartYear = undefined - this.originallyPublishedEndYear = undefined - this.inputUpdated() + + this.onInputUpdated() } resetField (fieldName: string, value?: any) { @@ -130,7 +138,7 @@ export class SearchFiltersComponent implements OnInit { resetLocalField (fieldName: string, value?: any) { this[fieldName] = value - this.inputUpdated() + this.onInputUpdated() } resetOriginalPublicationYears () { -- cgit v1.2.3 From 0f01a8bacddf6c502e6470e34fdac7750bb76e89 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 14 May 2021 16:12:45 +0200 Subject: Remove ngx-meta Unmaintained --- client/src/app/+search/search-routing.module.ts | 4 ---- client/src/app/+search/search.component.ts | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'client/src/app/+search') diff --git a/client/src/app/+search/search-routing.module.ts b/client/src/app/+search/search-routing.module.ts index e5d7d1ede..0d778af0d 100644 --- a/client/src/app/+search/search-routing.module.ts +++ b/client/src/app/+search/search-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' -import { MetaGuard } from '@ngx-meta/core' import { ChannelLazyLoadResolver } from './channel-lazy-load.resolver' import { SearchComponent } from './search.component' import { VideoLazyLoadResolver } from './video-lazy-load.resolver' @@ -9,7 +8,6 @@ const searchRoutes: Routes = [ { path: '', component: SearchComponent, - canActivate: [ MetaGuard ], data: { meta: { title: $localize`Search` @@ -19,7 +17,6 @@ const searchRoutes: Routes = [ { path: 'lazy-load-video', component: SearchComponent, - canActivate: [ MetaGuard ], resolve: { data: VideoLazyLoadResolver } @@ -27,7 +24,6 @@ const searchRoutes: Routes = [ { path: 'lazy-load-channel', component: SearchComponent, - canActivate: [ MetaGuard ], resolve: { data: ChannelLazyLoadResolver } diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index ecede19a3..dcf654b7a 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts @@ -1,12 +1,11 @@ import { forkJoin, of, Subscription } from 'rxjs' import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { AuthService, ComponentPagination, HooksService, Notifier, ServerService, User, UserService } from '@app/core' +import { AuthService, ComponentPagination, HooksService, MetaService, Notifier, ServerService, User, UserService } from '@app/core' import { immutableAssign } from '@app/helpers' import { Video, VideoChannel } from '@app/shared/shared-main' import { AdvancedSearch, SearchService } from '@app/shared/shared-search' import { MiniatureDisplayOptions, VideoLinkType } from '@app/shared/shared-video-miniature' -import { MetaService } from '@ngx-meta/core' import { SearchTargetType, ServerConfig } from '@shared/models' @Component({ @@ -238,7 +237,10 @@ export class SearchComponent implements OnInit, OnDestroy { } private updateTitle () { - const suffix = this.currentSearch ? ' ' + this.currentSearch : '' + const suffix = this.currentSearch + ? ' ' + this.currentSearch + : '' + this.metaService.setTitle($localize`Search` + suffix) } -- cgit v1.2.3