mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Deny reason for movie requests
This commit is contained in:
parent
3377eb9838
commit
bd3a243af9
7 changed files with 57 additions and 43 deletions
|
@ -47,6 +47,10 @@ export interface IMovieUpdateModel {
|
|||
id: number;
|
||||
}
|
||||
|
||||
export interface IDenyMovieModel extends IMovieUpdateModel {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export interface IAlbumUpdateModel {
|
||||
id: number;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</div>
|
||||
<div *ngIf="request.denied" id="requestDenied">
|
||||
{{ 'Requests.Denied' | translate }}
|
||||
<i style="color:red;" class="fa fa-check"></i>
|
||||
<i style="color:red;" class="fa fa-check" pTooltip="{{request.deniedReason}}"></i>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -215,17 +215,14 @@
|
|||
<p-paginator [rows]="10" [totalRecords]="totalMovies" (onPageChange)="paginate($event)"></p-paginator>
|
||||
</div>
|
||||
|
||||
<p-confirmDialog #cd header="Confirmation" icon="pi pi-exclamation-triangle">
|
||||
<ng-template pTemplate="body">
|
||||
<ul>
|
||||
<li>test</li>
|
||||
</ul>
|
||||
</ng-template>
|
||||
<p-dialog *ngIf="requestToDeny" header="Deny Request '{{requestToDeny.title}}''" [(visible)]="denyDisplay" [draggable]="false">
|
||||
<span>Please enter a rejection reason, the user will be notified of this:</span>
|
||||
<textarea [(ngModel)]="rejectionReason" class="form-control-custom form-control"></textarea>
|
||||
<p-footer>
|
||||
<button type="button" pButton icon="pi pi-times" label="No" (click)="cd.reject()"></button>
|
||||
<button type="button" pButton icon="pi pi-check" label="Yes" (click)="cd.accept()"></button>
|
||||
<button type="button" (click)="denyRequest();" label="Reject" class="btn btn-success">Deny</button>
|
||||
<button type="button"(click)="denyDisplay=false" label="Close" class="btn btn-danger">Close</button>
|
||||
</p-footer>
|
||||
</p-confirmDialog>
|
||||
</p-dialog>
|
||||
|
||||
<issue-report [movie]="true" [visible]="issuesBarVisible" (visibleChange)="issuesBarVisible = $event;" [title]="issueRequest?.title"
|
||||
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId"></issue-report>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { PlatformLocation } from "@angular/common";
|
||||
import { Component, Input, OnInit, ViewChild } from "@angular/core";
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { Subject } from "rxjs";
|
||||
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||
|
||||
import { ConfirmationService, ConfirmDialog } from "primeng/primeng";
|
||||
import { AuthService } from "../auth/auth.service";
|
||||
import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder, OrderType } from "../interfaces";
|
||||
import { NotificationService, RadarrService, RequestService } from "../services";
|
||||
|
@ -38,7 +37,9 @@ export class MovieRequestsComponent implements OnInit {
|
|||
|
||||
public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
public OrderType = OrderType;
|
||||
@ViewChild("") public confirmDialogComponent: ConfirmDialog;
|
||||
public denyDisplay: boolean;
|
||||
public requestToDeny: IMovieRequests;
|
||||
public rejectionReason: string;
|
||||
|
||||
public totalMovies: number = 100;
|
||||
public currentlyLoaded: number;
|
||||
|
@ -50,8 +51,7 @@ export class MovieRequestsComponent implements OnInit {
|
|||
private notificationService: NotificationService,
|
||||
private radarrService: RadarrService,
|
||||
private sanitizer: DomSanitizer,
|
||||
private readonly platformLocation: PlatformLocation,
|
||||
private confirmationService: ConfirmationService) {
|
||||
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
|
||||
|
@ -133,15 +133,23 @@ export class MovieRequestsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public deny(request: IMovieRequests) {
|
||||
|
||||
this.confirmationService.confirm({
|
||||
message: "Are you sure",
|
||||
accept: () => {
|
||||
request.denied = true;
|
||||
this.denyRequest(request);
|
||||
},
|
||||
});
|
||||
}
|
||||
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`);
|
||||
} 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();
|
||||
|
@ -287,19 +295,6 @@ export class MovieRequestsComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
private denyRequest(request: IMovieRequests) {
|
||||
this.requestService.denyMovie({ 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.getMovieRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
||||
.subscribe(x => {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { OrderModule } from "ngx-order-pipe";
|
|||
|
||||
import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
||||
|
||||
import { ButtonModule, ConfirmDialogModule, DialogModule, PaginatorModule } from "primeng/primeng";
|
||||
import { ButtonModule, DialogModule, PaginatorModule } from "primeng/primeng";
|
||||
import { MovieRequestsComponent } from "./movierequests.component";
|
||||
import { MusicRequestsComponent } from "./music/musicrequests.component";
|
||||
// Request
|
||||
|
@ -38,7 +38,6 @@ const routes: Routes = [
|
|||
OrderModule,
|
||||
PaginatorModule,
|
||||
TooltipModule,
|
||||
ConfirmDialogModule,
|
||||
],
|
||||
declarations: [
|
||||
RequestComponent,
|
||||
|
|
|
@ -5,8 +5,8 @@ import { HttpClient } from "@angular/common/http";
|
|||
import { Observable } from "rxjs";
|
||||
|
||||
import { TreeNode } from "primeng/primeng";
|
||||
import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IFilter, IMovieRequestModel, IMovieRequests,
|
||||
IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces";
|
||||
import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IDenyMovieModel, IFilter, IMovieRequestModel,
|
||||
IMovieRequests, IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces";
|
||||
import { ITvRequestViewModel } from "../interfaces";
|
||||
import { ServiceHelpers } from "./service.helpers";
|
||||
|
||||
|
@ -50,7 +50,7 @@ export class RequestService extends ServiceHelpers {
|
|||
return this.http.post<IRequestEngineResult>(`${this.url}Movie/Approve`, JSON.stringify(movie), {headers: this.headers});
|
||||
}
|
||||
|
||||
public denyMovie(movie: IMovieUpdateModel): Observable<IRequestEngineResult> {
|
||||
public denyMovie(movie: IDenyMovieModel): Observable<IRequestEngineResult> {
|
||||
return this.http.put<IRequestEngineResult>(`${this.url}Movie/Deny`, JSON.stringify(movie), {headers: this.headers});
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,16 @@ import { ConfirmationService } from "primeng/primeng";
|
|||
|
||||
@Component({
|
||||
templateUrl: "./usermanagement-user.component.html",
|
||||
styles: [`
|
||||
|
||||
::ng-deep ngb-accordion > div.card > div.card-header {
|
||||
padding:0px;
|
||||
}
|
||||
::ng-deep ngb-accordion > div.card {
|
||||
color:white;
|
||||
padding-top: 0px;
|
||||
}
|
||||
`],
|
||||
})
|
||||
export class UserManagementUserComponent implements OnInit {
|
||||
|
||||
|
|
|
@ -1008,4 +1008,13 @@ a > h4:hover {
|
|||
|
||||
.album-cover {
|
||||
width:300px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
::ng-deep ngb-accordion > div.card > div.card-header {
|
||||
padding:0px;
|
||||
}
|
||||
::ng-deep ngb-accordion > div.card {
|
||||
color:white;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue