mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -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;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IDenyMovieModel extends IMovieUpdateModel {
|
||||||
|
reason: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IAlbumUpdateModel {
|
export interface IAlbumUpdateModel {
|
||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="request.denied" id="requestDenied">
|
<div *ngIf="request.denied" id="requestDenied">
|
||||||
{{ 'Requests.Denied' | translate }}
|
{{ '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>
|
</div>
|
||||||
|
|
||||||
|
@ -215,17 +215,14 @@
|
||||||
<p-paginator [rows]="10" [totalRecords]="totalMovies" (onPageChange)="paginate($event)"></p-paginator>
|
<p-paginator [rows]="10" [totalRecords]="totalMovies" (onPageChange)="paginate($event)"></p-paginator>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p-confirmDialog #cd header="Confirmation" icon="pi pi-exclamation-triangle">
|
<p-dialog *ngIf="requestToDeny" header="Deny Request '{{requestToDeny.title}}''" [(visible)]="denyDisplay" [draggable]="false">
|
||||||
<ng-template pTemplate="body">
|
<span>Please enter a rejection reason, the user will be notified of this:</span>
|
||||||
<ul>
|
<textarea [(ngModel)]="rejectionReason" class="form-control-custom form-control"></textarea>
|
||||||
<li>test</li>
|
|
||||||
</ul>
|
|
||||||
</ng-template>
|
|
||||||
<p-footer>
|
<p-footer>
|
||||||
<button type="button" pButton icon="pi pi-times" label="No" (click)="cd.reject()"></button>
|
<button type="button" (click)="denyRequest();" label="Reject" class="btn btn-success">Deny</button>
|
||||||
<button type="button" pButton icon="pi pi-check" label="Yes" (click)="cd.accept()"></button>
|
<button type="button"(click)="denyDisplay=false" label="Close" class="btn btn-danger">Close</button>
|
||||||
</p-footer>
|
</p-footer>
|
||||||
</p-confirmDialog>
|
</p-dialog>
|
||||||
|
|
||||||
<issue-report [movie]="true" [visible]="issuesBarVisible" (visibleChange)="issuesBarVisible = $event;" [title]="issueRequest?.title"
|
<issue-report [movie]="true" [visible]="issuesBarVisible" (visibleChange)="issuesBarVisible = $event;" [title]="issueRequest?.title"
|
||||||
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId"></issue-report>
|
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId"></issue-report>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import { PlatformLocation } from "@angular/common";
|
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 { DomSanitizer } from "@angular/platform-browser";
|
||||||
import { Subject } from "rxjs";
|
import { Subject } from "rxjs";
|
||||||
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||||
|
|
||||||
import { ConfirmationService, ConfirmDialog } from "primeng/primeng";
|
|
||||||
import { AuthService } from "../auth/auth.service";
|
import { AuthService } from "../auth/auth.service";
|
||||||
import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder, OrderType } from "../interfaces";
|
import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder, OrderType } from "../interfaces";
|
||||||
import { NotificationService, RadarrService, RequestService } from "../services";
|
import { NotificationService, RadarrService, RequestService } from "../services";
|
||||||
|
@ -38,7 +37,9 @@ export class MovieRequestsComponent implements OnInit {
|
||||||
|
|
||||||
public orderType: OrderType = OrderType.RequestedDateDesc;
|
public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||||
public OrderType = OrderType;
|
public OrderType = OrderType;
|
||||||
@ViewChild("") public confirmDialogComponent: ConfirmDialog;
|
public denyDisplay: boolean;
|
||||||
|
public requestToDeny: IMovieRequests;
|
||||||
|
public rejectionReason: string;
|
||||||
|
|
||||||
public totalMovies: number = 100;
|
public totalMovies: number = 100;
|
||||||
public currentlyLoaded: number;
|
public currentlyLoaded: number;
|
||||||
|
@ -50,8 +51,7 @@ export class MovieRequestsComponent implements OnInit {
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private radarrService: RadarrService,
|
private radarrService: RadarrService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private readonly platformLocation: PlatformLocation,
|
private readonly platformLocation: PlatformLocation) {
|
||||||
private confirmationService: ConfirmationService) {
|
|
||||||
this.searchChanged.pipe(
|
this.searchChanged.pipe(
|
||||||
debounceTime(600), // Wait Xms after the last event before emitting last event
|
debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||||
distinctUntilChanged(), // only emit if value is different from previous value
|
distinctUntilChanged(), // only emit if value is different from previous value
|
||||||
|
@ -133,15 +133,23 @@ export class MovieRequestsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public deny(request: IMovieRequests) {
|
public deny(request: IMovieRequests) {
|
||||||
|
this.requestToDeny = request;
|
||||||
this.confirmationService.confirm({
|
this.denyDisplay = true;
|
||||||
message: "Are you sure",
|
}
|
||||||
accept: () => {
|
|
||||||
request.denied = true;
|
public denyRequest() {
|
||||||
this.denyRequest(request);
|
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) {
|
public selectRootFolder(searchResult: IMovieRequests, rootFolderSelected: IRadarrRootFolder, event: any) {
|
||||||
event.preventDefault();
|
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() {
|
private loadInit() {
|
||||||
this.requestService.getMovieRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
this.requestService.getMovieRequests(this.amountToLoad, 0, this.orderType, this.filter)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { OrderModule } from "ngx-order-pipe";
|
||||||
|
|
||||||
import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
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 { MovieRequestsComponent } from "./movierequests.component";
|
||||||
import { MusicRequestsComponent } from "./music/musicrequests.component";
|
import { MusicRequestsComponent } from "./music/musicrequests.component";
|
||||||
// Request
|
// Request
|
||||||
|
@ -38,7 +38,6 @@ const routes: Routes = [
|
||||||
OrderModule,
|
OrderModule,
|
||||||
PaginatorModule,
|
PaginatorModule,
|
||||||
TooltipModule,
|
TooltipModule,
|
||||||
ConfirmDialogModule,
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
RequestComponent,
|
RequestComponent,
|
||||||
|
|
|
@ -5,8 +5,8 @@ import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { TreeNode } from "primeng/primeng";
|
import { TreeNode } from "primeng/primeng";
|
||||||
import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IFilter, IMovieRequestModel, IMovieRequests,
|
import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IDenyMovieModel, IFilter, IMovieRequestModel,
|
||||||
IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces";
|
IMovieRequests, IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces";
|
||||||
import { ITvRequestViewModel } from "../interfaces";
|
import { ITvRequestViewModel } from "../interfaces";
|
||||||
import { ServiceHelpers } from "./service.helpers";
|
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});
|
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});
|
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({
|
@Component({
|
||||||
templateUrl: "./usermanagement-user.component.html",
|
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 {
|
export class UserManagementUserComponent implements OnInit {
|
||||||
|
|
||||||
|
|
|
@ -1008,4 +1008,13 @@ a > h4:hover {
|
||||||
|
|
||||||
.album-cover {
|
.album-cover {
|
||||||
width:300px;
|
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