mirror of https://github.com/Ombi-app/Ombi
Got most of the requesting stuff done! !wip #2313
parent
cda7c0fe4c
commit
b72905ab4a
@ -0,0 +1,270 @@
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" id="search" class="form-control form-control-custom searchwidth" placeholder="Search" (keyup)="search($event)">
|
||||
<span class="input-group-btn">
|
||||
<button id="filterBtn" class="btn btn-sm btn-info-outline" (click)="filterDisplay = !filterDisplay">
|
||||
<i class="fa fa-filter"></i> {{ 'Requests.Filter' | translate }}
|
||||
</button>
|
||||
|
||||
|
||||
<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-sort"></i> {{ 'Requests.Sort' | translate }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
||||
<li>
|
||||
<a (click)="setOrder(OrderType.RequestedDateAsc, $event)">{{ 'Requests.SortRequestDateAsc' | translate }}
|
||||
|
||||
</a>
|
||||
<a class="active" (click)="setOrder(OrderType.RequestedDateDesc, $event)">{{ 'Requests.SortRequestDateDesc' | translate }}
|
||||
|
||||
</a>
|
||||
<a (click)="setOrder(OrderType.TitleAsc, $event)">{{ 'Requests.SortTitleAsc' | translate}}
|
||||
|
||||
</a>
|
||||
<a (click)="setOrder(OrderType.TitleDesc, $event)">{{ 'Requests.SortTitleDesc' | translate}}
|
||||
|
||||
</a>
|
||||
<a (click)="setOrder(OrderType.StatusAsc, $event)">{{ 'Requests.SortStatusAsc' | translate}}
|
||||
|
||||
</a>
|
||||
<a (click)="setOrder(OrderType.StatusDesc, $event)">{{ 'Requests.SortStatusDesc' | translate}}
|
||||
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<br />
|
||||
|
||||
|
||||
<div>
|
||||
<div *ngFor="let request of albumRequests" class="col-md-4">
|
||||
<div class="row">
|
||||
<div class="album-bg backdrop" [style.background-image]="request.background"></div>
|
||||
<div class="album-tint" style="background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%);"></div>
|
||||
|
||||
<div class="col-sm-12 small-padding">
|
||||
<img *ngIf="request.disk" class="img-responsive poster album-cover" src="{{request.disk}}" alt="poster">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-12 small-padding">
|
||||
<div>
|
||||
<h4>
|
||||
<a href="" target="_blank">
|
||||
{{request.title}}
|
||||
</a>
|
||||
|
||||
</h4>
|
||||
<h5>
|
||||
<a href="">
|
||||
{{request.artistName}}
|
||||
</a>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div class="request-info">
|
||||
<div class="request-by">
|
||||
<span>{{ 'Requests.RequestedBy' | translate }} </span>
|
||||
<span *ngIf="!isAdmin">{{request.requestedUser.userName}}</span>
|
||||
<span *ngIf="isAdmin && request.requestedUser.alias">{{request.requestedUser.alias}}</span>
|
||||
<span *ngIf="isAdmin && !request.requestedUser.alias">{{request.requestedUser.userName}}</span>
|
||||
</div>
|
||||
<div class="request-status">
|
||||
<span>{{ 'Requests.Status' | translate }} </span>
|
||||
<span class="label label-success" id="requestedStatusLabel">{{request.status}}</span>
|
||||
</div>
|
||||
|
||||
<div class="requested-status">
|
||||
<span>{{ 'Requests.RequestStatus' | translate }} </span>
|
||||
<span *ngIf="request.available" class="label label-success" id="availableLabel" [translate]="'Common.Available'"></span>
|
||||
<span *ngIf="request.approved && !request.available" id="processingRequestLabel" class="label label-info" [translate]="'Common.ProcessingRequest'"></span>
|
||||
<span *ngIf="request.denied" class="label label-danger" id="requestDeclinedLabel" [translate]="'Common.RequestDenied'"></span>
|
||||
<span *ngIf="request.deniedReason" title="{{request.deniedReason}}">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
</span>
|
||||
<span *ngIf="!request.approved && !request.availble && !request.denied" id="pendingApprovalLabel" class="label label-warning"
|
||||
[translate]="'Common.PendingApproval'"></span>
|
||||
|
||||
</div>
|
||||
<div *ngIf="request.denied" id="requestDenied">
|
||||
{{ 'Requests.Denied' | translate }}
|
||||
<i style="color:red;" class="fa fa-check"></i>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="releaseDate">{{ 'Requests.TheatricalRelease' | translate: {date: request.releaseDate | date: 'mediumDate'} }}</div>
|
||||
<div *ngIf="request.digitalReleaseDate" id="digitalReleaseDate">{{ 'Requests.DigitalRelease' | translate: {date: request.digitalReleaseDate | date: 'mediumDate'} }}</div>
|
||||
<div id="requestedDate">{{ 'Requests.RequestDate' | translate }} {{request.requestedDate | date}}</div>
|
||||
<br />
|
||||
</div>
|
||||
<div *ngIf="isAdmin">
|
||||
<div *ngIf="request.qualityOverrideTitle" class="quality-override">{{ 'Requests.QualityOverride' | translate }}
|
||||
<span>{{request.qualityOverrideTitle}} </span>
|
||||
</div>
|
||||
<div *ngIf="request.rootPathOverrideTitle" class="root-override">{{ 'Requests.RootFolderOverride' | translate }}
|
||||
<span>{{request.rootPathOverrideTitle}} </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 small-padding">
|
||||
<!-- <div class="row">
|
||||
<div class="col-md-2 col-md-push-6">
|
||||
|
||||
<a *ngIf="request.showSubscribe && !request.subscribed" style="color:white" (click)="subscribe(request)" pTooltip="Subscribe for notifications">
|
||||
<i class="fa fa-rss"></i>
|
||||
</a>
|
||||
<a *ngIf="request.showSubscribe && request.subscribed" style="color:red" (click)="unSubscribe(request)" pTooltip="Unsubscribe notification">
|
||||
<i class="fa fa-rss"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div> -->
|
||||
<div *ngIf="isAdmin">
|
||||
<div *ngIf="!request.approved" id="approveBtn">
|
||||
<form>
|
||||
<button (click)="approve(request)" style="text-align: right" class="btn btn-sm btn-success-outline approve" type="submit">
|
||||
<i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!--Radarr Root Folder-->
|
||||
<!-- <div *ngIf="radarrRootFolders" class="btn-group btn-split" id="rootFolderBtn">
|
||||
<button type="button" class="btn btn-sm btn-warning-outline">
|
||||
<i class="fa fa-plus"></i> {{ 'Requests.ChangeRootFolder' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li *ngFor="let folder of radarrRootFolders">
|
||||
<a href="#" (click)="selectRootFolder(request, folder, $event)">{{folder.path}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
|
||||
<!--Radarr Quality Profiles -->
|
||||
<!-- <div *ngIf="radarrProfiles" class="btn-group btn-split" id="changeQualityBtn">
|
||||
<button type="button" class="btn btn-sm btn-warning-outline">
|
||||
<i class="fa fa-plus"></i> {{ 'Requests.ChangeQualityProfile' | translate }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li *ngFor="let profile of radarrProfiles">
|
||||
<a href="#" (click)="selectQualityProfile(request, profile, $event)">{{profile.name}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
|
||||
<div *ngIf="!request.denied" id="denyBtn">
|
||||
<button type="button" (click)="deny(request)" class="btn btn-sm btn-danger-outline deny">
|
||||
<i class="fa fa-times"></i> {{ 'Requests.Deny' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form id="removeBtn">
|
||||
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete">
|
||||
<i class="fa fa-minus"></i> {{ 'Requests.Remove' | translate }}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form id="markBtnGroup">
|
||||
<button id="unavailableBtn" *ngIf="request.available" (click)="changeAvailability(request, false)" style="text-align: right"
|
||||
value="false" class="btn btn-sm btn-info-outline change">
|
||||
<i class="fa fa-minus"></i> {{ 'Requests.MarkUnavailable' | translate }}
|
||||
</button>
|
||||
<button id="availableBtn" *ngIf="!request.available" (click)="changeAvailability(request, true)" style="text-align: right"
|
||||
value="true" class="btn btn-sm btn-success-outline change">
|
||||
<i class="fa fa-plus"></i> {{ 'Requests.MarkAvailable' | translate }}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- <div class="dropdown" *ngIf="issueCategories && issuesEnabled" id="issuesBtn">
|
||||
<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>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li *ngFor="let cat of issueCategories">
|
||||
<a [routerLink]="" (click)="reportIssue(cat, request)">{{cat.value}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<p-paginator [rows]="10" [totalRecords]="totalMovies" (onPageChange)="paginate($event)"></p-paginator>
|
||||
</div>
|
||||
|
||||
|
||||
<issue-report [movie]="true" [visible]="issuesBarVisible" (visibleChange)="issuesBarVisible = $event;" [title]="issueRequest?.title"
|
||||
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId"></issue-report>
|
||||
|
||||
|
||||
<p-sidebar [(visible)]="filterDisplay" styleClass="ui-sidebar-md side-back side-small">
|
||||
<h3>{{ 'Requests.Filter' | translate }}</h3>
|
||||
<hr>
|
||||
<div>
|
||||
<h4>{{ 'Filter.FilterHeaderAvailability' | translate }}</h4>
|
||||
<div class="form-group">
|
||||
<div class="radio">
|
||||
<input type="radio" id="Available" name="Availability" (click)="filterAvailability(filterType.Available, $event)">
|
||||
<label for="Available">{{ 'Common.Available' | translate }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="radio">
|
||||
<input type="radio" id="notAvailable" name="Availability" (click)="filterAvailability(filterType.NotAvailable, $event)">
|
||||
<label for="notAvailable">{{ 'Common.NotAvailable' | translate }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>{{ 'Filter.FilterHeaderRequestStatus' | translate }}</h4>
|
||||
<div class="form-group">
|
||||
<div class="radio">
|
||||
<input type="radio" id="approved" name="Status" (click)="filterStatus(filterType.Approved, $event)">
|
||||
<label for="approved">{{ 'Filter.Approved' | translate }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="radio">
|
||||
<input type="radio" id="Processing" name="Status" (click)="filterStatus(filterType.Processing, $event)">
|
||||
<label for="Processing">{{ 'Common.ProcessingRequest' | translate }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="radio">
|
||||
<input type="radio" id="pendingApproval" name="Status" (click)="filterStatus(filterType.PendingApproval, $event)">
|
||||
<label for="pendingApproval">{{ 'Filter.PendingApproval' | translate }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-sm btn-primary-outline" (click)="clearFilter($event)">
|
||||
<i class="fa fa-filter"></i> {{ 'Filter.ClearFilter' | translate }}</button>
|
||||
</p-sidebar>
|
@ -0,0 +1,350 @@
|
||||
import { PlatformLocation } from "@angular/common";
|
||||
import { Component, Input, OnInit } 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";
|
||||
|
||||
@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 isAdmin: boolean; // Also PowerUser
|
||||
|
||||
@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 orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
public OrderType = OrderType;
|
||||
|
||||
public totalAlbums: number = 100;
|
||||
private currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
|
||||
constructor(
|
||||
private requestService: RequestService,
|
||||
private auth: AuthService,
|
||||
private notificationService: NotificationService,
|
||||
private sanitizer: DomSanitizer,
|
||||
private readonly platformLocation: PlatformLocation) {
|
||||
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.platformLocation.getBaseHrefFromDOM();
|
||||
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 paginate(event: IPagenator) {
|
||||
const skipAmount = event.first;
|
||||
this.loadRequests(this.amountToLoad, skipAmount);
|
||||
}
|
||||
|
||||
public search(text: any) {
|
||||
this.searchChanged.next(text.target.value);
|
||||
}
|
||||
|
||||
public removeRequest(request: IAlbumRequest) {
|
||||
this.requestService.removeAlbumRequest(request);
|
||||
this.removeRequestFromUi(request);
|
||||
this.loadRequests(this.amountToLoad, this.currentlyLoaded = 0);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public approve(request: IAlbumRequest) {
|
||||
request.approved = true;
|
||||
this.approveRequest(request);
|
||||
}
|
||||
|
||||
public deny(request: IAlbumRequest) {
|
||||
request.denied = true;
|
||||
this.denyRequest(request);
|
||||
}
|
||||
|
||||
// public selectRootFolder(searchResult: IAlbumRequest, 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 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 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.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 denyRequest(request: IAlbumRequest) {
|
||||
this.requestService.denyAlbum({ id: request.id })
|
||||
.subscribe(x => {
|
||||
if (x.result) {
|
||||
this.notificationService.success(
|
||||
`Request for ${request.title} has been denied successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
|
||||
request.denied = 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));
|
||||
// });
|
||||
// this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
// this.radarrRootFolders = c;
|
||||
// this.albumRequests.forEach((req) => this.setRootFolderOverrides(req));
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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 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;
|
||||
// });
|
||||
// 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 + ")");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue