diff --git a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html index 85ffd4064..1ad5d445a 100644 --- a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html +++ b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html @@ -1,94 +1,55 @@ 
-
- The Movie Database -
-
-
- - Show Adult Movies +Upgraded
+ The Movie Database +
+
+
+ + Show Adult Movies +
+
+ +
+
+ + + + + + {{option.name}} + + + + + + + {{key.name}} + cancel + + + +
+
+ +
+
+ +
+
- -
- -
- - - - -
- - - - - {{option.name}} - - - - -
- -
- -
-
-
-
-
-
-
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts index 892ff6755..228d4fc42 100644 --- a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts @@ -1,15 +1,13 @@ import {COMMA, ENTER} from "@angular/cdk/keycodes"; import { Component, OnInit, ElementRef, ViewChild } from "@angular/core"; -import { MatChipInputEvent } from "@angular/material/chips"; -import { MatAutocompleteSelectedEvent, MatAutocomplete } from "@angular/material/autocomplete"; -import { empty, of, Observable } from "rxjs"; +import { MatAutocomplete } from "@angular/material/autocomplete"; import { ITheMovieDbSettings, IMovieDbKeyword } from "../../interfaces"; import { NotificationService } from "../../services"; import { SettingsService } from "../../services"; import { TheMovieDbService } from "../../services"; -import { FormControl, FormBuilder, FormGroup } from "@angular/forms"; -import { startWith, map, debounceTime, tap, switchMap, finalize } from "rxjs/operators"; +import { FormBuilder, FormGroup } from "@angular/forms"; +import { debounceTime, switchMap } from "rxjs/operators"; interface IKeywordTag { id: number; @@ -28,9 +26,6 @@ export class TheMovieDbComponent implements OnInit { public tagForm: FormGroup; public filteredTags: IMovieDbKeyword[]; @ViewChild('fruitInput') public fruitInput: ElementRef; - @ViewChild('auto') public matAutocomplete: MatAutocomplete; - - private readonly separatorKeysCodes: number[] = [ENTER, COMMA]; constructor(private settingsService: SettingsService, private notificationService: NotificationService, @@ -50,6 +45,13 @@ export class TheMovieDbComponent implements OnInit { initial: true, })) : []; + this.excludedKeywords.forEach(key => { + this.tmdbService.getKeyword(key.id).subscribe(keyResult => { + this.excludedKeywords.filter((val, idx) => { + val.name = keyResult.name; + }) + }); + }); }); this.tagForm @@ -64,61 +66,8 @@ export class TheMovieDbComponent implements OnInit { ) .subscribe((r) => (this.filteredTags = r)); - // this.tagForm.controls.input.valueChanges - // .pipe( - // debounceTime(500), - // switchMap(value => this.tmdbService.getKeywords(value)) - // ) - // .subscribe((data: IMovieDbKeyword[]) => { - // this.filteredTags = data; - // }); } - public async selected(event: MatAutocompleteSelectedEvent) { - const keywordId = await this.tmdbService.getKeyword(+event.option.value).toPromise(); - this.excludedKeywords.push({ id: keywordId.id, name: keywordId.name, initial: false}); - this.fruitInput.nativeElement.value = ''; - this.tagForm.controls.input.setValue(null); - } - - public autocompleteKeyword = (text: string) => this.tmdbService.getKeywords(text); - - public onAddingKeyword = (tag: string | IKeywordTag) => { - if (typeof tag === "string") { - const id = Number(tag); - return isNaN(id) ? empty() : this.tmdbService.getKeyword(id); - } else { - return of(tag); - } - } - - public onKeywordSelect = (keyword: IKeywordTag) => { - if (keyword.initial) { - this.tmdbService.getKeyword(keyword.id) - .subscribe(k => { - keyword.name = k.name; - keyword.initial = false; - }); - } - } - - public async add(event: MatChipInputEvent) { - const input = event.input; - const value = event.value; - - // Add our fruit - if ((value || '').trim()) { - const keyword = await this.tmdbService.getKeywords(value).toPromise(); - this.excludedKeywords.push({ id: keyword[0].id, name: keyword[0].name, initial: false }); - } - - // Reset the input value - if (input) { - input.value = ''; - } - this.tagForm.controls.input.setValue(null); - } - public remove(tag: IKeywordTag): void { const index = this.excludedKeywords.indexOf(tag);