mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
upgrades
This commit is contained in:
parent
cea33c7e93
commit
6a1dd87eeb
24 changed files with 1232 additions and 1255 deletions
|
@ -15,6 +15,7 @@
|
|||
"@angular/compiler": "^9.1.7",
|
||||
"@angular/core": "^9.1.7",
|
||||
"@angular/forms": "^9.1.7",
|
||||
"@angular/localize": "^9.1.7",
|
||||
"@angular/material": "^9.2.3",
|
||||
"@angular/platform-browser": "^9.1.7",
|
||||
"@angular/platform-browser-dynamic": "^9.1.7",
|
||||
|
@ -50,7 +51,7 @@
|
|||
"please-wait": "^0.0.5",
|
||||
"popper.js": "^1.14.3",
|
||||
"primeicons": "^1.0.0",
|
||||
"primeng": "^7.0.3",
|
||||
"primeng": "^9.0.6",
|
||||
"rxjs": "^6.5.2",
|
||||
"spinkit": "^1.2.5",
|
||||
"store": "^2.0.12",
|
||||
|
|
|
@ -11,11 +11,14 @@ import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
|||
import { TranslateLoader, TranslateModule } from "@ngx-translate/core";
|
||||
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
|
||||
import { CookieService } from "ng2-cookies";
|
||||
import { GrowlModule } from "primeng/components/growl/growl";
|
||||
import {
|
||||
ButtonModule, CaptchaModule, ConfirmationService, ConfirmDialogModule, DataTableModule, DialogModule, OverlayPanelModule, SharedModule, SidebarModule,
|
||||
TooltipModule
|
||||
} from "primeng/primeng";
|
||||
|
||||
import { ButtonModule } from "primeng/button";
|
||||
import { ConfirmDialogModule } from "primeng/confirmdialog";
|
||||
import { DataViewModule } from "primeng/dataview";
|
||||
import { DialogModule } from "primeng/dialog";
|
||||
import { OverlayPanelModule } from "primeng/overlaypanel";
|
||||
import { TooltipModule } from "primeng/tooltip";
|
||||
import { SidebarModule } from "primeng/sidebar";
|
||||
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
@ -79,7 +82,7 @@ const routes: Routes = [
|
|||
{ loadChildren: () => import("./settings/settings.module").then(m => m.SettingsModule), path: "Settings" },
|
||||
{ loadChildren: () => import("./wizard/wizard.module").then(m => m.WizardModule), path: "Wizard" },
|
||||
{ loadChildren: () => import("./usermanagement/usermanagement.module").then(m => m.UserManagementModule), path: "usermanagement" },
|
||||
{ loadChildren: () => import("./requests/requests.module").then(m => m.RequestsModule), path: "requestsOld" },
|
||||
// { loadChildren: () => import("./requests/requests.module").then(m => m.RequestsModule), path: "requestsOld" },
|
||||
{ loadChildren: () => import("./requests-list/requests-list.module").then(m => m.RequestsListModule), path: "requests-list" },
|
||||
{ loadChildren: () => import("./vote/vote.module").then(m => m.VoteModule), path: "vote" },
|
||||
{ loadChildren: () => import("./media-details/media-details.module").then(m => m.MediaDetailsModule), path: "details" },
|
||||
|
@ -114,12 +117,10 @@ export function JwtTokenGetter() {
|
|||
BrowserModule,
|
||||
HttpClientModule,
|
||||
BrowserAnimationsModule,
|
||||
GrowlModule,
|
||||
ButtonModule,
|
||||
FormsModule,
|
||||
DataTableModule,
|
||||
DataViewModule,
|
||||
MatSnackBarModule,
|
||||
SharedModule,
|
||||
MatSnackBarModule,
|
||||
DialogModule,
|
||||
MatButtonModule,
|
||||
|
@ -130,7 +131,6 @@ export function JwtTokenGetter() {
|
|||
MatTabsModule,
|
||||
ReactiveFormsModule,
|
||||
MatAutocompleteModule,
|
||||
CaptchaModule,
|
||||
TooltipModule,
|
||||
ConfirmDialogModule,
|
||||
OverlayPanelModule,
|
||||
|
@ -176,7 +176,6 @@ export function JwtTokenGetter() {
|
|||
IdentityService,
|
||||
StatusService,
|
||||
LandingPageService,
|
||||
ConfirmationService,
|
||||
ImageService,
|
||||
CustomPageService,
|
||||
CookieService,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { RouterModule, Routes } from "@angular/router";
|
||||
|
||||
import { OrderModule } from "ngx-order-pipe";
|
||||
import { PaginatorModule, SharedModule, TabViewModule } from "primeng/primeng";
|
||||
|
||||
import { IdentityService, SearchService } from "../services";
|
||||
|
||||
|
@ -15,7 +14,6 @@ import { IssuesComponent } from "./issues.component";
|
|||
import { IssuesTableComponent } from "./issuestable.component";
|
||||
|
||||
import { PipeModule } from "../pipes/pipe.module";
|
||||
import { IssuesListComponent } from "./components/issues-list/issues-list.component";
|
||||
|
||||
import * as fromComponents from "./components";
|
||||
|
||||
|
@ -27,12 +25,9 @@ const routes: Routes = [
|
|||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild(routes),
|
||||
SharedModule,
|
||||
OrderModule,
|
||||
PipeModule,
|
||||
OmbiShared,
|
||||
PaginatorModule,
|
||||
TabViewModule,
|
||||
],
|
||||
declarations: [
|
||||
IssuesComponent,
|
||||
|
|
|
@ -1,386 +1,386 @@
|
|||
import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
import { Component, Input, OnInit, Inject } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { Subject } from "rxjs";
|
||||
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
// import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
// import { Component, Input, OnInit, Inject } from "@angular/core";
|
||||
// import { DomSanitizer } from "@angular/platform-browser";
|
||||
// import { Subject } from "rxjs";
|
||||
// import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
|
||||
import { AuthService } from "../auth/auth.service";
|
||||
import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder, OrderType } from "../interfaces";
|
||||
import { NotificationService, RadarrService, RequestService } from "../services";
|
||||
// import { AuthService } from "../auth/auth.service";
|
||||
// import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder, OrderType } from "../interfaces";
|
||||
// import { NotificationService, RadarrService, RequestService } from "../services";
|
||||
|
||||
@Component({
|
||||
selector: "movie-requests",
|
||||
templateUrl: "./movierequests.component.html",
|
||||
})
|
||||
export class MovieRequestsComponent implements OnInit {
|
||||
public movieRequests: IMovieRequests[];
|
||||
public defaultPoster: string;
|
||||
// @Component({
|
||||
// selector: "movie-requests",
|
||||
// templateUrl: "./movierequests.component.html",
|
||||
// })
|
||||
// export class MovieRequestsComponent implements OnInit {
|
||||
// public movieRequests: IMovieRequests[];
|
||||
// public defaultPoster: string;
|
||||
|
||||
public searchChanged: Subject<string> = new Subject<string>();
|
||||
public searchText: string;
|
||||
// public searchChanged: Subject<string> = new Subject<string>();
|
||||
// public searchText: string;
|
||||
|
||||
public isAdmin: boolean; // Also PowerUser
|
||||
// public isAdmin: boolean; // Also PowerUser
|
||||
|
||||
public radarrProfiles: IRadarrProfile[];
|
||||
public radarrRootFolders: IRadarrRootFolder[];
|
||||
// public radarrProfiles: IRadarrProfile[];
|
||||
// public radarrRootFolders: IRadarrRootFolder[];
|
||||
|
||||
@Input() public issueCategories: IIssueCategory[];
|
||||
@Input() public issuesEnabled: boolean;
|
||||
public issuesBarVisible = false;
|
||||
public issueRequest: IMovieRequests;
|
||||
public issueProviderId: string;
|
||||
public issueCategorySelected: IIssueCategory;
|
||||
// @Input() public issueCategories: IIssueCategory[];
|
||||
// @Input() public issuesEnabled: boolean;
|
||||
// public issuesBarVisible = false;
|
||||
// public issueRequest: IMovieRequests;
|
||||
// public issueProviderId: string;
|
||||
// public issueCategorySelected: IIssueCategory;
|
||||
|
||||
public filterDisplay: boolean;
|
||||
public filter: IFilter;
|
||||
public filterType = FilterType;
|
||||
// public filterDisplay: boolean;
|
||||
// public filter: IFilter;
|
||||
// public filterType = FilterType;
|
||||
|
||||
public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
public OrderType = OrderType;
|
||||
public denyDisplay: boolean;
|
||||
public requestToDeny: IMovieRequests;
|
||||
public rejectionReason: string;
|
||||
// public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
// public OrderType = OrderType;
|
||||
// public denyDisplay: boolean;
|
||||
// public requestToDeny: IMovieRequests;
|
||||
// public rejectionReason: string;
|
||||
|
||||
public totalMovies: number = 100;
|
||||
public currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
private href: string;
|
||||
// public totalMovies: number = 100;
|
||||
// public currentlyLoaded: number;
|
||||
// private amountToLoad: number;
|
||||
// private href: string;
|
||||
|
||||
constructor(
|
||||
private requestService: RequestService,
|
||||
private auth: AuthService,
|
||||
private notificationService: NotificationService,
|
||||
private radarrService: RadarrService,
|
||||
private sanitizer: DomSanitizer,
|
||||
@Inject(APP_BASE_HREF) href:string) {
|
||||
this.href = href;
|
||||
this.searchChanged.pipe(
|
||||
debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
distinctUntilChanged(), // only emit if value is different from previous value
|
||||
).subscribe(x => {
|
||||
this.searchText = x as string;
|
||||
if (this.searchText === "") {
|
||||
this.resetSearch();
|
||||
return;
|
||||
}
|
||||
this.requestService.searchMovieRequests(this.searchText)
|
||||
.subscribe(m => {
|
||||
this.setOverrides(m);
|
||||
this.movieRequests = m;
|
||||
});
|
||||
});
|
||||
this.defaultPoster = "../../../images/default_movie_poster.png";
|
||||
const base = this.href;
|
||||
if (base) {
|
||||
this.defaultPoster = "../../.." + base + "/images/default_movie_poster.png";
|
||||
}
|
||||
}
|
||||
// constructor(
|
||||
// private requestService: RequestService,
|
||||
// private auth: AuthService,
|
||||
// private notificationService: NotificationService,
|
||||
// private radarrService: RadarrService,
|
||||
// private sanitizer: DomSanitizer,
|
||||
// @Inject(APP_BASE_HREF) href:string) {
|
||||
// this.href = href;
|
||||
// this.searchChanged.pipe(
|
||||
// debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
// distinctUntilChanged(), // only emit if value is different from previous value
|
||||
// ).subscribe(x => {
|
||||
// this.searchText = x as string;
|
||||
// if (this.searchText === "") {
|
||||
// this.resetSearch();
|
||||
// return;
|
||||
// }
|
||||
// this.requestService.searchMovieRequests(this.searchText)
|
||||
// .subscribe(m => {
|
||||
// this.setOverrides(m);
|
||||
// this.movieRequests = m;
|
||||
// });
|
||||
// });
|
||||
// this.defaultPoster = "../../../images/default_movie_poster.png";
|
||||
// const base = this.href;
|
||||
// if (base) {
|
||||
// this.defaultPoster = "../../.." + base + "/images/default_movie_poster.png";
|
||||
// }
|
||||
// }
|
||||
|
||||
public ngOnInit() {
|
||||
this.amountToLoad = 10;
|
||||
this.currentlyLoaded = 10;
|
||||
this.filter = {
|
||||
availabilityFilter: FilterType.None,
|
||||
statusFilter: FilterType.None,
|
||||
};
|
||||
this.loadInit();
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
// public ngOnInit() {
|
||||
// this.amountToLoad = 10;
|
||||
// this.currentlyLoaded = 10;
|
||||
// this.filter = {
|
||||
// availabilityFilter: FilterType.None,
|
||||
// statusFilter: FilterType.None,
|
||||
// };
|
||||
// this.loadInit();
|
||||
// this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public paginate(event: IPagenator) {
|
||||
const skipAmount = event.first;
|
||||
this.loadRequests(this.amountToLoad, skipAmount);
|
||||
}
|
||||
// public paginate(event: IPagenator) {
|
||||
// const skipAmount = event.first;
|
||||
// this.loadRequests(this.amountToLoad, skipAmount);
|
||||
// }
|
||||
|
||||
public search(text: any) {
|
||||
this.searchChanged.next(text.target.value);
|
||||
}
|
||||
// public search(text: any) {
|
||||
// this.searchChanged.next(text.target.value);
|
||||
// }
|
||||
|
||||
public removeRequest(request: IMovieRequests) {
|
||||
this.requestService.removeMovieRequest(request.id);
|
||||
this.removeRequestFromUi(request);
|
||||
this.loadRequests(this.amountToLoad, this.currentlyLoaded = 0);
|
||||
}
|
||||
// public removeRequest(request: IMovieRequests) {
|
||||
// this.requestService.removeMovieRequest(request.id);
|
||||
// this.removeRequestFromUi(request);
|
||||
// this.loadRequests(this.amountToLoad, this.currentlyLoaded = 0);
|
||||
// }
|
||||
|
||||
public changeAvailability(request: IMovieRequests, available: boolean) {
|
||||
request.available = available;
|
||||
// public changeAvailability(request: IMovieRequests, available: boolean) {
|
||||
// request.available = available;
|
||||
|
||||
if (available) {
|
||||
this.requestService.markMovieAvailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`${request.title} Is now available`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.requestService.markMovieUnavailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`${request.title} Is now unavailable`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (available) {
|
||||
// this.requestService.markMovieAvailable({ id: request.id }).subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `${request.title} Is now available`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// this.requestService.markMovieUnavailable({ id: request.id }).subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `${request.title} Is now unavailable`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
public approve(request: IMovieRequests) {
|
||||
request.approved = true;
|
||||
this.approveRequest(request);
|
||||
}
|
||||
// public approve(request: IMovieRequests) {
|
||||
// request.approved = true;
|
||||
// this.approveRequest(request);
|
||||
// }
|
||||
|
||||
public deny(request: IMovieRequests) {
|
||||
this.requestToDeny = request;
|
||||
this.denyDisplay = true;
|
||||
}
|
||||
// public deny(request: IMovieRequests) {
|
||||
// this.requestToDeny = request;
|
||||
// this.denyDisplay = true;
|
||||
// }
|
||||
|
||||
public denyRequest() {
|
||||
this.requestService.denyMovie({ id: this.requestToDeny.id, reason: this.rejectionReason })
|
||||
.subscribe(x => {
|
||||
this.denyDisplay = false;
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request for ${this.requestToDeny.title} has been denied successfully`);
|
||||
const index = this.movieRequests.indexOf(this.requestToDeny, 0);
|
||||
if (index > -1) {
|
||||
this.movieRequests[index].denied = true;
|
||||
}
|
||||
} else {
|
||||
this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
this.requestToDeny.denied = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// public denyRequest() {
|
||||
// this.requestService.denyMovie({ id: this.requestToDeny.id, reason: this.rejectionReason })
|
||||
// .subscribe(x => {
|
||||
// this.denyDisplay = false;
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `Request for ${this.requestToDeny.title} has been denied successfully`);
|
||||
// const index = this.movieRequests.indexOf(this.requestToDeny, 0);
|
||||
// if (index > -1) {
|
||||
// this.movieRequests[index].denied = true;
|
||||
// }
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
// this.requestToDeny.denied = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public selectRootFolder(searchResult: IMovieRequests, rootFolderSelected: IRadarrRootFolder, event: any) {
|
||||
event.preventDefault();
|
||||
searchResult.rootPathOverride = rootFolderSelected.id;
|
||||
this.setOverride(searchResult);
|
||||
this.updateRequest(searchResult);
|
||||
}
|
||||
// public selectRootFolder(searchResult: IMovieRequests, rootFolderSelected: IRadarrRootFolder, event: any) {
|
||||
// event.preventDefault();
|
||||
// searchResult.rootPathOverride = rootFolderSelected.id;
|
||||
// this.setOverride(searchResult);
|
||||
// this.updateRequest(searchResult);
|
||||
// }
|
||||
|
||||
public selectQualityProfile(searchResult: IMovieRequests, profileSelected: IRadarrProfile, event: any) {
|
||||
event.preventDefault();
|
||||
searchResult.qualityOverride = profileSelected.id;
|
||||
this.setOverride(searchResult);
|
||||
this.updateRequest(searchResult);
|
||||
}
|
||||
// public selectQualityProfile(searchResult: IMovieRequests, profileSelected: IRadarrProfile, event: any) {
|
||||
// event.preventDefault();
|
||||
// searchResult.qualityOverride = profileSelected.id;
|
||||
// this.setOverride(searchResult);
|
||||
// this.updateRequest(searchResult);
|
||||
// }
|
||||
|
||||
public reportIssue(catId: IIssueCategory, req: IMovieRequests) {
|
||||
this.issueRequest = req;
|
||||
this.issueCategorySelected = catId;
|
||||
this.issuesBarVisible = true;
|
||||
this.issueProviderId = req.theMovieDbId.toString();
|
||||
}
|
||||
// public reportIssue(catId: IIssueCategory, req: IMovieRequests) {
|
||||
// this.issueRequest = req;
|
||||
// this.issueCategorySelected = catId;
|
||||
// this.issuesBarVisible = true;
|
||||
// this.issueProviderId = req.theMovieDbId.toString();
|
||||
// }
|
||||
|
||||
public ignore(event: any): void {
|
||||
event.preventDefault();
|
||||
}
|
||||
// public ignore(event: any): void {
|
||||
// event.preventDefault();
|
||||
// }
|
||||
|
||||
public clearFilter(el: any) {
|
||||
el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
// public clearFilter(el: any) {
|
||||
// el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
el = el.parentElement;
|
||||
el = el.querySelectorAll("INPUT");
|
||||
for (el of el) {
|
||||
el.checked = false;
|
||||
el.parentElement.classList.remove("active");
|
||||
}
|
||||
// el = el.parentElement;
|
||||
// el = el.querySelectorAll("INPUT");
|
||||
// for (el of el) {
|
||||
// el.checked = false;
|
||||
// el.parentElement.classList.remove("active");
|
||||
// }
|
||||
|
||||
this.filterDisplay = false;
|
||||
this.filter.availabilityFilter = FilterType.None;
|
||||
this.filter.statusFilter = FilterType.None;
|
||||
// this.filterDisplay = false;
|
||||
// this.filter.availabilityFilter = FilterType.None;
|
||||
// this.filter.statusFilter = FilterType.None;
|
||||
|
||||
this.resetSearch();
|
||||
}
|
||||
// this.resetSearch();
|
||||
// }
|
||||
|
||||
public filterAvailability(filter: FilterType, el: any) {
|
||||
this.filterActiveStyle(el);
|
||||
this.filter.availabilityFilter = filter;
|
||||
this.loadInit();
|
||||
}
|
||||
// public filterAvailability(filter: FilterType, el: any) {
|
||||
// this.filterActiveStyle(el);
|
||||
// this.filter.availabilityFilter = filter;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
public filterStatus(filter: FilterType, el: any) {
|
||||
this.filterActiveStyle(el);
|
||||
this.filter.statusFilter = filter;
|
||||
this.loadInit();
|
||||
}
|
||||
// public filterStatus(filter: FilterType, el: any) {
|
||||
// this.filterActiveStyle(el);
|
||||
// this.filter.statusFilter = filter;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
public setOrder(value: OrderType, el: any) {
|
||||
el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
// public setOrder(value: OrderType, el: any) {
|
||||
// el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
const parent = el.parentElement;
|
||||
const previousFilter = parent.querySelector(".active");
|
||||
// const parent = el.parentElement;
|
||||
// const previousFilter = parent.querySelector(".active");
|
||||
|
||||
previousFilter.className = "";
|
||||
el.className = "active";
|
||||
// previousFilter.className = "";
|
||||
// el.className = "active";
|
||||
|
||||
this.orderType = value;
|
||||
// this.orderType = value;
|
||||
|
||||
this.loadInit();
|
||||
}
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
public subscribe(request: IMovieRequests) {
|
||||
request.subscribed = true;
|
||||
this.requestService.subscribeToMovie(request.id)
|
||||
.subscribe(x => {
|
||||
this.notificationService.success("Subscribed To Movie!");
|
||||
});
|
||||
}
|
||||
// public subscribe(request: IMovieRequests) {
|
||||
// request.subscribed = true;
|
||||
// this.requestService.subscribeToMovie(request.id)
|
||||
// .subscribe(x => {
|
||||
// this.notificationService.success("Subscribed To Movie!");
|
||||
// });
|
||||
// }
|
||||
|
||||
public unSubscribe(request: IMovieRequests) {
|
||||
request.subscribed = false;
|
||||
this.requestService.unSubscribeToMovie(request.id)
|
||||
.subscribe(x => {
|
||||
this.notificationService.success("Unsubscribed Movie!");
|
||||
});
|
||||
}
|
||||
// public unSubscribe(request: IMovieRequests) {
|
||||
// request.subscribed = false;
|
||||
// this.requestService.unSubscribeToMovie(request.id)
|
||||
// .subscribe(x => {
|
||||
// this.notificationService.success("Unsubscribed Movie!");
|
||||
// });
|
||||
// }
|
||||
|
||||
public isRequestUser(request: IMovieRequests) {
|
||||
if (request.requestedUser.userName === this.auth.claims().name) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// public isRequestUser(request: IMovieRequests) {
|
||||
// if (request.requestedUser.userName === this.auth.claims().name) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
private filterActiveStyle(el: any) {
|
||||
el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
// private filterActiveStyle(el: any) {
|
||||
// el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
el = el.parentElement; //gets radio div
|
||||
el = el.parentElement; //gets form group div
|
||||
el = el.parentElement; //gets status filter div
|
||||
el = el.querySelectorAll("INPUT");
|
||||
for (el of el) {
|
||||
if (el.checked) {
|
||||
if (!el.parentElement.classList.contains("active")) {
|
||||
el.parentElement.className += " active";
|
||||
}
|
||||
} else {
|
||||
el.parentElement.classList.remove("active");
|
||||
}
|
||||
}
|
||||
}
|
||||
// el = el.parentElement; //gets radio div
|
||||
// el = el.parentElement; //gets form group div
|
||||
// el = el.parentElement; //gets status filter div
|
||||
// el = el.querySelectorAll("INPUT");
|
||||
// for (el of el) {
|
||||
// if (el.checked) {
|
||||
// if (!el.parentElement.classList.contains("active")) {
|
||||
// el.parentElement.className += " active";
|
||||
// }
|
||||
// } else {
|
||||
// el.parentElement.classList.remove("active");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private loadRequests(amountToLoad: number, currentlyLoaded: number) {
|
||||
this.requestService.getMovieRequests(amountToLoad, currentlyLoaded, this.orderType, this.filter)
|
||||
.subscribe(x => {
|
||||
this.setOverrides(x.collection);
|
||||
if (!this.movieRequests) {
|
||||
this.movieRequests = [];
|
||||
}
|
||||
this.movieRequests = x.collection;
|
||||
this.totalMovies = x.total;
|
||||
this.currentlyLoaded = currentlyLoaded + amountToLoad;
|
||||
});
|
||||
}
|
||||
// private loadRequests(amountToLoad: number, currentlyLoaded: number) {
|
||||
// this.requestService.getMovieRequests(amountToLoad, currentlyLoaded, this.orderType, this.filter)
|
||||
// .subscribe(x => {
|
||||
// this.setOverrides(x.collection);
|
||||
// if (!this.movieRequests) {
|
||||
// this.movieRequests = [];
|
||||
// }
|
||||
// this.movieRequests = x.collection;
|
||||
// this.totalMovies = x.total;
|
||||
// this.currentlyLoaded = currentlyLoaded + amountToLoad;
|
||||
// });
|
||||
// }
|
||||
|
||||
private updateRequest(request: IMovieRequests) {
|
||||
this.requestService.updateMovieRequest(request)
|
||||
.subscribe(x => {
|
||||
this.setOverride(x);
|
||||
request = x;
|
||||
});
|
||||
}
|
||||
// private updateRequest(request: IMovieRequests) {
|
||||
// this.requestService.updateMovieRequest(request)
|
||||
// .subscribe(x => {
|
||||
// this.setOverride(x);
|
||||
// request = x;
|
||||
// });
|
||||
// }
|
||||
|
||||
private approveRequest(request: IMovieRequests) {
|
||||
this.requestService.approveMovie({ id: request.id })
|
||||
.subscribe(x => {
|
||||
request.approved = true;
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request for ${request.title} has been approved successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// private approveRequest(request: IMovieRequests) {
|
||||
// this.requestService.approveMovie({ id: request.id })
|
||||
// .subscribe(x => {
|
||||
// request.approved = true;
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `Request for ${request.title} has been approved successfully`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
private loadInit() {
|
||||
this.requestService.getMovieRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
||||
.subscribe(x => {
|
||||
this.movieRequests = x.collection;
|
||||
this.totalMovies = x.total;
|
||||
// private loadInit() {
|
||||
// this.requestService.getMovieRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
||||
// .subscribe(x => {
|
||||
// this.movieRequests = x.collection;
|
||||
// this.totalMovies = x.total;
|
||||
|
||||
this.movieRequests.forEach((req) => {
|
||||
this.setBackground(req);
|
||||
this.setPoster(req);
|
||||
});
|
||||
if (this.isAdmin) {
|
||||
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
this.radarrProfiles = c;
|
||||
this.movieRequests.forEach((req) => this.setQualityOverrides(req));
|
||||
});
|
||||
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
this.radarrRootFolders = c;
|
||||
this.movieRequests.forEach((req) => this.setRootFolderOverrides(req));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// this.movieRequests.forEach((req) => {
|
||||
// this.setBackground(req);
|
||||
// this.setPoster(req);
|
||||
// });
|
||||
// if (this.isAdmin) {
|
||||
// this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
// this.radarrProfiles = c;
|
||||
// this.movieRequests.forEach((req) => this.setQualityOverrides(req));
|
||||
// });
|
||||
// this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
// this.radarrRootFolders = c;
|
||||
// this.movieRequests.forEach((req) => this.setRootFolderOverrides(req));
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
private resetSearch() {
|
||||
this.currentlyLoaded = 5;
|
||||
this.loadInit();
|
||||
}
|
||||
// private resetSearch() {
|
||||
// this.currentlyLoaded = 5;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
private removeRequestFromUi(key: IMovieRequests) {
|
||||
const index = this.movieRequests.indexOf(key, 0);
|
||||
if (index > -1) {
|
||||
this.movieRequests.splice(index, 1);
|
||||
}
|
||||
}
|
||||
// private removeRequestFromUi(key: IMovieRequests) {
|
||||
// const index = this.movieRequests.indexOf(key, 0);
|
||||
// if (index > -1) {
|
||||
// this.movieRequests.splice(index, 1);
|
||||
// }
|
||||
// }
|
||||
|
||||
private setOverrides(requests: IMovieRequests[]): void {
|
||||
requests.forEach((req) => {
|
||||
this.setOverride(req);
|
||||
});
|
||||
}
|
||||
// private setOverrides(requests: IMovieRequests[]): void {
|
||||
// requests.forEach((req) => {
|
||||
// this.setOverride(req);
|
||||
// });
|
||||
// }
|
||||
|
||||
private setQualityOverrides(req: IMovieRequests): void {
|
||||
if (this.radarrProfiles) {
|
||||
const profile = this.radarrProfiles.filter((p) => {
|
||||
return p.id === req.qualityOverride;
|
||||
});
|
||||
if (profile.length > 0) {
|
||||
req.qualityOverrideTitle = profile[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
private setRootFolderOverrides(req: IMovieRequests): void {
|
||||
if (this.radarrRootFolders) {
|
||||
const path = this.radarrRootFolders.filter((folder) => {
|
||||
return folder.id === req.rootPathOverride;
|
||||
});
|
||||
if (path.length > 0) {
|
||||
req.rootPathOverrideTitle = path[0].path;
|
||||
}
|
||||
}
|
||||
}
|
||||
// private setQualityOverrides(req: IMovieRequests): void {
|
||||
// if (this.radarrProfiles) {
|
||||
// const profile = this.radarrProfiles.filter((p) => {
|
||||
// return p.id === req.qualityOverride;
|
||||
// });
|
||||
// if (profile.length > 0) {
|
||||
// req.qualityOverrideTitle = profile[0].name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private setRootFolderOverrides(req: IMovieRequests): void {
|
||||
// if (this.radarrRootFolders) {
|
||||
// const path = this.radarrRootFolders.filter((folder) => {
|
||||
// return folder.id === req.rootPathOverride;
|
||||
// });
|
||||
// if (path.length > 0) {
|
||||
// req.rootPathOverrideTitle = path[0].path;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private setOverride(req: IMovieRequests): void {
|
||||
this.setPoster(req);
|
||||
this.setBackground(req);
|
||||
this.setQualityOverrides(req);
|
||||
this.setRootFolderOverrides(req);
|
||||
}
|
||||
// private setOverride(req: IMovieRequests): void {
|
||||
// this.setPoster(req);
|
||||
// this.setBackground(req);
|
||||
// this.setQualityOverrides(req);
|
||||
// this.setRootFolderOverrides(req);
|
||||
// }
|
||||
|
||||
private setPoster(req: IMovieRequests): void {
|
||||
if (req.posterPath === null) {
|
||||
req.posterPath = this.defaultPoster;
|
||||
} else {
|
||||
req.posterPath = "https://image.tmdb.org/t/p/w300/" + req.posterPath;
|
||||
}
|
||||
}
|
||||
// private setPoster(req: IMovieRequests): void {
|
||||
// if (req.posterPath === null) {
|
||||
// req.posterPath = this.defaultPoster;
|
||||
// } else {
|
||||
// req.posterPath = "https://image.tmdb.org/t/p/w300/" + req.posterPath;
|
||||
// }
|
||||
// }
|
||||
|
||||
private setBackground(req: IMovieRequests): void {
|
||||
req.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + "https://image.tmdb.org/t/p/w1280" + req.background + ")");
|
||||
}
|
||||
// private setBackground(req: IMovieRequests): void {
|
||||
// req.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
|
||||
// ("url(" + "https://image.tmdb.org/t/p/w1280" + req.background + ")");
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
|
|
@ -1,349 +1,349 @@
|
|||
import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
import { Component, Input, OnInit, Inject } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { Subject } from "rxjs";
|
||||
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
// import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
// import { Component, Input, OnInit, Inject } from "@angular/core";
|
||||
// import { DomSanitizer } from "@angular/platform-browser";
|
||||
// import { Subject } from "rxjs";
|
||||
// import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
|
||||
import { AuthService } from "../../auth/auth.service";
|
||||
import { FilterType, IAlbumRequest, IFilter, IIssueCategory, IPagenator, OrderType } from "../../interfaces";
|
||||
import { NotificationService, RequestService } from "../../services";
|
||||
// import { AuthService } from "../../auth/auth.service";
|
||||
// import { FilterType, IAlbumRequest, IFilter, IIssueCategory, IPagenator, OrderType } from "../../interfaces";
|
||||
// import { NotificationService, RequestService } from "../../services";
|
||||
|
||||
@Component({
|
||||
selector: "music-requests",
|
||||
templateUrl: "./musicrequests.component.html",
|
||||
})
|
||||
export class MusicRequestsComponent implements OnInit {
|
||||
public albumRequests: IAlbumRequest[];
|
||||
public defaultPoster: string;
|
||||
// @Component({
|
||||
// selector: "music-requests",
|
||||
// templateUrl: "./musicrequests.component.html",
|
||||
// })
|
||||
// export class MusicRequestsComponent implements OnInit {
|
||||
// public albumRequests: IAlbumRequest[];
|
||||
// public defaultPoster: string;
|
||||
|
||||
public searchChanged: Subject<string> = new Subject<string>();
|
||||
public searchText: string;
|
||||
// public searchChanged: Subject<string> = new Subject<string>();
|
||||
// public searchText: string;
|
||||
|
||||
public isAdmin: boolean; // Also PowerUser
|
||||
// public isAdmin: boolean; // Also PowerUser
|
||||
|
||||
@Input() public issueCategories: IIssueCategory[];
|
||||
@Input() public issuesEnabled: boolean;
|
||||
public issuesBarVisible = false;
|
||||
public issueRequest: IAlbumRequest;
|
||||
public issueProviderId: string;
|
||||
public issueCategorySelected: IIssueCategory;
|
||||
// @Input() public issueCategories: IIssueCategory[];
|
||||
// @Input() public issuesEnabled: boolean;
|
||||
// public issuesBarVisible = false;
|
||||
// public issueRequest: IAlbumRequest;
|
||||
// public issueProviderId: string;
|
||||
// public issueCategorySelected: IIssueCategory;
|
||||
|
||||
public filterDisplay: boolean;
|
||||
public filter: IFilter;
|
||||
public filterType = FilterType;
|
||||
// public filterDisplay: boolean;
|
||||
// public filter: IFilter;
|
||||
// public filterType = FilterType;
|
||||
|
||||
public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
public OrderType = OrderType;
|
||||
public denyDisplay: boolean;
|
||||
public requestToDeny: IAlbumRequest;
|
||||
public rejectionReason: string;
|
||||
// public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
// public OrderType = OrderType;
|
||||
// public denyDisplay: boolean;
|
||||
// public requestToDeny: IAlbumRequest;
|
||||
// public rejectionReason: string;
|
||||
|
||||
public totalAlbums: number = 100;
|
||||
public currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
private href: string;
|
||||
// public totalAlbums: number = 100;
|
||||
// public currentlyLoaded: number;
|
||||
// private amountToLoad: number;
|
||||
// private href: string;
|
||||
|
||||
constructor(
|
||||
private requestService: RequestService,
|
||||
private auth: AuthService,
|
||||
private notificationService: NotificationService,
|
||||
private sanitizer: DomSanitizer,
|
||||
@Inject(APP_BASE_HREF) href:string) {
|
||||
this.href = href;
|
||||
this.searchChanged.pipe(
|
||||
debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
distinctUntilChanged(), // only emit if value is different from previous value
|
||||
).subscribe(x => {
|
||||
this.searchText = x as string;
|
||||
if (this.searchText === "") {
|
||||
this.resetSearch();
|
||||
return;
|
||||
}
|
||||
this.requestService.searchAlbumRequests(this.searchText)
|
||||
.subscribe(m => {
|
||||
this.setOverrides(m);
|
||||
this.albumRequests = m;
|
||||
});
|
||||
});
|
||||
this.defaultPoster = "../../../images/default-music-placeholder.png";
|
||||
const base = this.href;
|
||||
if (base) {
|
||||
this.defaultPoster = "../../.." + base + "/images/default-music-placeholder.png";
|
||||
}
|
||||
}
|
||||
// constructor(
|
||||
// private requestService: RequestService,
|
||||
// private auth: AuthService,
|
||||
// private notificationService: NotificationService,
|
||||
// private sanitizer: DomSanitizer,
|
||||
// @Inject(APP_BASE_HREF) href:string) {
|
||||
// this.href = href;
|
||||
// this.searchChanged.pipe(
|
||||
// debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
// distinctUntilChanged(), // only emit if value is different from previous value
|
||||
// ).subscribe(x => {
|
||||
// this.searchText = x as string;
|
||||
// if (this.searchText === "") {
|
||||
// this.resetSearch();
|
||||
// return;
|
||||
// }
|
||||
// this.requestService.searchAlbumRequests(this.searchText)
|
||||
// .subscribe(m => {
|
||||
// this.setOverrides(m);
|
||||
// this.albumRequests = m;
|
||||
// });
|
||||
// });
|
||||
// this.defaultPoster = "../../../images/default-music-placeholder.png";
|
||||
// const base = this.href;
|
||||
// if (base) {
|
||||
// this.defaultPoster = "../../.." + base + "/images/default-music-placeholder.png";
|
||||
// }
|
||||
// }
|
||||
|
||||
public ngOnInit() {
|
||||
this.amountToLoad = 10;
|
||||
this.currentlyLoaded = 10;
|
||||
this.filter = {
|
||||
availabilityFilter: FilterType.None,
|
||||
statusFilter: FilterType.None,
|
||||
};
|
||||
this.loadInit();
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
}
|
||||
// public ngOnInit() {
|
||||
// this.amountToLoad = 10;
|
||||
// this.currentlyLoaded = 10;
|
||||
// this.filter = {
|
||||
// availabilityFilter: FilterType.None,
|
||||
// statusFilter: FilterType.None,
|
||||
// };
|
||||
// this.loadInit();
|
||||
// this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
// }
|
||||
|
||||
public paginate(event: IPagenator) {
|
||||
const skipAmount = event.first;
|
||||
this.loadRequests(this.amountToLoad, skipAmount);
|
||||
}
|
||||
// public paginate(event: IPagenator) {
|
||||
// const skipAmount = event.first;
|
||||
// this.loadRequests(this.amountToLoad, skipAmount);
|
||||
// }
|
||||
|
||||
public search(text: any) {
|
||||
this.searchChanged.next(text.target.value);
|
||||
}
|
||||
// public search(text: any) {
|
||||
// this.searchChanged.next(text.target.value);
|
||||
// }
|
||||
|
||||
public async removeRequest(request: IAlbumRequest) {
|
||||
await this.requestService.removeAlbumRequest(request).toPromise();
|
||||
this.removeRequestFromUi(request);
|
||||
this.loadRequests(this.amountToLoad, this.currentlyLoaded = 0);
|
||||
}
|
||||
// public async removeRequest(request: IAlbumRequest) {
|
||||
// await this.requestService.removeAlbumRequest(request).toPromise();
|
||||
// this.removeRequestFromUi(request);
|
||||
// this.loadRequests(this.amountToLoad, this.currentlyLoaded = 0);
|
||||
// }
|
||||
|
||||
public changeAvailability(request: IAlbumRequest, available: boolean) {
|
||||
request.available = available;
|
||||
// public changeAvailability(request: IAlbumRequest, available: boolean) {
|
||||
// request.available = available;
|
||||
|
||||
if (available) {
|
||||
this.requestService.markAlbumAvailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`${request.title} Is now available`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.requestService.markAlbumUnavailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`${request.title} Is now unavailable`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (available) {
|
||||
// this.requestService.markAlbumAvailable({ id: request.id }).subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `${request.title} Is now available`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// this.requestService.markAlbumUnavailable({ id: request.id }).subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `${request.title} Is now unavailable`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
public approve(request: IAlbumRequest) {
|
||||
request.approved = true;
|
||||
this.approveRequest(request);
|
||||
}
|
||||
// public approve(request: IAlbumRequest) {
|
||||
// request.approved = true;
|
||||
// this.approveRequest(request);
|
||||
// }
|
||||
|
||||
public deny(request: IAlbumRequest) {
|
||||
this.requestToDeny = request;
|
||||
this.denyDisplay = true;
|
||||
}
|
||||
// public deny(request: IAlbumRequest) {
|
||||
// this.requestToDeny = request;
|
||||
// this.denyDisplay = true;
|
||||
// }
|
||||
|
||||
public denyRequest() {
|
||||
this.requestService.denyAlbum({ id: this.requestToDeny.id, reason: this.rejectionReason })
|
||||
.subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request for ${this.requestToDeny.title} has been denied successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
this.requestToDeny.denied = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public reportIssue(catId: IIssueCategory, req: IAlbumRequest) {
|
||||
this.issueRequest = req;
|
||||
this.issueCategorySelected = catId;
|
||||
this.issuesBarVisible = true;
|
||||
this.issueProviderId = req.foreignAlbumId;
|
||||
}
|
||||
|
||||
public ignore(event: any): void {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
public clearFilter(el: any) {
|
||||
el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
el = el.parentElement;
|
||||
el = el.querySelectorAll("INPUT");
|
||||
for (el of el) {
|
||||
el.checked = false;
|
||||
el.parentElement.classList.remove("active");
|
||||
}
|
||||
|
||||
this.filterDisplay = false;
|
||||
this.filter.availabilityFilter = FilterType.None;
|
||||
this.filter.statusFilter = FilterType.None;
|
||||
|
||||
this.resetSearch();
|
||||
}
|
||||
|
||||
public filterAvailability(filter: FilterType, el: any) {
|
||||
this.filterActiveStyle(el);
|
||||
this.filter.availabilityFilter = filter;
|
||||
this.loadInit();
|
||||
}
|
||||
|
||||
public filterStatus(filter: FilterType, el: any) {
|
||||
this.filterActiveStyle(el);
|
||||
this.filter.statusFilter = filter;
|
||||
this.loadInit();
|
||||
}
|
||||
|
||||
public setOrder(value: OrderType, el: any) {
|
||||
el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
const parent = el.parentElement;
|
||||
const previousFilter = parent.querySelector(".active");
|
||||
|
||||
previousFilter.className = "";
|
||||
el.className = "active";
|
||||
|
||||
this.orderType = value;
|
||||
|
||||
this.loadInit();
|
||||
}
|
||||
|
||||
public isRequestUser(request: IAlbumRequest) {
|
||||
if (request.requestedUser.userName === this.auth.claims().name) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// public subscribe(request: IAlbumRequest) {
|
||||
// request.subscribed = true;
|
||||
// this.requestService.subscribeToMovie(request.id)
|
||||
// public denyRequest() {
|
||||
// this.requestService.denyAlbum({ id: this.requestToDeny.id, reason: this.rejectionReason })
|
||||
// .subscribe(x => {
|
||||
// this.notificationService.success("Subscribed To Movie!");
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `Request for ${this.requestToDeny.title} has been denied successfully`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
// this.requestToDeny.denied = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// public unSubscribe(request: IMovieRequests) {
|
||||
// request.subscribed = false;
|
||||
// this.requestService.unSubscribeToMovie(request.id)
|
||||
// public reportIssue(catId: IIssueCategory, req: IAlbumRequest) {
|
||||
// this.issueRequest = req;
|
||||
// this.issueCategorySelected = catId;
|
||||
// this.issuesBarVisible = true;
|
||||
// this.issueProviderId = req.foreignAlbumId;
|
||||
// }
|
||||
|
||||
// public ignore(event: any): void {
|
||||
// event.preventDefault();
|
||||
// }
|
||||
|
||||
// public clearFilter(el: any) {
|
||||
// el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
// el = el.parentElement;
|
||||
// el = el.querySelectorAll("INPUT");
|
||||
// for (el of el) {
|
||||
// el.checked = false;
|
||||
// el.parentElement.classList.remove("active");
|
||||
// }
|
||||
|
||||
// this.filterDisplay = false;
|
||||
// this.filter.availabilityFilter = FilterType.None;
|
||||
// this.filter.statusFilter = FilterType.None;
|
||||
|
||||
// this.resetSearch();
|
||||
// }
|
||||
|
||||
// public filterAvailability(filter: FilterType, el: any) {
|
||||
// this.filterActiveStyle(el);
|
||||
// this.filter.availabilityFilter = filter;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
// public filterStatus(filter: FilterType, el: any) {
|
||||
// this.filterActiveStyle(el);
|
||||
// this.filter.statusFilter = filter;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
// public setOrder(value: OrderType, el: any) {
|
||||
// el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
// const parent = el.parentElement;
|
||||
// const previousFilter = parent.querySelector(".active");
|
||||
|
||||
// previousFilter.className = "";
|
||||
// el.className = "active";
|
||||
|
||||
// this.orderType = value;
|
||||
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
// public isRequestUser(request: IAlbumRequest) {
|
||||
// if (request.requestedUser.userName === this.auth.claims().name) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // public subscribe(request: IAlbumRequest) {
|
||||
// // request.subscribed = true;
|
||||
// // this.requestService.subscribeToMovie(request.id)
|
||||
// // .subscribe(x => {
|
||||
// // this.notificationService.success("Subscribed To Movie!");
|
||||
// // });
|
||||
// // }
|
||||
|
||||
// // public unSubscribe(request: IMovieRequests) {
|
||||
// // request.subscribed = false;
|
||||
// // this.requestService.unSubscribeToMovie(request.id)
|
||||
// // .subscribe(x => {
|
||||
// // this.notificationService.success("Unsubscribed Movie!");
|
||||
// // });
|
||||
// // }
|
||||
|
||||
// private filterActiveStyle(el: any) {
|
||||
// el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
// el = el.parentElement; //gets radio div
|
||||
// el = el.parentElement; //gets form group div
|
||||
// el = el.parentElement; //gets status filter div
|
||||
// el = el.querySelectorAll("INPUT");
|
||||
// for (el of el) {
|
||||
// if (el.checked) {
|
||||
// if (!el.parentElement.classList.contains("active")) {
|
||||
// el.parentElement.className += " active";
|
||||
// }
|
||||
// } else {
|
||||
// el.parentElement.classList.remove("active");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private loadRequests(amountToLoad: number, currentlyLoaded: number) {
|
||||
// this.requestService.getAlbumRequests(amountToLoad, currentlyLoaded, this.orderType, this.filter)
|
||||
// .subscribe(x => {
|
||||
// this.notificationService.success("Unsubscribed Movie!");
|
||||
// this.setOverrides(x.collection);
|
||||
// if (!this.albumRequests) {
|
||||
// this.albumRequests = [];
|
||||
// }
|
||||
// this.albumRequests = x.collection;
|
||||
// this.totalAlbums = x.total;
|
||||
// this.currentlyLoaded = currentlyLoaded + amountToLoad;
|
||||
// });
|
||||
// }
|
||||
|
||||
private filterActiveStyle(el: any) {
|
||||
el = el.toElement || el.relatedTarget || el.target || el.srcElement;
|
||||
|
||||
el = el.parentElement; //gets radio div
|
||||
el = el.parentElement; //gets form group div
|
||||
el = el.parentElement; //gets status filter div
|
||||
el = el.querySelectorAll("INPUT");
|
||||
for (el of el) {
|
||||
if (el.checked) {
|
||||
if (!el.parentElement.classList.contains("active")) {
|
||||
el.parentElement.className += " active";
|
||||
}
|
||||
} else {
|
||||
el.parentElement.classList.remove("active");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private loadRequests(amountToLoad: number, currentlyLoaded: number) {
|
||||
this.requestService.getAlbumRequests(amountToLoad, currentlyLoaded, this.orderType, this.filter)
|
||||
.subscribe(x => {
|
||||
this.setOverrides(x.collection);
|
||||
if (!this.albumRequests) {
|
||||
this.albumRequests = [];
|
||||
}
|
||||
this.albumRequests = x.collection;
|
||||
this.totalAlbums = x.total;
|
||||
this.currentlyLoaded = currentlyLoaded + amountToLoad;
|
||||
});
|
||||
}
|
||||
|
||||
private approveRequest(request: IAlbumRequest) {
|
||||
this.requestService.approveAlbum({ id: request.id })
|
||||
.subscribe(x => {
|
||||
request.approved = true;
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request for ${request.title} has been approved successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private loadInit() {
|
||||
this.requestService.getAlbumRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
||||
.subscribe(x => {
|
||||
this.albumRequests = x.collection;
|
||||
this.totalAlbums = x.total;
|
||||
|
||||
this.setOverrides(this.albumRequests);
|
||||
|
||||
if (this.isAdmin) {
|
||||
// this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
// this.radarrProfiles = c;
|
||||
// this.albumRequests.forEach((req) => this.setQualityOverrides(req));
|
||||
// private approveRequest(request: IAlbumRequest) {
|
||||
// this.requestService.approveAlbum({ id: request.id })
|
||||
// .subscribe(x => {
|
||||
// request.approved = true;
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `Request for ${request.title} has been approved successfully`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
// this.radarrRootFolders = c;
|
||||
// this.albumRequests.forEach((req) => this.setRootFolderOverrides(req));
|
||||
// }
|
||||
|
||||
// private loadInit() {
|
||||
// this.requestService.getAlbumRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
||||
// .subscribe(x => {
|
||||
// this.albumRequests = x.collection;
|
||||
// this.totalAlbums = x.total;
|
||||
|
||||
// this.setOverrides(this.albumRequests);
|
||||
|
||||
// if (this.isAdmin) {
|
||||
// // this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
// // this.radarrProfiles = c;
|
||||
// // this.albumRequests.forEach((req) => this.setQualityOverrides(req));
|
||||
// // });
|
||||
// // this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
// // this.radarrRootFolders = c;
|
||||
// // this.albumRequests.forEach((req) => this.setRootFolderOverrides(req));
|
||||
// // });
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
private resetSearch() {
|
||||
this.currentlyLoaded = 5;
|
||||
this.loadInit();
|
||||
}
|
||||
// private resetSearch() {
|
||||
// this.currentlyLoaded = 5;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
private removeRequestFromUi(key: IAlbumRequest) {
|
||||
const index = this.albumRequests.indexOf(key, 0);
|
||||
if (index > -1) {
|
||||
this.albumRequests.splice(index, 1);
|
||||
}
|
||||
}
|
||||
// private removeRequestFromUi(key: IAlbumRequest) {
|
||||
// const index = this.albumRequests.indexOf(key, 0);
|
||||
// if (index > -1) {
|
||||
// this.albumRequests.splice(index, 1);
|
||||
// }
|
||||
// }
|
||||
|
||||
private setOverrides(requests: IAlbumRequest[]): void {
|
||||
requests.forEach((req) => {
|
||||
this.setOverride(req);
|
||||
});
|
||||
}
|
||||
|
||||
// private setQualityOverrides(req: IMovieRequests): void {
|
||||
// if (this.radarrProfiles) {
|
||||
// const profile = this.radarrProfiles.filter((p) => {
|
||||
// return p.id === req.qualityOverride;
|
||||
// private setOverrides(requests: IAlbumRequest[]): void {
|
||||
// requests.forEach((req) => {
|
||||
// this.setOverride(req);
|
||||
// });
|
||||
// if (profile.length > 0) {
|
||||
// req.qualityOverrideTitle = profile[0].name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private setRootFolderOverrides(req: IMovieRequests): void {
|
||||
// if (this.radarrRootFolders) {
|
||||
// const path = this.radarrRootFolders.filter((folder) => {
|
||||
// return folder.id === req.rootPathOverride;
|
||||
// });
|
||||
// if (path.length > 0) {
|
||||
// req.rootPathOverrideTitle = path[0].path;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private setOverride(req: IAlbumRequest): void {
|
||||
this.setAlbumBackground(req);
|
||||
// this.setQualityOverrides(req);
|
||||
// this.setRootFolderOverrides(req);
|
||||
}
|
||||
private setAlbumBackground(req: IAlbumRequest) {
|
||||
if (req.disk === null) {
|
||||
if (req.cover === null) {
|
||||
req.disk = this.defaultPoster;
|
||||
} else {
|
||||
req.disk = req.cover;
|
||||
}
|
||||
}
|
||||
req.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + req.cover + ")");
|
||||
}
|
||||
// // private setQualityOverrides(req: IMovieRequests): void {
|
||||
// // if (this.radarrProfiles) {
|
||||
// // const profile = this.radarrProfiles.filter((p) => {
|
||||
// // return p.id === req.qualityOverride;
|
||||
// // });
|
||||
// // if (profile.length > 0) {
|
||||
// // req.qualityOverrideTitle = profile[0].name;
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // private setRootFolderOverrides(req: IMovieRequests): void {
|
||||
// // if (this.radarrRootFolders) {
|
||||
// // const path = this.radarrRootFolders.filter((folder) => {
|
||||
// // return folder.id === req.rootPathOverride;
|
||||
// // });
|
||||
// // if (path.length > 0) {
|
||||
// // req.rootPathOverrideTitle = path[0].path;
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
|
||||
}
|
||||
// private setOverride(req: IAlbumRequest): void {
|
||||
// this.setAlbumBackground(req);
|
||||
// // this.setQualityOverrides(req);
|
||||
// // this.setRootFolderOverrides(req);
|
||||
// }
|
||||
// private setAlbumBackground(req: IAlbumRequest) {
|
||||
// if (req.disk === null) {
|
||||
// if (req.cover === null) {
|
||||
// req.disk = this.defaultPoster;
|
||||
// } else {
|
||||
// req.disk = req.cover;
|
||||
// }
|
||||
// }
|
||||
// req.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
// ("url(" + req.cover + ")");
|
||||
// }
|
||||
|
||||
// }
|
||||
|
|
|
@ -1,68 +1,68 @@
|
|||
import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
||||
import { RequestService } from "../services";
|
||||
// import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
||||
// import { RequestService } from "../services";
|
||||
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Observable } from "rxjs";
|
||||
// import { Component, Input, OnInit } from "@angular/core";
|
||||
// import { Observable } from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: "remaining-requests",
|
||||
templateUrl: "./remainingrequests.component.html",
|
||||
})
|
||||
// @Component({
|
||||
// selector: "remaining-requests",
|
||||
// templateUrl: "./remainingrequests.component.html",
|
||||
// })
|
||||
|
||||
export class RemainingRequestsComponent implements OnInit {
|
||||
public remaining: IRemainingRequests;
|
||||
@Input() public movie: boolean;
|
||||
@Input() public tv: boolean;
|
||||
@Input() public music: boolean;
|
||||
public daysUntil: number;
|
||||
public hoursUntil: number;
|
||||
public minutesUntil: number;
|
||||
@Input() public quotaRefreshEvents: Observable<void>;
|
||||
// export class RemainingRequestsComponent implements OnInit {
|
||||
// public remaining: IRemainingRequests;
|
||||
// @Input() public movie: boolean;
|
||||
// @Input() public tv: boolean;
|
||||
// @Input() public music: boolean;
|
||||
// public daysUntil: number;
|
||||
// public hoursUntil: number;
|
||||
// public minutesUntil: number;
|
||||
// @Input() public quotaRefreshEvents: Observable<void>;
|
||||
|
||||
constructor(private requestService: RequestService) {
|
||||
}
|
||||
// constructor(private requestService: RequestService) {
|
||||
// }
|
||||
|
||||
public ngOnInit() {
|
||||
this.update();
|
||||
// public ngOnInit() {
|
||||
// this.update();
|
||||
|
||||
this.quotaRefreshEvents.subscribe(() => {
|
||||
this.update();
|
||||
});
|
||||
}
|
||||
// this.quotaRefreshEvents.subscribe(() => {
|
||||
// this.update();
|
||||
// });
|
||||
// }
|
||||
|
||||
public update(): void {
|
||||
const callback = (remaining => {
|
||||
this.remaining = remaining;
|
||||
if(this.remaining) {
|
||||
this.calculateTime();
|
||||
}
|
||||
});
|
||||
if (this.movie) {
|
||||
this.requestService.getRemainingMovieRequests().subscribe(callback);
|
||||
}
|
||||
if(this.tv) {
|
||||
this.requestService.getRemainingTvRequests().subscribe(callback);
|
||||
}
|
||||
if(this.music) {
|
||||
this.requestService.getRemainingMusicRequests().subscribe(callback);
|
||||
}
|
||||
}
|
||||
// public update(): void {
|
||||
// const callback = (remaining => {
|
||||
// this.remaining = remaining;
|
||||
// if(this.remaining) {
|
||||
// this.calculateTime();
|
||||
// }
|
||||
// });
|
||||
// if (this.movie) {
|
||||
// this.requestService.getRemainingMovieRequests().subscribe(callback);
|
||||
// }
|
||||
// if(this.tv) {
|
||||
// this.requestService.getRemainingTvRequests().subscribe(callback);
|
||||
// }
|
||||
// if(this.music) {
|
||||
// this.requestService.getRemainingMusicRequests().subscribe(callback);
|
||||
// }
|
||||
// }
|
||||
|
||||
private calculateTime(): void {
|
||||
this.daysUntil = Math.ceil(this.daysUntilNextRequest());
|
||||
this.hoursUntil = Math.ceil(this.hoursUntilNextRequest());
|
||||
this.minutesUntil = Math.ceil(this.minutesUntilNextRequest());
|
||||
}
|
||||
// private calculateTime(): void {
|
||||
// this.daysUntil = Math.ceil(this.daysUntilNextRequest());
|
||||
// this.hoursUntil = Math.ceil(this.hoursUntilNextRequest());
|
||||
// this.minutesUntil = Math.ceil(this.minutesUntilNextRequest());
|
||||
// }
|
||||
|
||||
private daysUntilNextRequest(): number {
|
||||
return (new Date(this.remaining.nextRequest).getTime() - new Date().getTime()) / 1000 / 60 / 60 / 24;
|
||||
}
|
||||
// private daysUntilNextRequest(): number {
|
||||
// return (new Date(this.remaining.nextRequest).getTime() - new Date().getTime()) / 1000 / 60 / 60 / 24;
|
||||
// }
|
||||
|
||||
private hoursUntilNextRequest(): number {
|
||||
return (new Date(this.remaining.nextRequest).getTime() - new Date().getTime()) / 1000 / 60 / 60;
|
||||
}
|
||||
// private hoursUntilNextRequest(): number {
|
||||
// return (new Date(this.remaining.nextRequest).getTime() - new Date().getTime()) / 1000 / 60 / 60;
|
||||
// }
|
||||
|
||||
private minutesUntilNextRequest(): number {
|
||||
return (new Date(this.remaining.nextRequest).getTime() - new Date().getTime()) / 1000 / 60;
|
||||
}
|
||||
}
|
||||
// private minutesUntilNextRequest(): number {
|
||||
// return (new Date(this.remaining.nextRequest).getTime() - new Date().getTime()) / 1000 / 60;
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -2,15 +2,11 @@
|
|||
import { FormsModule } from "@angular/forms";
|
||||
import { RouterModule } from "@angular/router";
|
||||
|
||||
import { SidebarModule, TooltipModule, TreeTableModule } from "primeng/primeng";
|
||||
import { RequestService } from "../services";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
TreeTableModule,
|
||||
SidebarModule,
|
||||
TooltipModule,
|
||||
FormsModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
// import { Component, OnInit } from "@angular/core";
|
||||
|
||||
import { IIssueCategory } from "../interfaces";
|
||||
import { IssuesService, SettingsService } from "../services";
|
||||
// import { IIssueCategory } from "../interfaces";
|
||||
// import { IssuesService, SettingsService } from "../services";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./request.component.html",
|
||||
})
|
||||
export class RequestComponent implements OnInit {
|
||||
// @Component({
|
||||
// templateUrl: "./request.component.html",
|
||||
// })
|
||||
// export class RequestComponent implements OnInit {
|
||||
|
||||
public showMovie = true;
|
||||
public showTv = false;
|
||||
public showAlbums = false;
|
||||
// public showMovie = true;
|
||||
// public showTv = false;
|
||||
// public showAlbums = false;
|
||||
|
||||
public issueCategories: IIssueCategory[];
|
||||
public issuesEnabled = false;
|
||||
public musicEnabled: boolean;
|
||||
// public issueCategories: IIssueCategory[];
|
||||
// public issuesEnabled = false;
|
||||
// public musicEnabled: boolean;
|
||||
|
||||
constructor(private issuesService: IssuesService,
|
||||
private settingsService: SettingsService) {
|
||||
// constructor(private issuesService: IssuesService,
|
||||
// private settingsService: SettingsService) {
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.issuesService.getCategories().subscribe(x => this.issueCategories = x);
|
||||
this.settingsService.lidarrEnabled().subscribe(x => this.musicEnabled = x);
|
||||
this.settingsService.getIssueSettings().subscribe(x => this.issuesEnabled = x.enabled);
|
||||
}
|
||||
// public ngOnInit(): void {
|
||||
// this.issuesService.getCategories().subscribe(x => this.issueCategories = x);
|
||||
// this.settingsService.lidarrEnabled().subscribe(x => this.musicEnabled = x);
|
||||
// this.settingsService.getIssueSettings().subscribe(x => this.issuesEnabled = x.enabled);
|
||||
// }
|
||||
|
||||
public selectMovieTab() {
|
||||
this.showMovie = true;
|
||||
this.showTv = false;
|
||||
this.showAlbums = false;
|
||||
}
|
||||
// public selectMovieTab() {
|
||||
// this.showMovie = true;
|
||||
// this.showTv = false;
|
||||
// this.showAlbums = false;
|
||||
// }
|
||||
|
||||
public selectTvTab() {
|
||||
this.showMovie = false;
|
||||
this.showTv = true;
|
||||
this.showAlbums = false;
|
||||
}
|
||||
// public selectTvTab() {
|
||||
// this.showMovie = false;
|
||||
// this.showTv = true;
|
||||
// this.showAlbums = false;
|
||||
// }
|
||||
|
||||
public selectMusicTab() {
|
||||
this.showMovie = false;
|
||||
this.showTv = false;
|
||||
this.showAlbums = true;
|
||||
}
|
||||
}
|
||||
// public selectMusicTab() {
|
||||
// this.showMovie = false;
|
||||
// this.showTv = false;
|
||||
// this.showAlbums = true;
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -1,57 +1,49 @@
|
|||
import { NgModule } from "@angular/core";
|
||||
import { RouterModule, Routes } from "@angular/router";
|
||||
import { OrderModule } from "ngx-order-pipe";
|
||||
// import { NgModule } from "@angular/core";
|
||||
// import { RouterModule, Routes } from "@angular/router";
|
||||
// import { OrderModule } from "ngx-order-pipe";
|
||||
|
||||
import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
||||
// import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
||||
|
||||
import { ButtonModule, DialogModule, PaginatorModule } from "primeng/primeng";
|
||||
import { MovieRequestsComponent } from "./movierequests.component";
|
||||
import { MusicRequestsComponent } from "./music/musicrequests.component";
|
||||
// Request
|
||||
import { RequestComponent } from "./request.component";
|
||||
import { TvRequestChildrenComponent } from "./tvrequest-children.component";
|
||||
import { TvRequestsComponent } from "./tvrequests.component";
|
||||
// import { MovieRequestsComponent } from "./movierequests.component";
|
||||
// import { MusicRequestsComponent } from "./music/musicrequests.component";
|
||||
// // Request
|
||||
// import { RequestComponent } from "./request.component";
|
||||
// import { TvRequestChildrenComponent } from "./tvrequest-children.component";
|
||||
// import { TvRequestsComponent } from "./tvrequests.component";
|
||||
|
||||
import { SidebarModule, TooltipModule, TreeTableModule } from "primeng/primeng";
|
||||
|
||||
import { IdentityService, RadarrService, RequestService, SonarrService } from "../services";
|
||||
// import { IdentityService, RadarrService, RequestService, SonarrService } from "../services";
|
||||
|
||||
import { AuthGuard } from "../auth/auth.guard";
|
||||
// import { AuthGuard } from "../auth/auth.guard";
|
||||
|
||||
import { SharedModule } from "../shared/shared.module";
|
||||
// import { SharedModule } from "../shared/shared.module";
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: "", component: RequestComponent, canActivate: [AuthGuard] },
|
||||
];
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild(routes),
|
||||
InfiniteScrollModule,
|
||||
ButtonModule,
|
||||
DialogModule,
|
||||
TreeTableModule,
|
||||
SharedModule,
|
||||
SidebarModule,
|
||||
OrderModule,
|
||||
PaginatorModule,
|
||||
TooltipModule,
|
||||
],
|
||||
declarations: [
|
||||
RequestComponent,
|
||||
MovieRequestsComponent,
|
||||
TvRequestsComponent,
|
||||
TvRequestChildrenComponent,
|
||||
MusicRequestsComponent,
|
||||
],
|
||||
exports: [
|
||||
RouterModule,
|
||||
],
|
||||
providers: [
|
||||
IdentityService,
|
||||
RequestService,
|
||||
RadarrService,
|
||||
SonarrService,
|
||||
],
|
||||
// const routes: Routes = [
|
||||
// { path: "", component: RequestComponent, canActivate: [AuthGuard] },
|
||||
// ];
|
||||
// @NgModule({
|
||||
// imports: [
|
||||
// RouterModule.forChild(routes),
|
||||
// InfiniteScrollModule,
|
||||
// SharedModule,
|
||||
// OrderModule,
|
||||
// ],
|
||||
// declarations: [
|
||||
// RequestComponent,
|
||||
// MovieRequestsComponent,
|
||||
// TvRequestsComponent,
|
||||
// TvRequestChildrenComponent,
|
||||
// MusicRequestsComponent,
|
||||
// ],
|
||||
// exports: [
|
||||
// RouterModule,
|
||||
// ],
|
||||
// providers: [
|
||||
// IdentityService,
|
||||
// RequestService,
|
||||
// RadarrService,
|
||||
// SonarrService,
|
||||
// ],
|
||||
|
||||
})
|
||||
export class RequestsModule { }
|
||||
// })
|
||||
// export class RequestsModule { }
|
||||
|
|
|
@ -1,138 +1,138 @@
|
|||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||
import { IChildRequests } from "../interfaces";
|
||||
// import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||
// import { IChildRequests } from "../interfaces";
|
||||
|
||||
import { NotificationService, RequestService } from "../services";
|
||||
// import { NotificationService, RequestService } from "../services";
|
||||
|
||||
@Component({
|
||||
selector: "tvrequests-children",
|
||||
templateUrl: "./tvrequest-children.component.html",
|
||||
})
|
||||
export class TvRequestChildrenComponent {
|
||||
@Input() public childRequests: IChildRequests[];
|
||||
@Input() public isAdmin: boolean;
|
||||
@Input() public currentUser: string;
|
||||
// @Component({
|
||||
// selector: "tvrequests-children",
|
||||
// templateUrl: "./tvrequest-children.component.html",
|
||||
// })
|
||||
// export class TvRequestChildrenComponent {
|
||||
// @Input() public childRequests: IChildRequests[];
|
||||
// @Input() public isAdmin: boolean;
|
||||
// @Input() public currentUser: string;
|
||||
|
||||
public denyDisplay: boolean;
|
||||
public requestToDeny: IChildRequests;
|
||||
public rejectionReason: string;
|
||||
// public denyDisplay: boolean;
|
||||
// public requestToDeny: IChildRequests;
|
||||
// public rejectionReason: string;
|
||||
|
||||
@Output() public requestDeleted = new EventEmitter<number>();
|
||||
// @Output() public requestDeleted = new EventEmitter<number>();
|
||||
|
||||
constructor(private requestService: RequestService,
|
||||
private notificationService: NotificationService) { }
|
||||
// constructor(private requestService: RequestService,
|
||||
// private notificationService: NotificationService) { }
|
||||
|
||||
public removeRequest(request: IChildRequests) {
|
||||
this.requestService.deleteChild(request.id)
|
||||
.subscribe(x => {
|
||||
this.removeRequestFromUi(request);
|
||||
this.requestDeleted.emit(request.id);
|
||||
});
|
||||
}
|
||||
// public removeRequest(request: IChildRequests) {
|
||||
// this.requestService.deleteChild(request.id)
|
||||
// .subscribe(x => {
|
||||
// this.removeRequestFromUi(request);
|
||||
// this.requestDeleted.emit(request.id);
|
||||
// });
|
||||
// }
|
||||
|
||||
public changeAvailability(request: IChildRequests, available: boolean) {
|
||||
request.available = available;
|
||||
request.seasonRequests.forEach((season) => {
|
||||
season.episodes.forEach((ep) => {
|
||||
ep.available = available;
|
||||
});
|
||||
});
|
||||
if (available) {
|
||||
this.requestService.markTvAvailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`This request is now available`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.requestService.markTvUnavailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`This request is now unavailable`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// public changeAvailability(request: IChildRequests, available: boolean) {
|
||||
// request.available = available;
|
||||
// request.seasonRequests.forEach((season) => {
|
||||
// season.episodes.forEach((ep) => {
|
||||
// ep.available = available;
|
||||
// });
|
||||
// });
|
||||
// if (available) {
|
||||
// this.requestService.markTvAvailable({ id: request.id }).subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `This request is now available`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// this.requestService.markTvUnavailable({ id: request.id }).subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `This request is now unavailable`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Available", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
public deny(request: IChildRequests) {
|
||||
request.denied = true;
|
||||
this.requestToDeny = request;
|
||||
this.denyDisplay = true;
|
||||
// public deny(request: IChildRequests) {
|
||||
// request.denied = true;
|
||||
// this.requestToDeny = request;
|
||||
// this.denyDisplay = true;
|
||||
|
||||
request.seasonRequests.forEach((season) => {
|
||||
season.episodes.forEach((ep) => {
|
||||
ep.approved = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
// request.seasonRequests.forEach((season) => {
|
||||
// season.episodes.forEach((ep) => {
|
||||
// ep.approved = false;
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
public denyRequest() {
|
||||
this.requestService.denyChild({ id: this.requestToDeny.id, reason: this.rejectionReason })
|
||||
.subscribe(x => {
|
||||
this.denyDisplay = false;
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request has been denied successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
this.requestToDeny.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// public denyRequest() {
|
||||
// this.requestService.denyChild({ id: this.requestToDeny.id, reason: this.rejectionReason })
|
||||
// .subscribe(x => {
|
||||
// this.denyDisplay = false;
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `Request has been denied successfully`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
// this.requestToDeny.approved = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public approve(request: IChildRequests) {
|
||||
request.approved = true;
|
||||
request.denied = false;
|
||||
request.seasonRequests.forEach((season) => {
|
||||
season.episodes.forEach((ep) => {
|
||||
ep.approved = true;
|
||||
});
|
||||
});
|
||||
this.requestService.approveChild({ id: request.id })
|
||||
.subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request has been approved successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// public approve(request: IChildRequests) {
|
||||
// request.approved = true;
|
||||
// request.denied = false;
|
||||
// request.seasonRequests.forEach((season) => {
|
||||
// season.episodes.forEach((ep) => {
|
||||
// ep.approved = true;
|
||||
// });
|
||||
// });
|
||||
// this.requestService.approveChild({ id: request.id })
|
||||
// .subscribe(x => {
|
||||
// if (x.result) {
|
||||
// this.notificationService.success(
|
||||
// `Request has been approved successfully`);
|
||||
// } else {
|
||||
// this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage);
|
||||
// request.approved = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public subscribe(request: IChildRequests) {
|
||||
request.subscribed = true;
|
||||
this.requestService.subscribeToTv(request.id)
|
||||
.subscribe(x => {
|
||||
this.notificationService.success("Subscribed To TV Show!");
|
||||
});
|
||||
}
|
||||
// public subscribe(request: IChildRequests) {
|
||||
// request.subscribed = true;
|
||||
// this.requestService.subscribeToTv(request.id)
|
||||
// .subscribe(x => {
|
||||
// this.notificationService.success("Subscribed To TV Show!");
|
||||
// });
|
||||
// }
|
||||
|
||||
public unSubscribe(request: IChildRequests) {
|
||||
request.subscribed = false;
|
||||
this.requestService.unSubscribeToTv(request.id)
|
||||
.subscribe(x => {
|
||||
this.notificationService.success("Unsubscribed TV Show!");
|
||||
});
|
||||
}
|
||||
// public unSubscribe(request: IChildRequests) {
|
||||
// request.subscribed = false;
|
||||
// this.requestService.unSubscribeToTv(request.id)
|
||||
// .subscribe(x => {
|
||||
// this.notificationService.success("Unsubscribed TV Show!");
|
||||
// });
|
||||
// }
|
||||
|
||||
public isRequestUser(request: IChildRequests) {
|
||||
if (request.requestedUser.userName === this.currentUser) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// public isRequestUser(request: IChildRequests) {
|
||||
// if (request.requestedUser.userName === this.currentUser) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
private removeRequestFromUi(key: IChildRequests) {
|
||||
const index = this.childRequests.indexOf(key, 0);
|
||||
if (index > -1) {
|
||||
this.childRequests.splice(index, 1);
|
||||
}
|
||||
}
|
||||
// private removeRequestFromUi(key: IChildRequests) {
|
||||
// const index = this.childRequests.indexOf(key, 0);
|
||||
// if (index > -1) {
|
||||
// this.childRequests.splice(index, 1);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
|
|
@ -83,8 +83,7 @@
|
|||
|
||||
</div>
|
||||
<div class="dropdown" *ngIf="issueCategories && issuesEnabled" id="issueBtn">
|
||||
<button class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
|
||||
aria-expanded="true">
|
||||
<button class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-plus"></i> {{ 'Requests.ReportIssue' | translate }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
|
@ -110,5 +109,4 @@
|
|||
<p-paginator [rows]="10" [totalRecords]="totalTv" (onPageChange)="paginate($event)"></p-paginator>
|
||||
</div>
|
||||
|
||||
<issue-report [movie]="false" [visible]="issuesBarVisible" [title]="issueRequest?.title" [issueCategory]="issueCategorySelected"
|
||||
[id]="issueRequest?.id" [providerId]="issueProviderId" (visibleChange)="issuesBarVisible = $event;"></issue-report>
|
||||
<issue-report [movie]="false" [visible]="issuesBarVisible" [title]="issueRequest?.title" [issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId" (visibleChange)="issuesBarVisible = $event;"></issue-report>
|
|
@ -1,226 +1,226 @@
|
|||
import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
import { Component, Input, OnInit, Inject } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { Subject } from "rxjs";
|
||||
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
// import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
// import { Component, Input, OnInit, Inject } from "@angular/core";
|
||||
// import { DomSanitizer } from "@angular/platform-browser";
|
||||
// import { Subject } from "rxjs";
|
||||
// import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
|
||||
import { AuthService } from "../auth/auth.service";
|
||||
import { FilterType, IIssueCategory, IPagenator, IRequestsViewModel, ISonarrProfile, ISonarrRootFolder, ITvRequests, OrderType } from "../interfaces";
|
||||
import { NotificationService, RequestService, SonarrService } from "../services";
|
||||
import { ImageService } from "../services/image.service";
|
||||
// import { AuthService } from "../auth/auth.service";
|
||||
// import { FilterType, IIssueCategory, IPagenator, IRequestsViewModel, ISonarrProfile, ISonarrRootFolder, ITvRequests, OrderType } from "../interfaces";
|
||||
// import { NotificationService, RequestService, SonarrService } from "../services";
|
||||
// import { ImageService } from "../services/image.service";
|
||||
|
||||
@Component({
|
||||
selector: "tv-requests",
|
||||
templateUrl: "./tvrequests.component.html",
|
||||
styleUrls: ["./tvrequests.component.scss"],
|
||||
})
|
||||
export class TvRequestsComponent implements OnInit {
|
||||
// @Component({
|
||||
// selector: "tv-requests",
|
||||
// templateUrl: "./tvrequests.component.html",
|
||||
// styleUrls: ["./tvrequests.component.scss"],
|
||||
// })
|
||||
// export class TvRequestsComponent implements OnInit {
|
||||
|
||||
public tvRequests: IRequestsViewModel<ITvRequests>;
|
||||
public searchChanged = new Subject<string>();
|
||||
public searchText: string;
|
||||
public isAdmin: boolean;
|
||||
public currentUser: string;
|
||||
public showChildDialogue = false; // This is for the child modal popup
|
||||
public selectedSeason: ITvRequests;
|
||||
public defaultPoster: string;
|
||||
// public tvRequests: IRequestsViewModel<ITvRequests>;
|
||||
// public searchChanged = new Subject<string>();
|
||||
// public searchText: string;
|
||||
// public isAdmin: boolean;
|
||||
// public currentUser: string;
|
||||
// public showChildDialogue = false; // This is for the child modal popup
|
||||
// public selectedSeason: ITvRequests;
|
||||
// public defaultPoster: string;
|
||||
|
||||
@Input() public issueCategories: IIssueCategory[];
|
||||
@Input() public issuesEnabled: boolean;
|
||||
public issueProviderId: string;
|
||||
public issuesBarVisible = false;
|
||||
public issueRequest: ITvRequests;
|
||||
public issueCategorySelected: IIssueCategory;
|
||||
// @Input() public issueCategories: IIssueCategory[];
|
||||
// @Input() public issuesEnabled: boolean;
|
||||
// public issueProviderId: string;
|
||||
// public issuesBarVisible = false;
|
||||
// public issueRequest: ITvRequests;
|
||||
// public issueCategorySelected: IIssueCategory;
|
||||
|
||||
public sonarrProfiles: ISonarrProfile[] = [];
|
||||
public sonarrRootFolders: ISonarrRootFolder[] = [];
|
||||
// public sonarrProfiles: ISonarrProfile[] = [];
|
||||
// public sonarrRootFolders: ISonarrRootFolder[] = [];
|
||||
|
||||
public totalTv: number = 100;
|
||||
private currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
private href: string;
|
||||
// public totalTv: number = 100;
|
||||
// private currentlyLoaded: number;
|
||||
// private amountToLoad: number;
|
||||
// private href: string;
|
||||
|
||||
constructor(
|
||||
private requestService: RequestService,
|
||||
private auth: AuthService,
|
||||
private sanitizer: DomSanitizer,
|
||||
private imageService: ImageService,
|
||||
private sonarrService: SonarrService,
|
||||
private notificationService: NotificationService,
|
||||
@Inject(APP_BASE_HREF) href:string) {
|
||||
this.href= href;
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
this.currentUser = this.auth.claims().name;
|
||||
if (this.isAdmin) {
|
||||
this.sonarrService.getQualityProfilesWithoutSettings()
|
||||
.subscribe(x => this.sonarrProfiles = x);
|
||||
// constructor(
|
||||
// private requestService: RequestService,
|
||||
// private auth: AuthService,
|
||||
// private sanitizer: DomSanitizer,
|
||||
// private imageService: ImageService,
|
||||
// private sonarrService: SonarrService,
|
||||
// private notificationService: NotificationService,
|
||||
// @Inject(APP_BASE_HREF) href:string) {
|
||||
// this.href= href;
|
||||
// this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
// this.currentUser = this.auth.claims().name;
|
||||
// if (this.isAdmin) {
|
||||
// this.sonarrService.getQualityProfilesWithoutSettings()
|
||||
// .subscribe(x => this.sonarrProfiles = x);
|
||||
|
||||
this.sonarrService.getRootFoldersWithoutSettings()
|
||||
.subscribe(x => this.sonarrRootFolders = x);
|
||||
}
|
||||
}
|
||||
// this.sonarrService.getRootFoldersWithoutSettings()
|
||||
// .subscribe(x => this.sonarrRootFolders = x);
|
||||
// }
|
||||
// }
|
||||
|
||||
public openClosestTab(node: ITvRequests,el: any) {
|
||||
el.preventDefault();
|
||||
node.open = !node.open;
|
||||
}
|
||||
// public openClosestTab(node: ITvRequests,el: any) {
|
||||
// el.preventDefault();
|
||||
// node.open = !node.open;
|
||||
// }
|
||||
|
||||
public ngOnInit() {
|
||||
this.amountToLoad = 10;
|
||||
this.currentlyLoaded = 10;
|
||||
this.tvRequests = {collection:[], total:0};
|
||||
// public ngOnInit() {
|
||||
// this.amountToLoad = 10;
|
||||
// this.currentlyLoaded = 10;
|
||||
// this.tvRequests = {collection:[], total:0};
|
||||
|
||||
this.searchChanged.pipe(
|
||||
debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
distinctUntilChanged(), // only emit if value is different from previous value
|
||||
).subscribe(x => {
|
||||
this.searchText = x as string;
|
||||
if (this.searchText === "") {
|
||||
this.resetSearch();
|
||||
return;
|
||||
}
|
||||
this.requestService.searchTvRequests(this.searchText)
|
||||
.subscribe(m => {
|
||||
this.tvRequests.collection = m;
|
||||
this.tvRequests.collection.forEach((val) => this.loadBackdrop(val));
|
||||
this.tvRequests.collection.forEach((val) => this.setOverride(val));
|
||||
});
|
||||
});
|
||||
this.defaultPoster = "../../../images/default_tv_poster.png";
|
||||
const base = this.href;
|
||||
if (base) {
|
||||
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
|
||||
}
|
||||
// this.searchChanged.pipe(
|
||||
// debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
// distinctUntilChanged(), // only emit if value is different from previous value
|
||||
// ).subscribe(x => {
|
||||
// this.searchText = x as string;
|
||||
// if (this.searchText === "") {
|
||||
// this.resetSearch();
|
||||
// return;
|
||||
// }
|
||||
// this.requestService.searchTvRequests(this.searchText)
|
||||
// .subscribe(m => {
|
||||
// this.tvRequests.collection = m;
|
||||
// this.tvRequests.collection.forEach((val) => this.loadBackdrop(val));
|
||||
// this.tvRequests.collection.forEach((val) => this.setOverride(val));
|
||||
// });
|
||||
// });
|
||||
// this.defaultPoster = "../../../images/default_tv_poster.png";
|
||||
// const base = this.href;
|
||||
// if (base) {
|
||||
// this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
|
||||
// }
|
||||
|
||||
this.loadInit();
|
||||
}
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
public paginate(event: IPagenator) {
|
||||
const skipAmount = event.first;
|
||||
// public paginate(event: IPagenator) {
|
||||
// const skipAmount = event.first;
|
||||
|
||||
this.requestService.getTvRequests(this.amountToLoad, skipAmount, OrderType.RequestedDateDesc, FilterType.None, FilterType.None)
|
||||
.subscribe(x => {
|
||||
this.tvRequests = x;
|
||||
this.currentlyLoaded = this.currentlyLoaded + this.amountToLoad;
|
||||
});
|
||||
}
|
||||
// this.requestService.getTvRequests(this.amountToLoad, skipAmount, OrderType.RequestedDateDesc, FilterType.None, FilterType.None)
|
||||
// .subscribe(x => {
|
||||
// this.tvRequests = x;
|
||||
// this.currentlyLoaded = this.currentlyLoaded + this.amountToLoad;
|
||||
// });
|
||||
// }
|
||||
|
||||
public search(text: any) {
|
||||
this.searchChanged.next(text.target.value);
|
||||
}
|
||||
// public search(text: any) {
|
||||
// this.searchChanged.next(text.target.value);
|
||||
// }
|
||||
|
||||
public showChildren(request: ITvRequests) {
|
||||
this.selectedSeason = request;
|
||||
this.showChildDialogue = true;
|
||||
}
|
||||
// public showChildren(request: ITvRequests) {
|
||||
// this.selectedSeason = request;
|
||||
// this.showChildDialogue = true;
|
||||
// }
|
||||
|
||||
public childRequestDeleted(childId: number): void {
|
||||
// Refresh the UI, hackly way around reloading the data
|
||||
this.ngOnInit();
|
||||
}
|
||||
// public childRequestDeleted(childId: number): void {
|
||||
// // Refresh the UI, hackly way around reloading the data
|
||||
// this.ngOnInit();
|
||||
// }
|
||||
|
||||
public selectRootFolder(searchResult: ITvRequests, rootFolderSelected: ISonarrRootFolder, event: any) {
|
||||
event.preventDefault();
|
||||
searchResult.rootFolder = rootFolderSelected.id;
|
||||
this.setOverride(searchResult);
|
||||
this.setRootFolder(searchResult);
|
||||
}
|
||||
// public selectRootFolder(searchResult: ITvRequests, rootFolderSelected: ISonarrRootFolder, event: any) {
|
||||
// event.preventDefault();
|
||||
// searchResult.rootFolder = rootFolderSelected.id;
|
||||
// this.setOverride(searchResult);
|
||||
// this.setRootFolder(searchResult);
|
||||
// }
|
||||
|
||||
public selectQualityProfile(searchResult: ITvRequests, profileSelected: ISonarrProfile, event: any) {
|
||||
event.preventDefault();
|
||||
searchResult.qualityOverride = profileSelected.id;
|
||||
this.setOverride(searchResult);
|
||||
this.setQualityProfile(searchResult);
|
||||
}
|
||||
// public selectQualityProfile(searchResult: ITvRequests, profileSelected: ISonarrProfile, event: any) {
|
||||
// event.preventDefault();
|
||||
// searchResult.qualityOverride = profileSelected.id;
|
||||
// this.setOverride(searchResult);
|
||||
// this.setQualityProfile(searchResult);
|
||||
// }
|
||||
|
||||
public reportIssue(catId: IIssueCategory, req: ITvRequests) {
|
||||
this.issueRequest = req;
|
||||
this.issueCategorySelected = catId;
|
||||
this.issuesBarVisible = true;
|
||||
this.issueProviderId = req.id.toString();
|
||||
}
|
||||
// public reportIssue(catId: IIssueCategory, req: ITvRequests) {
|
||||
// this.issueRequest = req;
|
||||
// this.issueCategorySelected = catId;
|
||||
// this.issuesBarVisible = true;
|
||||
// this.issueProviderId = req.id.toString();
|
||||
// }
|
||||
|
||||
private setOverride(req: ITvRequests): void {
|
||||
this.setQualityOverrides(req);
|
||||
this.setRootFolderOverrides(req);
|
||||
}
|
||||
// private setOverride(req: ITvRequests): void {
|
||||
// this.setQualityOverrides(req);
|
||||
// this.setRootFolderOverrides(req);
|
||||
// }
|
||||
|
||||
private setQualityProfile(req: ITvRequests) {
|
||||
this.requestService.setQualityProfile(req.id, req.qualityOverride).subscribe(x => {
|
||||
if(x) {
|
||||
this.notificationService.success("Quality profile updated");
|
||||
} else {
|
||||
this.notificationService.error("Could not update the quality profile");
|
||||
}
|
||||
});
|
||||
}
|
||||
// private setQualityProfile(req: ITvRequests) {
|
||||
// this.requestService.setQualityProfile(req.id, req.qualityOverride).subscribe(x => {
|
||||
// if(x) {
|
||||
// this.notificationService.success("Quality profile updated");
|
||||
// } else {
|
||||
// this.notificationService.error("Could not update the quality profile");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
private setRootFolder(req: ITvRequests) {
|
||||
this.requestService.setRootFolder(req.id, req.rootFolder).subscribe(x => {
|
||||
if(x) {
|
||||
this.notificationService.success("Quality profile updated");
|
||||
} else {
|
||||
this.notificationService.error("Could not update the quality profile");
|
||||
}
|
||||
});
|
||||
}
|
||||
// private setRootFolder(req: ITvRequests) {
|
||||
// this.requestService.setRootFolder(req.id, req.rootFolder).subscribe(x => {
|
||||
// if(x) {
|
||||
// this.notificationService.success("Quality profile updated");
|
||||
// } else {
|
||||
// this.notificationService.error("Could not update the quality profile");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
private setQualityOverrides(req: ITvRequests): void {
|
||||
if (this.sonarrProfiles) {
|
||||
const profile = this.sonarrProfiles.filter((p) => {
|
||||
return p.id === req.qualityOverride;
|
||||
});
|
||||
if (profile.length > 0) {
|
||||
req.qualityOverrideTitle = profile[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
private setRootFolderOverrides(req: ITvRequests): void {
|
||||
if (this.sonarrRootFolders) {
|
||||
const path = this.sonarrRootFolders.filter((folder) => {
|
||||
return folder.id === req.rootFolder;
|
||||
});
|
||||
if (path.length > 0) {
|
||||
req.rootPathOverrideTitle = path[0].path;
|
||||
}
|
||||
}
|
||||
}
|
||||
// private setQualityOverrides(req: ITvRequests): void {
|
||||
// if (this.sonarrProfiles) {
|
||||
// const profile = this.sonarrProfiles.filter((p) => {
|
||||
// return p.id === req.qualityOverride;
|
||||
// });
|
||||
// if (profile.length > 0) {
|
||||
// req.qualityOverrideTitle = profile[0].name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private setRootFolderOverrides(req: ITvRequests): void {
|
||||
// if (this.sonarrRootFolders) {
|
||||
// const path = this.sonarrRootFolders.filter((folder) => {
|
||||
// return folder.id === req.rootFolder;
|
||||
// });
|
||||
// if (path.length > 0) {
|
||||
// req.rootPathOverrideTitle = path[0].path;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private loadInit() {
|
||||
this.requestService.getTotalTv().subscribe(x => this.totalTv = x);
|
||||
this.requestService.getTvRequests(this.amountToLoad, 0, OrderType.RequestedDateDesc, FilterType.None, FilterType.None)
|
||||
.subscribe(x => {
|
||||
this.tvRequests = x;
|
||||
this.tvRequests.collection.forEach((val, index) => {
|
||||
this.setDefaults(val);
|
||||
this.loadBackdrop(val);
|
||||
this.setOverride(val);
|
||||
});
|
||||
});
|
||||
}
|
||||
// private loadInit() {
|
||||
// this.requestService.getTotalTv().subscribe(x => this.totalTv = x);
|
||||
// this.requestService.getTvRequests(this.amountToLoad, 0, OrderType.RequestedDateDesc, FilterType.None, FilterType.None)
|
||||
// .subscribe(x => {
|
||||
// this.tvRequests = x;
|
||||
// this.tvRequests.collection.forEach((val, index) => {
|
||||
// this.setDefaults(val);
|
||||
// this.loadBackdrop(val);
|
||||
// this.setOverride(val);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
private resetSearch() {
|
||||
this.currentlyLoaded = 5;
|
||||
this.loadInit();
|
||||
}
|
||||
// private resetSearch() {
|
||||
// this.currentlyLoaded = 5;
|
||||
// this.loadInit();
|
||||
// }
|
||||
|
||||
private setDefaults(val: ITvRequests) {
|
||||
if (val.posterPath === null) {
|
||||
val.posterPath = this.defaultPoster;
|
||||
}
|
||||
}
|
||||
// private setDefaults(val: ITvRequests) {
|
||||
// if (val.posterPath === null) {
|
||||
// val.posterPath = this.defaultPoster;
|
||||
// }
|
||||
// }
|
||||
|
||||
private loadBackdrop(val: ITvRequests): void {
|
||||
if (val.background != null) {
|
||||
val.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(https://image.tmdb.org/t/p/w1280" + val.background + ")");
|
||||
} else {
|
||||
this.imageService.getTvBanner(val.tvDbId).subscribe(x => {
|
||||
if (x) {
|
||||
val.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + x + ")");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// private loadBackdrop(val: ITvRequests): void {
|
||||
// if (val.background != null) {
|
||||
// val.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
// ("url(https://image.tmdb.org/t/p/w1280" + val.background + ")");
|
||||
// } else {
|
||||
// this.imageService.getTvBanner(val.tvDbId).subscribe(x => {
|
||||
// if (x) {
|
||||
// val.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
// ("url(" + x + ")");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -15,8 +15,6 @@ import { TvSearchComponent } from "./tvsearch.component";
|
|||
|
||||
import { CardsFreeModule } from "angular-bootstrap-md";
|
||||
|
||||
import { SidebarModule, TooltipModule, TreeTableModule } from "primeng/primeng";
|
||||
|
||||
import { RequestService } from "../services";
|
||||
import { SearchService } from "../services";
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Injectable } from "@angular/core";
|
||||
import { Message } from "primeng/components/common/api";
|
||||
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
|
||||
|
||||
@Injectable()
|
||||
|
@ -10,12 +9,6 @@ export class NotificationService {
|
|||
duration:3000,
|
||||
|
||||
}
|
||||
public messages: Message[] = [];
|
||||
public addMessage(message: Message) {
|
||||
this.clearMessages();
|
||||
this.messages.push(message);
|
||||
this.messages = JSON.parse(JSON.stringify(this.messages)); // NOTE: THIS IS A HACK AROUND A BUG https://github.com/primefaces/primeng/issues/2943
|
||||
}
|
||||
|
||||
public success(body: string) {
|
||||
this.snackbar.open(body, "OK", this.config);
|
||||
|
@ -32,8 +25,4 @@ export class NotificationService {
|
|||
public error(body: string) {
|
||||
this.snackbar.open(body, "OK", this.config);
|
||||
}
|
||||
|
||||
public clearMessages() {
|
||||
this.messages = [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Injectable, Inject } from "@angular/core";
|
|||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { TreeNode } from "primeng/primeng";
|
||||
import { UITreeNode } from "primeng/tree";
|
||||
import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IDenyAlbumModel, IDenyMovieModel, IFilter,
|
||||
IMovieRequestModel, IMovieRequests, IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvDenyModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces";
|
||||
import { ITvRequestViewModel } from "../interfaces";
|
||||
|
@ -90,8 +90,8 @@ export class RequestService extends ServiceHelpers {
|
|||
return this.http.get<IRequestsViewModel<ITvRequests>>(`${this.url}tv/${count}/${position}/${order}/${status}/${availability}`, {headers: this.headers});
|
||||
}
|
||||
|
||||
public getTvRequestsTree(count: number, position: number): Observable<TreeNode[]> {
|
||||
return this.http.get<TreeNode[]>(`${this.url}tv/${count}/${position}/tree`, {headers: this.headers});
|
||||
public getTvRequestsTree(count: number, position: number): Observable<UITreeNode[]> {
|
||||
return this.http.get<UITreeNode[]>(`${this.url}tv/${count}/${position}/tree`, {headers: this.headers});
|
||||
}
|
||||
|
||||
public getChildRequests(requestId: number): Observable<IChildRequests[]> {
|
||||
|
@ -102,8 +102,8 @@ export class RequestService extends ServiceHelpers {
|
|||
return this.http.get<ITvRequests[]>(`${this.url}tv/search/${search}`, {headers: this.headers});
|
||||
}
|
||||
|
||||
public searchTvRequestsTree(search: string): Observable<TreeNode[]> {
|
||||
return this.http.get<TreeNode[]>(`${this.url}tv/search/${search}/tree`, {headers: this.headers});
|
||||
public searchTvRequestsTree(search: string): Observable<UITreeNode[]> {
|
||||
return this.http.get<UITreeNode[]>(`${this.url}tv/search/${search}/tree`, {headers: this.headers});
|
||||
}
|
||||
|
||||
public removeTvRequest(requestId: number) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Injectable, Inject } from "@angular/core";
|
|||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { TreeNode } from "primeng/primeng";
|
||||
import { UITreeNode } from "primeng/tree";
|
||||
import { ISearchMovieResult } from "../interfaces";
|
||||
import { ISearchTvResult } from "../interfaces";
|
||||
import { ISearchAlbumResult, ISearchArtistResult } from "../interfaces/ISearchMusicResult";
|
||||
|
@ -58,12 +58,12 @@ export class SearchService extends ServiceHelpers {
|
|||
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/${searchTerm}`, { headers: this.headers });
|
||||
}
|
||||
|
||||
public searchTvTreeNode(searchTerm: string): Observable<TreeNode[]> {
|
||||
return this.http.get<TreeNode[]>(`${this.url}/Tv/${searchTerm}/tree`, { headers: this.headers });
|
||||
public searchTvTreeNode(searchTerm: string): Observable<UITreeNode[]> {
|
||||
return this.http.get<UITreeNode[]>(`${this.url}/Tv/${searchTerm}/tree`, { headers: this.headers });
|
||||
}
|
||||
|
||||
public getShowInformationTreeNode(theTvDbId: number): Observable<TreeNode> {
|
||||
return this.http.get<TreeNode>(`${this.url}/Tv/info/${theTvDbId}/Tree`, { headers: this.headers });
|
||||
public getShowInformationTreeNode(theTvDbId: number): Observable<UITreeNode> {
|
||||
return this.http.get<UITreeNode>(`${this.url}/Tv/info/${theTvDbId}/Tree`, { headers: this.headers });
|
||||
}
|
||||
|
||||
public getShowInformation(theTvDbId: number): Observable<ISearchTvResult> {
|
||||
|
|
|
@ -51,7 +51,15 @@ import { WikiComponent } from "./wiki.component";
|
|||
|
||||
import { SettingsMenuComponent } from "./settingsmenu.component";
|
||||
|
||||
import { AutoCompleteModule, CalendarModule, DialogModule, InputSwitchModule, InputTextModule, MenuModule, RadioButtonModule, TooltipModule } from "primeng/primeng";
|
||||
import {AutoCompleteModule } from "primeng/autocomplete";
|
||||
import {CalendarModule } from "primeng/calendar";
|
||||
import {InputSwitchModule } from "primeng/inputswitch";
|
||||
import {InputTextModule } from "primeng/inputtext";
|
||||
import {DialogModule } from "primeng/dialog";
|
||||
import {MenuModule } from "primeng/menu";
|
||||
import {RadioButtonModule } from "primeng/radiobutton";
|
||||
import {TooltipModule } from "primeng/tooltip";
|
||||
|
||||
import { MatMenuModule } from "@angular/material/menu";
|
||||
import { SharedModule } from "../shared/shared.module";
|
||||
import { HubService } from "../services/hub.service";
|
||||
|
|
|
@ -7,7 +7,8 @@ import { MomentModule } from "ngx-moment";
|
|||
|
||||
import { IssuesReportComponent } from "./issues-report.component";
|
||||
|
||||
import { InputSwitchModule, SidebarModule } from "primeng/primeng";
|
||||
import { SidebarModule } from "primeng/sidebar";
|
||||
import { InputSwitchModule } from "primeng/inputswitch";
|
||||
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatNativeDateModule } from '@angular/material/core';
|
||||
|
|
|
@ -4,8 +4,6 @@ import { ActivatedRoute, Router } from "@angular/router";
|
|||
import { ICheckbox, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces";
|
||||
import { IdentityService, NotificationService, RadarrService, SonarrService, MessageService } from "../services";
|
||||
|
||||
import { ConfirmationService } from "primeng/primeng";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./usermanagement-user.component.html",
|
||||
styleUrls: ["./usermanagement-user.component.scss"],
|
||||
|
@ -30,7 +28,6 @@ export class UserManagementUserComponent implements OnInit {
|
|||
private notificationService: MessageService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private confirmationService: ConfirmationService,
|
||||
private sonarrService: SonarrService,
|
||||
private radarrService: RadarrService) {
|
||||
|
||||
|
@ -120,28 +117,28 @@ export class UserManagementUserComponent implements OnInit {
|
|||
}
|
||||
|
||||
public delete() {
|
||||
// TODO
|
||||
// this.confirmationService.confirm({
|
||||
// message: "Are you sure that you want to delete this user? If this user has any requests they will also be deleted.",
|
||||
// header: "Are you sure?",
|
||||
// icon: "fa fa-trash",
|
||||
// accept: () => {
|
||||
// this.identityService.deleteUser(this.user).subscribe(x => {
|
||||
// if (x.successful) {
|
||||
// this.notificationService.send(`The user ${this.user.userName} was deleted`);
|
||||
// this.router.navigate(["usermanagement"]);
|
||||
// } else {
|
||||
// x.errors.forEach((val) => {
|
||||
// this.notificationService.send(val);
|
||||
// });
|
||||
// }
|
||||
|
||||
this.confirmationService.confirm({
|
||||
message: "Are you sure that you want to delete this user? If this user has any requests they will also be deleted.",
|
||||
header: "Are you sure?",
|
||||
icon: "fa fa-trash",
|
||||
accept: () => {
|
||||
this.identityService.deleteUser(this.user).subscribe(x => {
|
||||
if (x.successful) {
|
||||
this.notificationService.send(`The user ${this.user.userName} was deleted`);
|
||||
this.router.navigate(["usermanagement"]);
|
||||
} else {
|
||||
x.errors.forEach((val) => {
|
||||
this.notificationService.send(val);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
reject: () => {
|
||||
return;
|
||||
},
|
||||
});
|
||||
// });
|
||||
// },
|
||||
// reject: () => {
|
||||
// return;
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
public resetPassword() {
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
import { NgModule } from "@angular/core";
|
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { RouterModule, Routes } from "@angular/router";
|
||||
import { ConfirmationService, ConfirmDialogModule, MultiSelectModule, SidebarModule, TooltipModule } from "primeng/primeng";
|
||||
import { ConfirmDialogModule } from "primeng/confirmdialog";
|
||||
import { MultiSelectModule } from "primeng/multiselect";
|
||||
import { SidebarModule } from "primeng/sidebar";
|
||||
import { TooltipModule } from "primeng/tooltip";
|
||||
|
||||
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
||||
|
||||
|
@ -51,7 +54,6 @@ const routes: Routes = [
|
|||
],
|
||||
providers: [
|
||||
IdentityService,
|
||||
ConfirmationService,
|
||||
PlexService,
|
||||
RadarrService,
|
||||
SonarrService,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
|
||||
import { OverlayPanel } from "primeng/primeng";
|
||||
import { OverlayPanel } from "primeng/overlaypanel";
|
||||
import { NotificationService, VoteService } from "../services";
|
||||
|
||||
import { IVoteEngineResult, IVoteViewModel, RequestTypes, VoteType } from "../interfaces";
|
||||
|
|
|
@ -3,7 +3,8 @@ import { RouterModule, Routes } from "@angular/router";
|
|||
|
||||
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
||||
import { OrderModule } from "ngx-order-pipe";
|
||||
import { OverlayPanelModule, SharedModule, TabViewModule } from "primeng/primeng";
|
||||
import { OverlayPanelModule } from "primeng/overlaypanel";
|
||||
import { TabViewModule } from "primeng/tabview";
|
||||
|
||||
import { VoteService } from "../services";
|
||||
|
||||
|
@ -21,7 +22,6 @@ const routes: Routes = [
|
|||
imports: [
|
||||
RouterModule.forChild(routes),
|
||||
NgbModule.forRoot(),
|
||||
SharedModule,
|
||||
OrderModule,
|
||||
OmbiShared,
|
||||
TabViewModule,
|
||||
|
|
|
@ -3,7 +3,6 @@ import { NgModule } from "@angular/core";
|
|||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { RouterModule, Routes } from "@angular/router";
|
||||
|
||||
import {ConfirmationService, ConfirmDialogModule } from "primeng/primeng";
|
||||
import { MatStepperModule } from "@angular/material/stepper";
|
||||
|
||||
import { CreateAdminComponent } from "./createadmin/createadmin.component";
|
||||
|
@ -31,7 +30,6 @@ const routes: Routes = [
|
|||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
ConfirmDialogModule,
|
||||
SharedModule,
|
||||
MatStepperModule,
|
||||
RouterModule.forChild(routes),
|
||||
|
@ -50,7 +48,6 @@ const routes: Routes = [
|
|||
PlexService,
|
||||
IdentityService,
|
||||
EmbyService,
|
||||
ConfirmationService,
|
||||
PlexOAuthService,
|
||||
],
|
||||
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
/***************************************************************************************************
|
||||
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
|
||||
*/
|
||||
import '@angular/localize/init';
|
||||
import "core-js/es7/reflect";
|
||||
import "zone.js/dist/zone";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue