|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
|
|
|
|
import {Router} from '@angular/router';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { Subject } from 'rxjs/Subject';
|
|
|
|
|
import 'rxjs/add/operator/debounceTime';
|
|
|
|
|
import 'rxjs/add/operator/distinctUntilChanged';
|
|
|
|
@ -7,6 +7,7 @@ import 'rxjs/add/operator/map';
|
|
|
|
|
import "rxjs/add/operator/takeUntil";
|
|
|
|
|
|
|
|
|
|
import { SearchService } from '../services/search.service';
|
|
|
|
|
import { AuthService } from '../auth/auth.service';
|
|
|
|
|
import { RequestService } from '../services/request.service';
|
|
|
|
|
import { NotificationService } from '../services/notification.service';
|
|
|
|
|
|
|
|
|
@ -33,7 +34,8 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|
|
|
|
searchApplied = false;
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchService, private requestService: RequestService,
|
|
|
|
|
private notificationService: NotificationService, private route : Router) {
|
|
|
|
|
private notificationService: NotificationService, private route: Router, private authService: AuthService) {
|
|
|
|
|
|
|
|
|
|
this.searchChanged
|
|
|
|
|
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
|
|
|
|
.distinctUntilChanged() // only emit if value is different from previous value
|
|
|
|
@ -151,7 +153,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.searchService.getShowInformation(val.id)
|
|
|
|
|
.takeUntil(this.subscriptions)
|
|
|
|
|
.subscribe(x => {
|
|
|
|
|
this.updateItem(val,x);
|
|
|
|
|
this.updateItem(val, x);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
@ -159,6 +161,9 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
request(searchResult: ISearchTvResult) {
|
|
|
|
|
searchResult.requested = true;
|
|
|
|
|
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
|
|
|
|
searchResult.approved = true;
|
|
|
|
|
}
|
|
|
|
|
this.requestService.requestTv(searchResult)
|
|
|
|
|
.takeUntil(this.subscriptions)
|
|
|
|
|
.subscribe(x => {
|
|
|
|
|