Adding a basic grid for searched shows

This commit is contained in:
Zoe Roux 2020-04-20 02:26:38 +02:00
parent aa8b50d167
commit 31cf22789c
4 changed files with 20 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<div class="container-fluid justify-content-center">
<div class="container-fluid justify-content-center" *ngIf="this.sortEnabled">
<button mat-icon-button matTooltipPosition="below" matTooltip="Filter">
<mat-icon>filter_list</mat-icon>
</button>

View File

@ -11,6 +11,7 @@ import { Show } from "../../models/show";
export class BrowseComponent
{
@Input() shows: Show[];
@Input() sortEnabled: boolean = true;
sortType: string = "title";
sortUp: boolean = true;

View File

@ -84,7 +84,7 @@
<mat-panel-title>Identify show</mat-panel-title>
<mat-panel-description>Search on metadata providers</mat-panel-description>
</mat-expansion-panel-header>
<p>Comming soon</p>
<app-browse [sortEnabled]="false" [shows]="this.identityShow(this.show.title) | async"></app-browse>
</mat-expansion-panel>
</mat-accordion>
</div>

View File

@ -5,7 +5,8 @@ import {Show} from "../../models/show";
import {Genre} from "../../models/genre";
import {MatChipInputEvent} from "@angular/material/chips";
import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete";
import {FormControl} from "@angular/forms";
import {Observable, of} from "rxjs";
import {tap} from "rxjs/operators";
import {Studio} from "../../models/studio";
@Component({
@ -20,6 +21,9 @@ export class MetadataEditComponent implements OnInit
private allGenres: Genre[];
private allStudios: Studio[];
private identifing: Observable<Show[]>;
private identifiedShows: [string, Show[]];
constructor(public dialogRef: MatDialogRef<MetadataEditComponent>, @Inject(MAT_DIALOG_DATA) public show: Show, private http: HttpClient)
{
this.http.get<Genre[]>("/api/genres").subscribe(result =>
@ -82,4 +86,16 @@ export class MetadataEditComponent implements OnInit
this.show.genres.push(event.option.value);
this.genreInput.nativeElement.value = '';
}
identityShow(name: string): Observable<Show[]>
{
if (this.identifing)
return this.identifing;
if (this.identifiedShows && this.identifiedShows[0] === name)
return of(this.identifiedShows[1]);
this.identifing = this.http.get<Show[]>("/api/show/identify/" + name + "?isMovie=" + this.show.isMovie).pipe(
tap(result => this.identifiedShows = [name, result])
);
return this.identifing;
}
}