mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
TV Search tab is now working !wip
This commit is contained in:
parent
2da1272ab8
commit
9c33cf96f7
3 changed files with 18 additions and 39 deletions
|
@ -37,6 +37,7 @@ export interface ISearchTvResult {
|
||||||
fullyAvailable: boolean;
|
fullyAvailable: boolean;
|
||||||
partlyAvailable: boolean;
|
partlyAvailable: boolean;
|
||||||
background: any;
|
background: any;
|
||||||
|
open: boolean; // THIS IS FOR THE UI
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITvRequestViewModel {
|
export interface ITvRequestViewModel {
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<i class='fa fa-film no-search-results-icon'></i>
|
<i class='fa fa-film no-search-results-icon'></i>
|
||||||
<div class='no-search-results-text'>{{ 'Search.NoResults' | translate }}</div>
|
<div class='no-search-results-text'>{{ 'Search.NoResults' | translate }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div *ngIf="tvResults" >
|
||||||
<div *ngFor="let node of tvResults">
|
<div *ngFor="let node of tvResults">
|
||||||
<!--This is the section that holds the parent level search results set-->
|
<!--This is the section that holds the parent level search results set-->
|
||||||
<div *ngIf="node">
|
<div *ngIf="node">
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<div class="tint" style="background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%);"></div>
|
<div class="tint" style="background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%);"></div>
|
||||||
<div class="col-sm-2 small-padding">
|
<div class="col-sm-2 small-padding">
|
||||||
|
|
||||||
<img *ngIf="node?.banner" class="img-responsive poster" width="150" [src]="node.banner" alt="poster">
|
<img *ngIf="node.banner" class="img-responsive poster" width="150" [src]="node.banner" alt="poster">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8 small-padding">
|
<div class="col-sm-8 small-padding">
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
<a href="#" (click)="latestSeason(node, $event)">{{ 'Search.TvShows.LatestSeason' | translate }}</a>
|
<a href="#" (click)="latestSeason(node, $event)">{{ 'Search.TvShows.LatestSeason' | translate }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" (click)="openClosestTab($event)">{{ 'Search.TvShows.Select' | translate }}</a>
|
<a href="#" (click)="openClosestTab(node, $event)">{{ 'Search.TvShows.Select' | translate }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -154,14 +154,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--This is the section that holds the child seasons if they want to specify specific episodes-->
|
<!--This is the section that holds the child seasons if they want to specify specific episodes-->
|
||||||
<div *ngIf="node.leaf">
|
<div *ngIf="node.open">
|
||||||
<seriesinformation [seriesId]="node.id"></seriesinformation>
|
<seriesinformation [seriesId]="node.id"></seriesinformation>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
</ng-template>
|
</div>
|
||||||
</p-treeTable>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -58,30 +58,9 @@ export class TvSearchComponent implements OnInit {
|
||||||
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
|
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public openClosestTab(el: any) {
|
public openClosestTab(node: ISearchTvResult,el: any) {
|
||||||
el.preventDefault();
|
el.preventDefault();
|
||||||
const rowclass = "undefined ng-star-inserted";
|
node.open = !node.open;
|
||||||
el = el.toElement || el.relatedTarget || el.target;
|
|
||||||
while (el.className !== rowclass) {
|
|
||||||
// Increment the loop to the parent node until we find the row we need
|
|
||||||
el = el.parentNode;
|
|
||||||
}
|
|
||||||
// At this point, the while loop has stopped and `el` represents the element that has
|
|
||||||
// the class you specified
|
|
||||||
|
|
||||||
// Then we loop through the children to find the caret which we want to click
|
|
||||||
const caretright = "fa-caret-right";
|
|
||||||
const caretdown = "fa-caret-down";
|
|
||||||
for (const value of el.children) {
|
|
||||||
// the caret from the ui has 2 class selectors depending on if expanded or not
|
|
||||||
// we search for both since we want to still toggle the clicking
|
|
||||||
if (value.className.includes(caretright) || value.className.includes(caretdown)) {
|
|
||||||
// Then we tell JS to click the element even though we hid it from the UI
|
|
||||||
value.click();
|
|
||||||
//Break from loop since we no longer need to continue looking
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
|
@ -146,7 +125,7 @@ export class TvSearchComponent implements OnInit {
|
||||||
});
|
});
|
||||||
this.searchService.getShowInformation(val.id)
|
this.searchService.getShowInformation(val.id)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
if (x.data) {
|
if (x) {
|
||||||
this.setDefaults(x);
|
this.setDefaults(x);
|
||||||
this.updateItem(val, x);
|
this.updateItem(val, x);
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,15 +215,15 @@ export class TvSearchComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private setDefaults(x: any) {
|
private setDefaults(x: ISearchTvResult) {
|
||||||
if (x.data.banner === null) {
|
if (x.banner === null) {
|
||||||
x.data.banner = this.defaultPoster;
|
x.banner = this.defaultPoster;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.data.imdbId === null) {
|
if (x.imdbId === null) {
|
||||||
x.data.imdbId = "https://www.tvmaze.com/shows/" + x.data.seriesId;
|
x.imdbId = "https://www.tvmaze.com/shows/" + x.seriesId;
|
||||||
} else {
|
} else {
|
||||||
x.data.imdbId = "http://www.imdb.com/title/" + x.data.imdbId + "/";
|
x.imdbId = "http://www.imdb.com/title/" + x.imdbId + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue