mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
feat(discover): Add deny option to recently requested (#4907)
This commit is contained in:
parent
540f14b735
commit
78f340ee5f
6 changed files with 53 additions and 5 deletions
|
@ -22,7 +22,23 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row action-items">
|
<div class="row action-items">
|
||||||
<div class="col-12" *ngIf="isAdmin">
|
<div class="col-12" *ngIf="isAdmin">
|
||||||
<button *ngIf="!request.approved" id="detailed-request-approve-{{request.mediaId}}" color="accent" mat-raised-button (click)="approve()">{{'Common.Approve' | translate}}</button>
|
<div *ngIf="!request.approved && !request.denied">
|
||||||
|
<button
|
||||||
|
id="detailed-request-approve-{{request.mediaId}}"
|
||||||
|
color="accent"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="approve()"
|
||||||
|
matTooltip="{{'Common.Approve' | translate}}">
|
||||||
|
<mat-icon>check-circle</mat-icon>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
id="detailed-request-deny-{{request.mediaId}}"
|
||||||
|
color="accent"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="deny()"
|
||||||
|
matTooltip="{{'Requests.Deny' | translate}}">
|
||||||
|
<mat-icon>cancel</mat-icon></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,5 +50,9 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action-items button {
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class DetailedCardComponent implements OnInit, OnDestroy {
|
||||||
@Input() public isAdmin: boolean = false;
|
@Input() public isAdmin: boolean = false;
|
||||||
@Output() public onClick: EventEmitter<void> = new EventEmitter<void>();
|
@Output() public onClick: EventEmitter<void> = new EventEmitter<void>();
|
||||||
@Output() public onApprove: EventEmitter<void> = new EventEmitter<void>();
|
@Output() public onApprove: EventEmitter<void> = new EventEmitter<void>();
|
||||||
|
@Output() public onDeny: EventEmitter<void> = new EventEmitter<void>();
|
||||||
|
|
||||||
public RequestType = RequestType;
|
public RequestType = RequestType;
|
||||||
public loading: false;
|
public loading: false;
|
||||||
|
@ -65,6 +66,10 @@ export class DetailedCardComponent implements OnInit, OnDestroy {
|
||||||
this.onApprove.emit();
|
this.onApprove.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public deny() {
|
||||||
|
this.onDeny.emit();
|
||||||
|
}
|
||||||
|
|
||||||
public getClass(request: IRecentlyRequested) {
|
public getClass(request: IRecentlyRequested) {
|
||||||
if (request.denied) {
|
if (request.denied) {
|
||||||
return "danger";
|
return "danger";
|
||||||
|
|
|
@ -3,9 +3,14 @@
|
||||||
<p-carousel #carousel [value]="requests" [numVisible]="3" [numScroll]="1"
|
<p-carousel #carousel [value]="requests" [numVisible]="3" [numScroll]="1"
|
||||||
[responsiveOptions]="responsiveOptions" [page]="0">
|
[responsiveOptions]="responsiveOptions" [page]="0">
|
||||||
<ng-template let-result pTemplate="item">
|
<ng-template let-result pTemplate="item">
|
||||||
<ombi-detailed-card [request]="result" [isAdmin]="isAdmin" (onClick)="navigate(result)"
|
<ombi-detailed-card
|
||||||
(onApprove)="approve(result)"></ombi-detailed-card>
|
[request]="result"
|
||||||
|
[isAdmin]="isAdmin"
|
||||||
|
(onClick)="navigate(result)"
|
||||||
|
(onApprove)="approve(result)"
|
||||||
|
(onDeny)="deny(result)">
|
||||||
|
</ombi-detailed-card>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-carousel>
|
</p-carousel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,6 +8,8 @@ import { Router } from "@angular/router";
|
||||||
import { AuthService } from "app/auth/auth.service";
|
import { AuthService } from "app/auth/auth.service";
|
||||||
import { NotificationService, RequestService } from "app/services";
|
import { NotificationService, RequestService } from "app/services";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
import { DenyDialogComponent } from '../../../media-details/components/shared/deny-dialog/deny-dialog.component';
|
||||||
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
|
|
||||||
export enum DiscoverType {
|
export enum DiscoverType {
|
||||||
Upcoming,
|
Upcoming,
|
||||||
|
@ -42,7 +44,8 @@ export class RecentlyRequestedListComponent implements OnInit, OnDestroy {
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private translateService: TranslateService) {
|
private translateService: TranslateService,
|
||||||
|
public dialog: MatDialog) {
|
||||||
Carousel.prototype.onTouchMove = () => {};
|
Carousel.prototype.onTouchMove = () => {};
|
||||||
this.responsiveOptions = ResponsiveOptions;
|
this.responsiveOptions = ResponsiveOptions;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +84,20 @@ export class RecentlyRequestedListComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public deny(request: IRecentlyRequested) {
|
||||||
|
const dialogRef = this.dialog.open(DenyDialogComponent, {
|
||||||
|
width: '250px',
|
||||||
|
data: { requestId: request.requestId, is4K: false, requestType: request.type }
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
|
if (result) {
|
||||||
|
this.notificationService.success(this.translateService.instant("Requests.SuccessfullyDenied"));
|
||||||
|
request.denied = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private handleApproval(result: IRequestEngineResult, request: IRecentlyRequested) {
|
private handleApproval(result: IRequestEngineResult, request: IRecentlyRequested) {
|
||||||
if (result.result) {
|
if (result.result) {
|
||||||
this.notificationService.success(this.translateService.instant("Requests.SuccessfullyApproved"));
|
this.notificationService.success(this.translateService.instant("Requests.SuccessfullyApproved"));
|
||||||
|
|
|
@ -221,6 +221,7 @@
|
||||||
"Denied": "Successfully denied selected items"
|
"Denied": "Successfully denied selected items"
|
||||||
},
|
},
|
||||||
"SuccessfullyApproved": "Successfully Approved",
|
"SuccessfullyApproved": "Successfully Approved",
|
||||||
|
"SuccessfullyDenied": "Successfully Denied",
|
||||||
"SuccessfullyDeleted": "Request successfully deleted",
|
"SuccessfullyDeleted": "Request successfully deleted",
|
||||||
"NowAvailable": "Request is now available",
|
"NowAvailable": "Request is now available",
|
||||||
"NowUnavailable": "Request is now unavailable",
|
"NowUnavailable": "Request is now unavailable",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue