From bd3a243af96dfa9b1e7dd4d0f404d349cdcde52e Mon Sep 17 00:00:00 2001 From: TidusJar Date: Mon, 17 Dec 2018 14:47:35 +0000 Subject: [PATCH] Deny reason for movie requests --- .../ClientApp/app/interfaces/IRequestModel.ts | 4 ++ .../app/requests/movierequests.component.html | 17 +++---- .../app/requests/movierequests.component.ts | 49 +++++++++---------- .../ClientApp/app/requests/requests.module.ts | 3 +- .../ClientApp/app/services/request.service.ts | 6 +-- .../usermanagement-user.component.ts | 10 ++++ src/Ombi/ClientApp/styles/base.scss | 11 ++++- 7 files changed, 57 insertions(+), 43 deletions(-) diff --git a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts index b083ca088..16a1511e9 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts @@ -47,6 +47,10 @@ export interface IMovieUpdateModel { id: number; } +export interface IDenyMovieModel extends IMovieUpdateModel { + reason: string; +} + export interface IAlbumUpdateModel { id: number; } diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.html b/src/Ombi/ClientApp/app/requests/movierequests.component.html index af9f3a22e..f8ea31950 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.html +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.html @@ -88,7 +88,7 @@
{{ 'Requests.Denied' | translate }} - +
@@ -215,17 +215,14 @@ - - -
    -
  • test
  • -
-
+ +Please enter a rejection reason, the user will be notified of this: + - - + + -
+ diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index c0c51d30a..3c7a4f993 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -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 => { diff --git a/src/Ombi/ClientApp/app/requests/requests.module.ts b/src/Ombi/ClientApp/app/requests/requests.module.ts index ca77c8f8c..63d7117f5 100644 --- a/src/Ombi/ClientApp/app/requests/requests.module.ts +++ b/src/Ombi/ClientApp/app/requests/requests.module.ts @@ -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, diff --git a/src/Ombi/ClientApp/app/services/request.service.ts b/src/Ombi/ClientApp/app/services/request.service.ts index 0021dc208..c157cb72f 100644 --- a/src/Ombi/ClientApp/app/services/request.service.ts +++ b/src/Ombi/ClientApp/app/services/request.service.ts @@ -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(`${this.url}Movie/Approve`, JSON.stringify(movie), {headers: this.headers}); } - public denyMovie(movie: IMovieUpdateModel): Observable { + public denyMovie(movie: IDenyMovieModel): Observable { return this.http.put(`${this.url}Movie/Deny`, JSON.stringify(movie), {headers: this.headers}); } diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts index 5be0a4509..59f3ea5d8 100644 --- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts +++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts @@ -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 { diff --git a/src/Ombi/ClientApp/styles/base.scss b/src/Ombi/ClientApp/styles/base.scss index 1245f63ab..9c7756d8f 100644 --- a/src/Ombi/ClientApp/styles/base.scss +++ b/src/Ombi/ClientApp/styles/base.scss @@ -1008,4 +1008,13 @@ a > h4:hover { .album-cover { width:300px; -} \ No newline at end of file +} + + +::ng-deep ngb-accordion > div.card > div.card-header { + padding:0px; +} +::ng-deep ngb-accordion > div.card { + color:white; + padding-top: 0px; +}