mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-06 13:11:13 -07:00
feat: Hide watched status when request is not available (#4934)
This commit is contained in:
parent
9424586e9c
commit
82c7f1c44f
1 changed files with 12 additions and 7 deletions
|
@ -24,7 +24,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
public dataSource: MatTableDataSource<IMovieRequests>;
|
||||
public resultsLength: number;
|
||||
public isLoadingResults = true;
|
||||
public displayedColumns: string[] = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate'];
|
||||
public displayedColumns: string[];
|
||||
public gridCount: string = "15";
|
||||
public isAdmin: boolean;
|
||||
public is4kEnabled = false;
|
||||
|
@ -61,14 +61,10 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
public ngOnInit() {
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
this.manageOwnRequests = this.auth.hasRole("ManageOwnRequests")
|
||||
if (this.isAdmin) {
|
||||
this.displayedColumns.unshift('select');
|
||||
}
|
||||
|
||||
this.is4kEnabled = this.featureFacade.is4kEnabled();
|
||||
this.isPlayedSyncEnabled = this.featureFacade.isPlayedSyncEnabled();
|
||||
|
||||
this.addDynamicColumns();
|
||||
|
||||
const defaultCount = this.storageService.get(this.storageKeyGridCount);
|
||||
const defaultSort = this.storageService.get(this.storageKey);
|
||||
|
@ -88,13 +84,20 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
}
|
||||
}
|
||||
|
||||
addDynamicColumns() {
|
||||
setDisplayedColumns() {
|
||||
this.displayedColumns = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate'];
|
||||
|
||||
if (this.isAdmin) {
|
||||
this.displayedColumns.unshift('select');
|
||||
}
|
||||
|
||||
if ((this.isAdmin || this.auth.hasRole("Request4KMovie"))
|
||||
&& this.is4kEnabled) {
|
||||
this.displayedColumns.splice(4, 0, 'has4kRequest');
|
||||
}
|
||||
|
||||
if (this.isPlayedSyncEnabled) {
|
||||
if (this.isPlayedSyncEnabled
|
||||
&& ( this.currentFilter == RequestFilterType.All || this.currentFilter == RequestFilterType.Available ) ) {
|
||||
this.displayedColumns.push('watchedByRequestedUser');
|
||||
}
|
||||
|
||||
|
@ -104,6 +107,8 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
|
||||
public async ngAfterViewInit() {
|
||||
|
||||
this.setDisplayedColumns();
|
||||
|
||||
this.storageService.save(this.storageKeyGridCount, this.gridCount);
|
||||
this.storageService.save(this.storageKeyCurrentFilter, (+this.currentFilter).toString());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue