From 1763623b2cd38a210bc224793a4e5f025789f4ab Mon Sep 17 00:00:00 2001 From: Florian Dupret <34862846+sephrat@users.noreply.github.com> Date: Thu, 24 Feb 2022 16:51:57 +0100 Subject: [PATCH] Hide 'Has 4K Request' column list if feature disabled --- .../movies-grid/movies-grid.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 984994016..de3f8de39 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 @@ -13,6 +13,7 @@ import { RequestServiceV2 } from "../../../services/requestV2.service"; import { SelectionModel } from "@angular/cdk/collections"; import { StorageService } from "../../../shared/storage/storage-service"; import { TranslateService } from "@ngx-translate/core"; +import { FeaturesFacade } from "../../../state/features/features.facade"; @Component({ templateUrl: "./movies-grid.component.html", @@ -26,6 +27,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { public displayedColumns: string[] = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate', 'actions']; public gridCount: string = "15"; public isAdmin: boolean; + public is4kEnabled = false; public manageOwnRequests: boolean; public defaultSort: string = "requestedDate"; public defaultOrder: string = "desc"; @@ -49,7 +51,8 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { constructor(private requestService: RequestServiceV2, private ref: ChangeDetectorRef, private auth: AuthService, private storageService: StorageService, private requestServiceV1: RequestService, private notification: NotificationService, - private translateService: TranslateService) { + private translateService: TranslateService, + private featureFacade: FeaturesFacade) { this.userName = auth.claims().name; } @@ -59,10 +62,14 @@ 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'); + } + + this.is4kEnabled = this.featureFacade.is4kEnabled(); + if ((this.isAdmin || this.auth.hasRole("Request4KMovie")) + && this.is4kEnabled) { + this.displayedColumns.splice(4, 0, 'has4kRequest'); } + const defaultCount = this.storageService.get(this.storageKeyGridCount); const defaultSort = this.storageService.get(this.storageKey); const defaultOrder = this.storageService.get(this.storageKeyOrder);