X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bsearch%2Fsearch-filters.component.ts;h=f9de04706218d7106440e81a0d9d78e308fe56e9;hb=4e4c23c5b8d55ab0aa48a7be8c53ec71d1d7e796;hp=59aba22ff8b6a13239ad02ae2ad5ccf9647adbb0;hpb=7a22a0a56aa75fbb1ba986a5d2c606e1343f30c2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+search/search-filters.component.ts b/client/src/app/+search/search-filters.component.ts index 59aba22ff..f9de04706 100644 --- a/client/src/app/+search/search-filters.component.ts +++ b/client/src/app/+search/search-filters.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { ServerService } from '@app/core' import { AdvancedSearch } from '@app/shared/shared-search' -import { ServerConfig, VideoConstant } from '@shared/models' +import { HTMLServerConfig, VideoConstant } from '@shared/models' type FormOption = { id: string, label: string } @@ -22,7 +22,6 @@ export class SearchFiltersComponent implements OnInit { publishedDateRanges: FormOption[] = [] sorts: FormOption[] = [] durationRanges: FormOption[] = [] - videoType: FormOption[] = [] publishedDateRange: string durationRange: string @@ -30,7 +29,7 @@ export class SearchFiltersComponent implements OnInit { originallyPublishedStartYear: string originallyPublishedEndYear: string - private serverConfig: ServerConfig + private serverConfig: HTMLServerConfig constructor ( private serverService: ServerService @@ -54,17 +53,6 @@ export class SearchFiltersComponent implements OnInit { } ] - this.videoType = [ - { - id: 'vod', - label: $localize`VOD videos` - }, - { - id: 'live', - label: $localize`Live videos` - } - ] - this.durationRanges = [ { id: 'short', @@ -97,9 +85,7 @@ export class SearchFiltersComponent implements OnInit { } ngOnInit () { - this.serverConfig = this.serverService.getTmpConfig() - this.serverService.getConfig() - .subscribe(config => this.serverConfig = config) + this.serverConfig = this.serverService.getHTMLConfig() this.serverService.getVideoCategories().subscribe(categories => this.videoCategories = categories) this.serverService.getVideoLicences().subscribe(licences => this.videoLicences = licences) @@ -110,14 +96,14 @@ export class SearchFiltersComponent implements OnInit { this.loadOriginallyPublishedAtYears() } - onInputUpdated () { + onDurationOrPublishedUpdated () { this.updateModelFromDurationRange() this.updateModelFromPublishedRange() this.updateModelFromOriginallyPublishedAtYears() } formUpdated () { - this.onInputUpdated() + this.onDurationOrPublishedUpdated() this.filtered.emit(this.advancedSearch) } @@ -129,7 +115,7 @@ export class SearchFiltersComponent implements OnInit { this.durationRange = undefined this.publishedDateRange = undefined - this.onInputUpdated() + this.onDurationOrPublishedUpdated() } resetField (fieldName: string, value?: any) { @@ -138,7 +124,7 @@ export class SearchFiltersComponent implements OnInit { resetLocalField (fieldName: string, value?: any) { this[fieldName] = value - this.onInputUpdated() + this.onDurationOrPublishedUpdated() } resetOriginalPublicationYears () { @@ -152,11 +138,11 @@ export class SearchFiltersComponent implements OnInit { private loadOriginallyPublishedAtYears () { this.originallyPublishedStartYear = this.advancedSearch.originallyPublishedStartDate ? new Date(this.advancedSearch.originallyPublishedStartDate).getFullYear().toString() - : null + : undefined this.originallyPublishedEndYear = this.advancedSearch.originallyPublishedEndDate ? new Date(this.advancedSearch.originallyPublishedEndDate).getFullYear().toString() - : null + : undefined } private loadFromDurationRange () { @@ -203,7 +189,7 @@ export class SearchFiltersComponent implements OnInit { this.advancedSearch.originallyPublishedStartDate = start.toISOString() } else { - this.advancedSearch.originallyPublishedStartDate = null + this.advancedSearch.originallyPublishedStartDate = undefined } if (this.originallyPublishedEndYear) { @@ -213,7 +199,7 @@ export class SearchFiltersComponent implements OnInit { this.advancedSearch.originallyPublishedEndDate = end.toISOString() } else { - this.advancedSearch.originallyPublishedEndDate = null + this.advancedSearch.originallyPublishedEndDate = undefined } }