mirror of https://github.com/Ombi-app/Ombi
parent
b7f74d9f96
commit
d4246abad5
@ -0,0 +1,10 @@
|
||||
<h1 mat-dialog-title>Deny Reason</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field>
|
||||
<input matInput [(ngModel)]="denyReason">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onNoClick()" [mat-dialog-close]="data.denied">Cancel</button>
|
||||
<button mat-button (click)="deny()" [mat-dialog-close]="data.denied" cdkFocusInitial>Deny</button>
|
||||
</div>
|
@ -0,0 +1,47 @@
|
||||
import { Component, Inject, Output, EventEmitter } from "@angular/core";
|
||||
import { IDenyDialogData } from "../interfaces/interfaces";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { RequestService, MessageService } from "../../../../services";
|
||||
import { RequestType, IRequestEngineResult } from "../../../../interfaces";
|
||||
|
||||
@Component({
|
||||
selector: "deny-dialog",
|
||||
templateUrl: "./deny-dialog.component.html",
|
||||
})
|
||||
export class DenyDialogComponent {
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DenyDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: IDenyDialogData,
|
||||
private requestService: RequestService,
|
||||
public messageService: MessageService) {}
|
||||
|
||||
public denyReason: string;
|
||||
|
||||
public async deny() {
|
||||
let result: IRequestEngineResult;
|
||||
if(this.data.requestType == RequestType.movie) {
|
||||
result = await this.requestService.denyMovie({id: this.data.requestId, reason: this.denyReason }).toPromise();
|
||||
}
|
||||
if(this.data.requestType == RequestType.tvShow) {
|
||||
result = await this.requestService.denyChild({id: this.data.requestId, reason: this.denyReason }).toPromise();
|
||||
}
|
||||
if(this.data.requestType == RequestType.album) {
|
||||
result = await this.requestService.denyAlbum({id: this.data.requestId, reason: this.denyReason }).toPromise();
|
||||
}
|
||||
|
||||
if (result.result) {
|
||||
this.messageService.send("Denied Request", "Ok");
|
||||
this.data.denied = true;
|
||||
} else {
|
||||
this.messageService.send(result.errorMessage, "Ok");
|
||||
this.data.denied = false;
|
||||
}
|
||||
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
this.data.denied = false;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { RequestType } from "../../../../interfaces";
|
||||
|
||||
export interface IDenyDialogData {
|
||||
requestType: RequestType;
|
||||
requestId: number;
|
||||
denied: boolean;
|
||||
}
|
Loading…
Reference in new issue