diff --git a/src/Ombi/ClientApp/app/requests/requests.module.ts b/src/Ombi/ClientApp/app/requests/requests.module.ts
index eaedf9618..b250602e4 100644
--- a/src/Ombi/ClientApp/app/requests/requests.module.ts
+++ b/src/Ombi/ClientApp/app/requests/requests.module.ts
@@ -12,9 +12,8 @@ import { ButtonModule, DialogModule } from 'primeng/primeng';
import { RequestComponent } from './request.component';
import { MovieRequestsComponent } from './movierequests.component';
import { TvRequestsComponent } from './tvrequests.component';
-import { TvRequestManageComponent } from './tvrequest-manage.component';
-//import { RequestGridComponent } from '../request-grid/request-grid.component';
-// import { RequestCardComponent } from '../request-grid/request-card.component';
+import { TvRequestChildrenComponent } from './tvrequest-children.component';
+
import { TreeTableModule } from 'primeng/primeng';
import { IdentityService } from '../services/identity.service';
@@ -24,7 +23,7 @@ import { AuthGuard } from '../auth/auth.guard';
const routes: Routes = [
{ path: 'requests', component: RequestComponent, canActivate: [AuthGuard] },
- { path: 'requests/:id', component: TvRequestManageComponent, canActivate: [AuthGuard] },
+ { path: 'requests/:id', component: TvRequestChildrenComponent, canActivate: [AuthGuard] },
];
@NgModule({
@@ -42,7 +41,7 @@ const routes: Routes = [
RequestComponent,
MovieRequestsComponent,
TvRequestsComponent,
- TvRequestManageComponent,
+ TvRequestChildrenComponent,
],
exports: [
RouterModule
diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-manage.component.html b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html
similarity index 90%
rename from src/Ombi/ClientApp/app/requests/tvrequest-manage.component.html
rename to src/Ombi/ClientApp/app/requests/tvrequest-children.component.html
index 649cdbebf..ef5d1a463 100644
--- a/src/Ombi/ClientApp/app/requests/tvrequest-manage.component.html
+++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html
@@ -1,25 +1,10 @@
+
Requested By: {{child.requestedUser.userName}}
-
-
-
-
-
-
-
-
@@ -92,8 +77,6 @@
Not Yet Requested
-
-
diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-manage.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts
similarity index 51%
rename from src/Ombi/ClientApp/app/requests/tvrequest-manage.component.ts
rename to src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts
index 966ab3cf2..672d8c089 100644
--- a/src/Ombi/ClientApp/app/requests/tvrequest-manage.component.ts
+++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts
@@ -1,42 +1,17 @@
-import { Component } from '@angular/core';
-import { ActivatedRoute } from '@angular/router';
-
+import { Component, Input } from '@angular/core';
import { RequestService } from '../services/request.service';
-import { IdentityService } from '../services/identity.service';
-
-import { IChildRequests, IEpisodesRequests, INewSeasonRequests } from '../interfaces/IRequestModel';
+import { IChildRequests, IEpisodesRequests } from '../interfaces/IRequestModel';
@Component({
- templateUrl: './tvrequest-manage.component.html'
+ selector:'tvrequests-children',
+ templateUrl: './tvrequest-children.component.html'
})
-export class TvRequestManageComponent {
- constructor(private requestService: RequestService, private identityService: IdentityService,
- private route: ActivatedRoute) {
-
- this.route.params
- .subscribe(params => {
- this.tvId = +params['id']; // (+) converts string 'id' to a number
- this.requestService.getChildRequests(this.tvId).subscribe(x => {
- this.childRequests = this.fixEpisodeSort(x);
- });
- });
-
- this.isAdmin = this.identityService.hasRole('admin');
+export class TvRequestChildrenComponent {
+ constructor(private requestService: RequestService) {
}
- tvId: number;
- childRequests: IChildRequests[];
- isAdmin: boolean;
- public fixEpisodeSort(items: IChildRequests[]) {
- items.forEach(function (value) {
- value.seasonRequests.forEach(function (requests: INewSeasonRequests) {
- requests.episodes.sort(function (a: IEpisodesRequests, b: IEpisodesRequests) {
- return a.episodeNumber - b.episodeNumber;
- })
- })
- })
- return items;
- }
+ @Input() childRequests: IChildRequests[];
+ @Input() isAdmin: boolean;
public removeRequest(request: IChildRequests) {
this.requestService.deleteChild(request)
.subscribe();
diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html
index ec81ee0bd..e515ee47a 100644
--- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html
+++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html
@@ -4,12 +4,20 @@
+
+
+ (scrolled)="loadMore()">-->
+
-
-
-
-
-
-
- Requested By: {{child.requestedUser.userName}}
- Requested Date: {{child.requestedDate | date}}
-
- Available
- Denied
- Processing Request
- Pending Approval
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Season: {{season.seasonNumber}}
-
-
-
-
-
- #
-
-
- Title
-
-
- Air Date
-
-
- Status
-
-
-
-
-
-
- {{ep.episodeNumber}}
-
-
- {{ep.title}}
-
-
- {{ep.airDate | date: 'dd/MM/yyyy' }}
-
-
- Available
- Processing Request
-
-
- Pending Approval
-
-
-
- Not Yet Requested
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts
index f45427d5a..e30248c24 100644
--- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts
+++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts
@@ -10,7 +10,7 @@ import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/map';
import { RequestService } from '../services/request.service';
-import { AuthService } from '../auth/auth.service';
+import { IdentityService } from '../services/identity.service';
import { ITvRequests, IChildRequests, INewSeasonRequests, IEpisodesRequests } from '../interfaces/IRequestModel';
import { TreeNode, } from "primeng/primeng";
@@ -25,10 +25,7 @@ import { TreeNode, } from "primeng/primeng";
encapsulation: ViewEncapsulation.None
})
export class TvRequestsComponent implements OnInit, OnDestroy {
- constructor(private requestService: RequestService,
- private authService: AuthService) {
-
- this.admin = this.authService.hasRole("admin");
+ constructor(private requestService: RequestService, private identityService: IdentityService) {
this.searchChanged
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
.distinctUntilChanged() // only emit if value is different from previous value
@@ -44,16 +41,6 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
.subscribe(m => this.tvRequests = this.transformData(m));
});
}
-
- ngOnInit() {
- this.amountToLoad = 5;
- this.currentlyLoaded = 5;
- this.tvRequests = [];
- this.loadInit();
- }
-
- public admin = false;
-
openClosestTab(el:any): void {
var rowclass = "undefined";
el = el.toElement;
@@ -81,27 +68,22 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
}
};
}
- transformData(datain: ITvRequests[]): any {
+ transformData(data: ITvRequests[]): TreeNode[] {
var temp: TreeNode[] = [];
- datain.forEach(function(value) {
- temp.push({
- "data": value,
- "children": [
- {
- "data": this.fixEpisodeSort(value.childRequests),
- leaf: true
- }
- ],
- leaf: false
- });
- },
- this);
- console.log(temp);
- return temp;
+ data.forEach(function (value) {
+ temp.push({
+ "data": value,
+ "children": [{
+ "data": this.fixEpisodeSort(value.childRequests), leaf: true
+ }],
+ leaf: false
+ });
+ }, this)
+ return temp;
}
private subscriptions = new Subject();
- tvRequests: ITvRequests[];
+ tvRequests: TreeNode[];
searchChanged = new Subject();
searchText: string;
@@ -114,22 +96,33 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
public showChildDialogue = false; // This is for the child modal popup
public selectedSeason: ITvRequests;
- private fixEpisodeSort(items: IChildRequests[]) : IChildRequests[] {
- items.forEach(value => {
- value.seasonRequests.forEach((requests: INewSeasonRequests) => {
- requests.episodes.sort(
- (a: IEpisodesRequests, b: IEpisodesRequests) => a.episodeNumber - b.episodeNumber)
- });
- });
+ fixEpisodeSort(items: IChildRequests[]) {
+ items.forEach(function (value) {
+ value.seasonRequests.forEach(function (requests: INewSeasonRequests) {
+ requests.episodes.sort(function (a: IEpisodesRequests, b: IEpisodesRequests) {
+ return a.episodeNumber - b.episodeNumber;
+ })
+ })
+ })
return items;
}
-
+ ngOnInit() {
+ this.amountToLoad = 1000;
+ this.currentlyLoaded = 5;
+ this.tvRequests = [];
+ this.loadInit();
+ }
public loadMore() {
- this.requestService.getTvRequests(this.amountToLoad, this.currentlyLoaded + 1)
+ //TODO: I believe this +1 is causing off by one error skipping loading of tv shows
+ //When removed and scrolling very slowly everything works as expected, however
+ //if you scroll really quickly then you start getting duplicates of movies
+ //since it's async and some subsequent results return first and then incrementer
+ //is increased so you see movies which had already been gotten show up...
+ this.requestService.getTvRequests(this.amountToLoad, this.currentlyLoaded +1)
.takeUntil(this.subscriptions)
.subscribe(x => {
- this.tvRequests.push.apply(this.tvRequests, x);
+ this.tvRequests.push.apply(this.tvRequests, this.transformData(x));
this.currentlyLoaded = this.currentlyLoaded + this.amountToLoad;
});
}
@@ -142,11 +135,6 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
this.requestService.removeTvRequest(request);
this.removeRequestFromUi(request);
}
- public removeChildRequest(request: IChildRequests) {
- this.requestService.deleteChild(request)
- .subscribe();
- this.removeChildRequestFromUi(request);
- }
public changeAvailability(request: IChildRequests, available: boolean) {
request.available = available;
@@ -154,30 +142,27 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
//this.updateRequest(request);
}
+ //Was already here but not sure what's using it...'
+ //public approve(request: IChildRequests) {
+ // request.approved = true;
+ // request.denied = false;
+ // //this.updateRequest(request);
+ //}
public approve(request: IChildRequests) {
request.approved = true;
request.denied = false;
-
- // Mark all the episodes as approved now
- request.seasonRequests.forEach((val) => {
- val.episodes.forEach((ep) => {
- ep.approved = true;
- });
- });
this.requestService.updateChild(request)
.subscribe();
}
-
+ //Was already here but not sure what's using it...'
+ //public deny(request: IChildRequests) {
+ // request.approved = false;
+ // request.denied = true;
+ // //this.updateRequest(request);
+ //}
public deny(request: IChildRequests) {
request.approved = false;
request.denied = true;
-
- // Mark all the episodes as not approved now
- request.seasonRequests.forEach((val) => {
- val.episodes.forEach((ep) => {
- ep.approved = false;
- });
- });
this.requestService.updateChild(request)
.subscribe();
}
@@ -195,12 +180,6 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
this.requestService.updateTvRequest(this.selectedSeason)
.subscribe();
}
- public denyChildSeasonRequest(request: IChildRequests) {
- request.approved = false;
- request.denied = true;
- this.requestService.updateChild(request)
- .subscribe();
- }
public showChildren(request: ITvRequests) {
this.selectedSeason = request;
@@ -229,6 +208,7 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
.subscribe(x => {
this.tvRequests = this.transformData(x);
});
+ this.isAdmin = this.identityService.hasRole("Admin");
}
private resetSearch() {
@@ -242,21 +222,6 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
this.tvRequests.splice(index, 1);
}
}
- private removeChildRequestFromUi(key: IChildRequests) {
- this.tvRequests.forEach((val) => {
- var data = (val).data;
- var index = data.childRequests.indexOf(key, 0);
- if (index > -1) {
- // Check if we need to remove the parent (if this is the only child)
- if (data.childRequests.length <= 1) {
- this.removeRequestFromUi(val);
- } else {
- data.childRequests.splice(index, 1);
- }
- }
- });
- }
-
ngOnDestroy(): void {
this.subscriptions.next();
diff --git a/src/Ombi/ClientApp/app/search/search.module.ts b/src/Ombi/ClientApp/app/search/search.module.ts
index 47bae541e..3742aad78 100644
--- a/src/Ombi/ClientApp/app/search/search.module.ts
+++ b/src/Ombi/ClientApp/app/search/search.module.ts
@@ -10,6 +10,8 @@ import { MovieSearchComponent } from './moviesearch.component';
import { TvSearchComponent } from './tvsearch.component';
import { SeriesInformationComponent } from './seriesinformation.component';
+import { TreeTableModule } from 'primeng/primeng';
+
import { SearchService } from '../services/search.service';
import { RequestService } from '../services/request.service';
@@ -26,12 +28,13 @@ const routes: Routes = [
FormsModule,
RouterModule.forChild(routes),
NgbModule.forRoot(),
+ TreeTableModule
],
declarations: [
SearchComponent,
MovieSearchComponent,
TvSearchComponent,
- SeriesInformationComponent
+ SeriesInformationComponent,
],
exports: [
RouterModule
diff --git a/src/Ombi/ClientApp/app/search/seriesinformation.component.html b/src/Ombi/ClientApp/app/search/seriesinformation.component.html
index 45945a9ca..3748c3452 100644
--- a/src/Ombi/ClientApp/app/search/seriesinformation.component.html
+++ b/src/Ombi/ClientApp/app/search/seriesinformation.component.html
@@ -8,14 +8,8 @@
}
-
+
Submit Request
+
@@ -83,9 +77,5 @@
-
-
-
-
Submit Request
diff --git a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts
index f539ca434..014047c42 100644
--- a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts
+++ b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts
@@ -1,5 +1,5 @@
-import { Component, OnInit, OnDestroy } from '@angular/core';
-import { ActivatedRoute } from '@angular/router';
+import { Component, OnInit, OnDestroy, Input} from '@angular/core';
+//import { ActivatedRoute } from '@angular/router';
import { Subject } from 'rxjs/Subject';
import "rxjs/add/operator/takeUntil";
@@ -13,24 +13,19 @@ import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
import { IEpisodesRequests } from "../interfaces/IRequestModel";
@Component({
+ selector: 'seriesinformation',
templateUrl: './seriesinformation.component.html',
styleUrls: ['./seriesinformation.component.scss']
})
export class SeriesInformationComponent implements OnInit, OnDestroy {
- constructor(private searchService: SearchService, private route: ActivatedRoute,
- private requestService: RequestService, private notificationService: NotificationService) {
- this.route.params
- .takeUntil(this.subscriptions)
- .subscribe(params => {
- this.seriesId = +params['id']; // (+) converts string 'id' to a number
- });
+ constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) {
}
private subscriptions = new Subject();
public result : IRequestEngineResult;
- private seriesId: number;
+ @Input() private seriesId: number;
public series: ISearchTvResult;
requestedEpisodes: IEpisodesRequests[] = [];
diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.html b/src/Ombi/ClientApp/app/search/tvsearch.component.html
index b5c727764..5120fee8b 100644
--- a/src/Ombi/ClientApp/app/search/tvsearch.component.html
+++ b/src/Ombi/ClientApp/app/search/tvsearch.component.html
@@ -32,123 +32,133 @@
Sorry, we didn't find any results!
-
-
-
-
-
-
-
-
-
-
-
-
- {{result.title}} ({{result.firstAired | date: 'yyyy'}})
-
-
-
-
{{result.status}}
-
-
-
Air Date: {{result.firstAired}}
-
-
-
Release Date: {{result.releaseDate | date: 'dd/MM/yyyy'}}
-
-
Available
-
Processing Request
-
-
- Pending Approval
-
-
-
- Not Yet Requested
-
-
-
-
-
-
HomePage
-
-
Trailer
-
-
-
-
+
+
+
+ Results
+
+
+
+
+
+
+
+
+
+
+
+
+
{{node.data.overview}}
+
+
+
+
+
+
+
+
+
+
+
+ Request
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- {{result.overview}}
-
-
-
-
-
-
-
-
-
-
-
-
- Request
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts
index f1c2cfa68..bbfd1bf66 100644
--- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts
+++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit, OnDestroy } from '@angular/core';
+import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
import {Router} from '@angular/router';
import { Subject } from 'rxjs/Subject';
import 'rxjs/add/operator/debounceTime';
@@ -12,10 +12,16 @@ import { NotificationService } from '../services/notification.service';
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
+import { TreeNode } from "primeng/primeng";
@Component({
selector: 'tv-search',
templateUrl: './tvsearch.component.html',
+ styleUrls: ['./../requests/tvrequests.component.scss'],
+ //Was required to turn off encapsulation since CSS only should be overridden for this component
+ //However when encapsulation is on angular injects prefixes to all classes so css selectors
+ //Stop working
+ encapsulation: ViewEncapsulation.None
})
export class TvSearchComponent implements OnInit, OnDestroy {
@@ -41,11 +47,50 @@ export class TvSearchComponent implements OnInit, OnDestroy {
this.searchService.searchTv(this.searchText)
.takeUntil(this.subscriptions)
.subscribe(x => {
- this.tvResults = x;
+ this.tvResults = this.transformData(x);
this.searchApplied = true;
});
});
}
+ openClosestTab(el: any): void {
+ var rowclass = "undefined";
+ el = el.toElement;
+ while (el.className != rowclass) {
+ // Increment the loop to the parent node until we find the row we need
+ el = el.parentNode;
+ if (!el) {
+ }
+ }
+ // 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
+ var caretright = "ui-treetable-toggler fa fa-fw ui-c fa-caret-right";
+ var caretdown = "ui-treetable-toggler fa fa-fw ui-c fa-caret-down";
+ for (var 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 === caretright || value.className === 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;
+ }
+ };
+ }
+ transformData(datain: ISearchTvResult[]): any {
+ var temp: TreeNode[] = [];
+ datain.forEach(function (value) {
+ temp.push({
+ "data": value,
+ "children": [{
+ "data": value, leaf: true
+ }],
+ leaf: false
+ });
+ }, this)
+ return temp;
+ }
ngOnInit(): void {
this.searchText = "";