From 9b1a1062ac47f9976c63ea457ec4bf9e2653ce5e Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sun, 13 Feb 2022 20:28:01 +0000 Subject: [PATCH] feat: Added 4k to the requests list and bulk approve --- .../src/app/interfaces/IRequestModel.ts | 1 + .../movies-grid/movies-grid.component.html | 11 ++++++++++- .../movies-grid/movies-grid.component.ts | 18 ++++++++++++++++-- src/Ombi/wwwroot/translations/en.json | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts index 766264e9f..1ccbd355b 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts @@ -21,6 +21,7 @@ export interface IMovieRequests extends IFullBaseRequest { available4K: boolean; denied4K: boolean; deniedReason4K: string; + requestedDate4k: Date; // For the UI rootPathOverrideTitle: string; diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html index 61baa3eaa..d9366e7d1 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html @@ -58,7 +58,7 @@ {{ 'Requests.RequestDate' | translate}} - {{element.requestedDate | amLocal | amUserLocale | amDateFormat: 'LL'}} + {{getRequestDate(element) | amLocal | amUserLocale | amDateFormat: 'LL'}} @@ -66,6 +66,14 @@ {{element.status |translateStatus }} + + {{ 'Requests.Has4KRequest' | translate}} + + + + + + {{ 'Requests.RequestStatus' | translate}} @@ -92,4 +100,5 @@ + \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts index 49b5498ed..b3283bb73 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts @@ -59,6 +59,9 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { this.manageOwnRequests = this.auth.hasRole("ManageOwnRequests") if (this.isAdmin) { this.displayedColumns.unshift('select'); + this.displayedColumns.splice(4,0,'has4kRequest'); + } else if (this.auth.hasRole("Request4KMovie")) { + this.displayedColumns.splice(4,0,'has4kRequest'); } const defaultCount = this.storageService.get(this.storageKeyGridCount); const defaultSort = this.storageService.get(this.storageKey); @@ -176,13 +179,17 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { }); } - public bulkApprove() { + public bulkApprove = () => this.bulkApproveInternal(false); + + public bulkApprove4K = () => this.bulkApproveInternal(true); + + private bulkApproveInternal(is4k: boolean) { if (this.selection.isEmpty()) { return; } let tasks = new Array>(); this.selection.selected.forEach((selected) => { - tasks.push(this.requestServiceV1.approveMovie({ id: selected.id, is4K: false })); + tasks.push(this.requestServiceV1.approveMovie({ id: selected.id, is4K: is4k })); }); this.isLoadingResults = true; @@ -199,4 +206,11 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { this.ngAfterViewInit(); }) } + + public getRequestDate(request: IMovieRequests) : Date { + if (new Date(request.requestedDate).getFullYear() === 1) { + return request.requestedDate4k; + } + return request.requestedDate; + } } \ No newline at end of file diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json index de01d45cb..d0e282dce 100644 --- a/src/Ombi/wwwroot/translations/en.json +++ b/src/Ombi/wwwroot/translations/en.json @@ -171,6 +171,7 @@ "Remove": "Remove", "Deny": "Deny", "Deny4K": "Deny 4K", + "Has4KRequest": "Has 4K Request", "DenyReason": "Deny Reason", "DeniedReason": "Denied Reason", "Season": "Season",