feat: Added 4k approve to the request list options

radarr4k
tidusjar 3 years ago
parent 0c65f1f320
commit fd58570077

@ -1,14 +1,14 @@
import { Component, AfterViewInit, ViewChild, EventEmitter, Output, ChangeDetectorRef, OnInit } from "@angular/core";
import { IRequestsViewModel, IAlbumRequest } from "../../../interfaces";
import { MatPaginator } from "@angular/material/paginator";
import { MatSort } from "@angular/material/sort";
import { merge, Observable, of as observableOf } from 'rxjs';
import { AfterViewInit, ChangeDetectorRef, Component, EventEmitter, OnInit, Output, ViewChild } from "@angular/core";
import { IAlbumRequest, IRequestsViewModel } from "../../../interfaces";
import { Observable, merge, of as observableOf } from 'rxjs';
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
import { RequestServiceV2 } from "../../../services/requestV2.service";
import { AuthService } from "../../../auth/auth.service";
import { StorageService } from "../../../shared/storage/storage-service";
import { MatPaginator } from "@angular/material/paginator";
import { MatSort } from "@angular/material/sort";
import { RequestFilterType } from "../../models/RequestFilterType";
import { RequestServiceV2 } from "../../../services/requestV2.service";
import { StorageService } from "../../../shared/storage/storage-service";
@Component({
templateUrl: "./albums-grid.component.html",
@ -130,7 +130,7 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {
this.ref.detectChanges();
};
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin };
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: false };
this.onOpenOptions.emit(data);
}

@ -139,7 +139,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
this.ref.detectChanges();
};
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin };
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: request.has4KRequest };
this.onOpenOptions.emit(data);
}

@ -5,6 +5,9 @@
<a id="requestApprove" *ngIf="data.canApprove && data.isAdmin" (click)="approve()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.Approve' | translate}}</span>
</a>
<a id="requestApprove4k" *ngIf="data.canApprove && data.isAdmin && data.has4kRequest" (click)="approve4k()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.Approve4K' | translate}}</span>
</a>
<a id="requestChangeAvailability" *ngIf="data.type !== RequestType.tvShow && data.isAdmin" (click)="changeAvailability()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.ChangeAvailability' | translate}}</span>
</a>

@ -15,7 +15,7 @@ export class RequestOptionsComponent {
public RequestType = RequestType;
constructor(@Inject(MAT_BOTTOM_SHEET_DATA) public data: any,
private requestService: RequestService,
private requestService: RequestService,
private messageService: MessageService,
private bottomSheetRef: MatBottomSheetRef<RequestOptionsComponent>,
private translate: TranslateService) { }
@ -43,7 +43,6 @@ export class RequestOptionsComponent {
}
public async approve() {
// TODO 4K
if (this.data.type === RequestType.movie) {
await firstValueFrom(this.requestService.approveMovie({id: this.data.id, is4K: false}));
}
@ -58,6 +57,14 @@ export class RequestOptionsComponent {
return;
}
public async approve4K() {
if (this.data.type != RequestType.movie) {
return;
}
await firstValueFrom(this.requestService.approveMovie({id: this.data.id, is4K: true}));
}
public async changeAvailability() {
if (this.data.type === RequestType.movie) {
// TODO 4K

@ -1,7 +1,6 @@
import { Component, ViewChild } from "@angular/core";
import { MatBottomSheet } from "@angular/material/bottom-sheet";
import { MoviesGridComponent } from "./movies-grid/movies-grid.component";
import { RequestOptionsComponent } from "./options/request-options.component";
import { UpdateType } from "../models/UpdateType";
@ -13,8 +12,8 @@ export class RequestsListComponent {
constructor(private bottomSheet: MatBottomSheet) { }
public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean }) {
const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove, manageOwnRequests: event.manageOwnRequests, isAdmin: event.isAdmin } });
public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean, has4kRequest: boolean }) {
const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove, manageOwnRequests: event.manageOwnRequests, isAdmin: event.isAdmin, has4kRequest: event.has4kRequest } });
ref.afterDismissed().subscribe((result) => {
if(!result) {

@ -1,14 +1,14 @@
import { Component, AfterViewInit, ViewChild, Output, EventEmitter, ChangeDetectorRef, OnInit } from "@angular/core";
import { IRequestsViewModel, IChildRequests } from "../../../interfaces";
import { MatPaginator } from "@angular/material/paginator";
import { MatSort } from "@angular/material/sort";
import { merge, of as observableOf, Observable } from 'rxjs';
import { AfterViewInit, ChangeDetectorRef, Component, EventEmitter, OnInit, Output, ViewChild } from "@angular/core";
import { IChildRequests, IRequestsViewModel } from "../../../interfaces";
import { Observable, merge, of as observableOf } from 'rxjs';
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
import { RequestServiceV2 } from "../../../services/requestV2.service";
import { AuthService } from "../../../auth/auth.service";
import { StorageService } from "../../../shared/storage/storage-service";
import { MatPaginator } from "@angular/material/paginator";
import { MatSort } from "@angular/material/sort";
import { RequestFilterType } from "../../models/RequestFilterType";
import { RequestServiceV2 } from "../../../services/requestV2.service";
import { StorageService } from "../../../shared/storage/storage-service";
@Component({
templateUrl: "./tv-grid.component.html",
@ -108,7 +108,7 @@ export class TvGridComponent implements OnInit, AfterViewInit {
this.ref.detectChanges();
};
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin };
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: false };
this.onOpenOptions.emit(data);
}

@ -206,6 +206,7 @@
"RequestPanel": {
"Delete":"Delete Request",
"Approve":"Approve Request",
"Approve4K":"Approve 4K Request",
"ChangeAvailability":"Mark Available",
"Deleted": "Successfully deleted selected items",
"Approved": "Successfully approved selected items"

Loading…
Cancel
Save