mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Fixed up the TV Grid's request status's
This commit is contained in:
parent
e94af7db79
commit
1c8786ea27
4 changed files with 65 additions and 52 deletions
|
@ -41,11 +41,11 @@
|
||||||
<td mat-cell *matCellDef="let element"> {{element.requestStatus | translate}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.requestStatus | translate}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="actions">
|
<ng-container matColumnDef="actions" >
|
||||||
<th mat-header-cell *matHeaderCellDef> </th>
|
<th mat-header-cell *matHeaderCellDef> </th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element" >
|
||||||
<button mat-raised-button color="accent" [routerLink]="'/details/movie/' + element.theMovieDbId">Details</button>
|
<button mat-raised-button color="accent" [routerLink]="'/details/movie/' + element.theMovieDbId">Details</button>
|
||||||
<button mat-raised-button color="warn" (click)="openOptions(element)">Options</button>
|
<button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin">Options</button>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { merge, Observable, of as observableOf } from 'rxjs';
|
||||||
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
|
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { RequestServiceV2 } from "../../../services/requestV2.service";
|
import { RequestServiceV2 } from "../../../services/requestV2.service";
|
||||||
|
import { AuthService } from "../../../auth/auth.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./movies-grid.component.html",
|
templateUrl: "./movies-grid.component.html",
|
||||||
|
@ -18,13 +19,15 @@ export class MoviesGridComponent implements AfterViewInit {
|
||||||
public displayedColumns: string[] = ['requestedUser.requestedBy', 'title', 'requestedDate', 'status', 'requestStatus', 'actions'];
|
public displayedColumns: string[] = ['requestedUser.requestedBy', 'title', 'requestedDate', 'status', 'requestStatus', 'actions'];
|
||||||
public gridCount: string = "15";
|
public gridCount: string = "15";
|
||||||
public showUnavailableRequests: boolean;
|
public showUnavailableRequests: boolean;
|
||||||
|
public isAdmin: boolean;
|
||||||
|
|
||||||
@Output() public onOpenOptions = new EventEmitter<{request: any, filter: any, onChange: any}>();
|
@Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any }>();
|
||||||
|
|
||||||
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
|
||||||
@ViewChild(MatSort, { static: false }) sort: MatSort;
|
@ViewChild(MatSort, { static: false }) sort: MatSort;
|
||||||
|
|
||||||
constructor(private requestService: RequestServiceV2, private ref: ChangeDetectorRef) {
|
constructor(private requestService: RequestServiceV2, private ref: ChangeDetectorRef,
|
||||||
|
private auth: AuthService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +37,8 @@ export class MoviesGridComponent implements AfterViewInit {
|
||||||
// this.dataSource = results.collection;
|
// this.dataSource = results.collection;
|
||||||
// this.resultsLength = results.total;
|
// this.resultsLength = results.total;
|
||||||
|
|
||||||
|
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||||
|
|
||||||
// If the user changes the sort order, reset back to the first page.
|
// If the user changes the sort order, reset back to the first page.
|
||||||
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
||||||
|
|
||||||
|
@ -69,14 +74,16 @@ export class MoviesGridComponent implements AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public openOptions(request: IMovieRequests) {
|
public openOptions(request: IMovieRequests) {
|
||||||
const filter = () => { this.dataSource = this.dataSource.filter((req) => {
|
const filter = () => {
|
||||||
|
this.dataSource = this.dataSource.filter((req) => {
|
||||||
return req.id !== request.id;
|
return req.id !== request.id;
|
||||||
})};
|
})
|
||||||
|
};
|
||||||
|
|
||||||
const onChange = () => {
|
const onChange = () => {
|
||||||
this.ref.detectChanges();
|
this.ref.detectChanges();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onOpenOptions.emit({request: request, filter: filter, onChange: onChange});
|
this.onOpenOptions.emit({ request: request, filter: filter, onChange: onChange });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<table mat-table [dataSource]="dataSource" class="table" matSort matSortActive="title"
|
<table mat-table [dataSource]="dataSource" class="table" matSort matSortActive="title" matSortDisableClear
|
||||||
matSortDisableClear matSortDirection="desc">
|
matSortDirection="desc">
|
||||||
|
|
||||||
|
|
||||||
<ng-container matColumnDef="series">
|
<ng-container matColumnDef="series">
|
||||||
|
@ -21,14 +21,14 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="requestedBy">
|
<ng-container matColumnDef="requestedBy">
|
||||||
<th mat-header-cell *matHeaderCellDef > Requested By </th>
|
<th mat-header-cell *matHeaderCellDef> Requested By </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.requestedUser.userAlias}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.requestedUser.userAlias}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ng-container matColumnDef="status">
|
<ng-container matColumnDef="status">
|
||||||
<th mat-header-cell *matHeaderCellDef > Status </th>
|
<th mat-header-cell *matHeaderCellDef> Status </th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
{{element.parentRequest.status}}
|
{{element.parentRequest.status}}
|
||||||
</td>
|
</td>
|
||||||
|
@ -42,23 +42,21 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="requestStatus">
|
<ng-container matColumnDef="requestStatus">
|
||||||
<th mat-header-cell *matHeaderCellDef > Request Status </th>
|
<th mat-header-cell *matHeaderCellDef> Request Status </th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<div *ngIf="element.approved && !element.available">{{'Common.ProcessingRequest' | translate}}</div>
|
<div *ngIf="element.approved && !element.available">{{'Common.ProcessingRequest' | translate}}</div>
|
||||||
<div *ngIf="element.requested && !element.approved && !element.available">{{'Common.PendingApproval' |
|
<div *ngIf="!element.approved && !element.available">{{'Common.PendingApproval' |translate}}</div>
|
||||||
translate}}
|
<div *ngIf="element.available">{{'Common.Available' | translate}}</div>
|
||||||
</div>
|
|
||||||
<div *ngIf="!element.requested && !element.available && !element.approved">{{'Common.NotRequested' |
|
|
||||||
translate}}
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="actions">
|
<ng-container matColumnDef="actions">
|
||||||
<th mat-header-cell *matHeaderCellDef> </th>
|
<th mat-header-cell *matHeaderCellDef> </th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<button mat-raised-button color="accent" [routerLink]="'/details/tv/' + element.parentRequest.tvDbId">Details</button>
|
<button mat-raised-button color="accent"
|
||||||
<button mat-raised-button color="warn" (click)="openOptions(element)">Options</button>
|
[routerLink]="'/details/tv/' + element.parentRequest.tvDbId">Details</button>
|
||||||
|
<button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin">Options</button>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { Component, AfterViewInit, ViewChild, Output, EventEmitter } from "@angular/core";
|
import { Component, AfterViewInit, ViewChild, Output, EventEmitter, ChangeDetectorRef } from "@angular/core";
|
||||||
import { IRequestsViewModel, IChildRequests } from "../../../interfaces";
|
import { IRequestsViewModel, IChildRequests } from "../../../interfaces";
|
||||||
import { MatPaginator, MatSort } from "@angular/material";
|
import { MatPaginator, MatSort } from "@angular/material";
|
||||||
import { merge, of as observableOf, Observable } from 'rxjs';
|
import { merge, of as observableOf, Observable } from 'rxjs';
|
||||||
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
|
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { RequestServiceV2 } from "../../../services/requestV2.service";
|
import { RequestServiceV2 } from "../../../services/requestV2.service";
|
||||||
|
import { AuthService } from "../../../auth/auth.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./tv-grid.component.html",
|
templateUrl: "./tv-grid.component.html",
|
||||||
|
@ -18,18 +19,21 @@ export class TvGridComponent implements AfterViewInit {
|
||||||
public displayedColumns: string[] = ['series', 'requestedBy', 'status', 'requestStatus', 'requestedDate','actions'];
|
public displayedColumns: string[] = ['series', 'requestedBy', 'status', 'requestStatus', 'requestedDate','actions'];
|
||||||
public gridCount: string = "15";
|
public gridCount: string = "15";
|
||||||
public showUnavailableRequests: boolean;
|
public showUnavailableRequests: boolean;
|
||||||
|
public isAdmin: boolean;
|
||||||
|
|
||||||
@Output() public onOpenOptions = new EventEmitter<{request: any, filter: any}>();
|
@Output() public onOpenOptions = new EventEmitter<{request: any, filter: any, onChange: any}>();
|
||||||
|
|
||||||
@ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
|
@ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
|
||||||
@ViewChild(MatSort, {static: false}) sort: MatSort;
|
@ViewChild(MatSort, {static: false}) sort: MatSort;
|
||||||
|
|
||||||
constructor(private requestService: RequestServiceV2) {
|
constructor(private requestService: RequestServiceV2, private auth: AuthService,
|
||||||
|
private ref: ChangeDetectorRef) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ngAfterViewInit() {
|
public async ngAfterViewInit() {
|
||||||
|
|
||||||
|
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||||
// If the user changes the sort order, reset back to the first page.
|
// If the user changes the sort order, reset back to the first page.
|
||||||
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
||||||
|
|
||||||
|
@ -59,7 +63,11 @@ export class TvGridComponent implements AfterViewInit {
|
||||||
return req.id !== request.id;
|
return req.id !== request.id;
|
||||||
})};
|
})};
|
||||||
|
|
||||||
this.onOpenOptions.emit({request: request, filter: filter});
|
const onChange = () => {
|
||||||
|
this.ref.detectChanges();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onOpenOptions.emit({request: request, filter: filter, onChange});
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadData(): Observable<IRequestsViewModel<IChildRequests>> {
|
private loadData(): Observable<IRequestsViewModel<IChildRequests>> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue