More work on the deny and also got the Partially flag working !wip

This commit is contained in:
Jamie Rees 2019-03-08 11:13:54 +00:00
commit d4246abad5
12 changed files with 120 additions and 24 deletions

View file

@ -21,6 +21,10 @@ namespace Ombi.Core.Rule.Rules.Search
season.SeasonAvailable = true; season.SeasonAvailable = true;
} }
} }
if(search.SeasonRequests.Any(x => x.Episodes.Any(e => e.Available)))
{
search.PartlyAvailable = true;
}
if (search.SeasonRequests.All(x => x.Episodes.All(e => e.Available))) if (search.SeasonRequests.All(x => x.Episodes.All(e => e.Available)))
{ {
search.FullyAvailable = true; search.FullyAvailable = true;

View file

@ -7,6 +7,7 @@ import { TopBannerComponent } from "./shared/top-banner/top-banner.component";
import { SocialIconsComponent } from "./shared/social-icons/social-icons.component"; import { SocialIconsComponent } from "./shared/social-icons/social-icons.component";
import { MediaPosterComponent } from "./shared/media-poster/media-poster.component"; import { MediaPosterComponent } from "./shared/media-poster/media-poster.component";
import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component"; import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component";
import { DenyDialogComponent } from "./shared/deny-dialog/deny-dialog.component";
export const components: any[] = [ export const components: any[] = [
MovieDetailsComponent, MovieDetailsComponent,
@ -18,4 +19,12 @@ export const components: any[] = [
SocialIconsComponent, SocialIconsComponent,
MediaPosterComponent, MediaPosterComponent,
CastCarouselComponent, CastCarouselComponent,
DenyDialogComponent,
];
export const entryComponents: any[] = [
YoutubeTrailerComponent,
DenyDialogComponent,
]; ];

View file

@ -3,8 +3,6 @@
<top-banner [background]="movie.background" [available]="movie.available" [title]="movie.title" [releaseDate]="movie.releaseDate" <top-banner [background]="movie.background" [available]="movie.available" [title]="movie.title" [releaseDate]="movie.releaseDate"
[tagline]="movie.tagline"></top-banner> [tagline]="movie.tagline"></top-banner>
<section id="info-wrapper"> <section id="info-wrapper">
<div class="small-middle-container"> <div class="small-middle-container">
@ -13,7 +11,7 @@
<media-poster [posterPath]="'https://image.tmdb.org/t/p/w300/' + movie.posterPath"></media-poster> <media-poster [posterPath]="'https://image.tmdb.org/t/p/w300/' + movie.posterPath"></media-poster>
<!--Next to poster--> <!--Next to poster-->
<div class="col-10 col-lg-3 col-xl-3 media-row"> <div class="col-12 col-lg-3 col-xl-3 media-row">
<social-icons [homepage]="movie.homepage" [theMoviedbId]="movie.id" [hasTrailer]="movie.videos.results.length > 0" <social-icons [homepage]="movie.homepage" [theMoviedbId]="movie.id" [hasTrailer]="movie.videos.results.length > 0"
(openTrailer)="openDialog()" [imdbId]="movie.imdbId" [twitter]="movie.externalIds.twitterId" [facebook]="movie.externalIds.facebookId" (openTrailer)="openDialog()" [imdbId]="movie.imdbId" [twitter]="movie.externalIds.twitterId" [facebook]="movie.externalIds.facebookId"
@ -27,13 +25,14 @@
<button mat-raised-button class="btn-green btn-spacing" *ngIf="movie.available"> {{ <button mat-raised-button class="btn-green btn-spacing" *ngIf="movie.available"> {{
'Common.Available' | translate }}</button> 'Common.Available' | translate }}</button>
<span *ngIf="!movie.available"> <span *ngIf="!movie.available">
<span *ngIf="movie.requested || movie.approved; then requestedBtn else notRequestedBtn"></span> <span *ngIf="movie.requested|| movie.approved; then requestedBtn else notRequestedBtn"></span>
<ng-template #requestedBtn> <ng-template #requestedBtn>
<button mat-raised-button class="btn-spacing btn-orange" [disabled]><i class="fa fa-check"></i> <button mat-raised-button *ngIf="!hasRequest || hasRequest && !movieRequest.denied" class="btn-spacing" color="warn" [disabled]><i class="fa fa-check"></i>
{{ 'Common.Requested' | translate }}</button> {{ 'Common.Requested' | translate }}</button>
</ng-template> </ng-template>
<ng-template #notRequestedBtn> <ng-template #notRequestedBtn>
<button mat-raised-button class="btn-spacing" (click)="request()"> <button mat-raised-button class="btn-spacing" color="primary" (click)="request()">
<i *ngIf="movie.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i *ngIf="!movie.requestProcessing && !movie.processed" <i *ngIf="movie.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i *ngIf="!movie.requestProcessing && !movie.processed"
class="fa fa-plus"></i> class="fa fa-plus"></i>
<i *ngIf="movie.processed && !movie.requestProcessing" class="fa fa-check"></i> {{ <i *ngIf="movie.processed && !movie.requestProcessing" class="fa fa-check"></i> {{
@ -45,8 +44,19 @@
<i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }} <i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }}
</button> </button>
<button mat-raised-button class="btn-spacing" color="warn" (click)="deny()"> <i class="fa fa-times"></i> {{ <button *ngIf="hasRequest && !movieRequest.denied" mat-raised-button class="btn-spacing" color="warn" (click)="deny()">
'Requests.Deny' | translate }}</button></span> <i class="fa fa-times"></i> {{
'Requests.Deny' | translate }}</button>
</span>
<button *ngIf="hasRequest && movieRequest.denied" [matTooltip]="movieRequest.deniedReason" mat-raised-button class="btn-spacing" color="warn">
<i class="fa fa-times"></i> {{
'MediaDetails.Denied' | translate }}</button>
</div> </div>
</div> </div>
@ -77,7 +87,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<cast-carousel [cast]="movie.credits.cast"></cast-carousel> <cast-carousel [cast]="movie.credits.cast"></cast-carousel>
</div> </div>
</div> </div>

View file

@ -6,7 +6,8 @@ import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2";
import { MatDialog } from "@angular/material"; import { MatDialog } from "@angular/material";
import { YoutubeTrailerComponent } from "../shared/youtube-trailer.component"; import { YoutubeTrailerComponent } from "../shared/youtube-trailer.component";
import { AuthService } from "../../../auth/auth.service"; import { AuthService } from "../../../auth/auth.service";
import { IMovieRequests, IRadarrProfile, IRadarrRootFolder } from "../../../interfaces"; import { IMovieRequests, IRadarrProfile, IRadarrRootFolder, RequestType } from "../../../interfaces";
import { DenyDialogComponent } from "../shared/deny-dialog/deny-dialog.component";
@Component({ @Component({
templateUrl: "./movie-details.component.html", templateUrl: "./movie-details.component.html",
@ -85,13 +86,17 @@ export class MovieDetailsComponent {
} }
public async deny() { public async deny() {
const result = await this.requestService.denyMovie({ id: this.movieRequest.id, reason: "" }).toPromise(); const dialogRef = this.dialog.open(DenyDialogComponent, {
if (result.result) { width: '250px',
this.movie.approved = false; data: {requestId: this.movieRequest.id, requestType: RequestType.movie}
this.messageService.send(result.message, "Ok"); });
} else {
this.messageService.send(result.errorMessage, "Ok"); dialogRef.afterClosed().subscribe(result => {
} this.movieRequest.denied = result;
if(this.movieRequest.denied) {
this.movie.approved = false;
}
});
} }
public async approve() { public async approve() {

View file

@ -0,0 +1,10 @@
<h1 mat-dialog-title>Deny Reason</h1>
<div mat-dialog-content>
<mat-form-field>
<input matInput [(ngModel)]="denyReason">
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()" [mat-dialog-close]="data.denied">Cancel</button>
<button mat-button (click)="deny()" [mat-dialog-close]="data.denied" cdkFocusInitial>Deny</button>
</div>

View file

@ -0,0 +1,47 @@
import { Component, Inject, Output, EventEmitter } from "@angular/core";
import { IDenyDialogData } from "../interfaces/interfaces";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { RequestService, MessageService } from "../../../../services";
import { RequestType, IRequestEngineResult } from "../../../../interfaces";
@Component({
selector: "deny-dialog",
templateUrl: "./deny-dialog.component.html",
})
export class DenyDialogComponent {
constructor(
public dialogRef: MatDialogRef<DenyDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: IDenyDialogData,
private requestService: RequestService,
public messageService: MessageService) {}
public denyReason: string;
public async deny() {
let result: IRequestEngineResult;
if(this.data.requestType == RequestType.movie) {
result = await this.requestService.denyMovie({id: this.data.requestId, reason: this.denyReason }).toPromise();
}
if(this.data.requestType == RequestType.tvShow) {
result = await this.requestService.denyChild({id: this.data.requestId, reason: this.denyReason }).toPromise();
}
if(this.data.requestType == RequestType.album) {
result = await this.requestService.denyAlbum({id: this.data.requestId, reason: this.denyReason }).toPromise();
}
if (result.result) {
this.messageService.send("Denied Request", "Ok");
this.data.denied = true;
} else {
this.messageService.send(result.errorMessage, "Ok");
this.data.denied = false;
}
this.dialogRef.close();
}
onNoClick(): void {
this.dialogRef.close();
this.data.denied = false;
}
}

View file

@ -0,0 +1,7 @@
import { RequestType } from "../../../../interfaces";
export interface IDenyDialogData {
requestType: RequestType;
requestId: number;
denied: boolean;
}

View file

@ -19,12 +19,14 @@
<div class="col-12 col-lg-6 col-xl-6 media-row"> <div class="col-12 col-lg-6 col-xl-6 media-row">
<button *ngIf="!tv.fullyAvailable" mat-raised-button class="btn-spacing mat-warn" (click)="request()"><i <button *ngIf="!tv.fullyAvailable" mat-raised-button class="btn-spacing" color="primary" (click)="request()"><i
class="fa fa-plus"></i> class="fa fa-plus"></i>
{{ 'Common.Request' | translate }}</button> {{ 'Common.Request' | translate }}</button>
<button *ngIf="tv.fullyAvailable" mat-raised-button class="btn-spacing mat-primary" [disabled]> <button *ngIf="tv.fullyAvailable" mat-raised-button class="btn-spacing" color="accent" [disabled]>
<i class="fa fa-check"></i> {{'Common.Available' | translate }}</button> <i class="fa fa-check"></i> {{'Common.Available' | translate }}</button>
<button *ngIf="tv.partlyAvailable && !tv.fullyAvailable" mat-raised-button class="btn-spacing" color="accent" [disabled]>
<i class="fa fa-check"></i> {{'Common.PartiallyAvailable' | translate }}</button>
</div> </div>
</div> </div>

View file

@ -114,7 +114,7 @@
} }
#info-wrapper .sidebar-poster { #info-wrapper .sidebar-poster {
margin-top: -300px; margin-top: -280px;
width: 250px; width: 250px;
} }

View file

@ -9,7 +9,6 @@ import { SharedModule } from "../shared/shared.module";
import { MovieDetailsComponent } from "./components/movie/movie-details.component"; import { MovieDetailsComponent } from "./components/movie/movie-details.component";
import { TvDetailsComponent } from "./components/tv/tv-details.component"; import { TvDetailsComponent } from "./components/tv/tv-details.component";
import { PipeModule } from "../pipes/pipe.module"; import { PipeModule } from "../pipes/pipe.module";
import { YoutubeTrailerComponent } from "./components/shared/youtube-trailer.component";
import * as fromComponents from './components'; import * as fromComponents from './components';
import { AuthGuard } from "../auth/auth.guard"; import { AuthGuard } from "../auth/auth.guard";
@ -34,7 +33,7 @@ const routes: Routes = [
RouterModule, RouterModule,
], ],
entryComponents: [ entryComponents: [
YoutubeTrailerComponent ...fromComponents.entryComponents
], ],
providers: [ providers: [
SearchService, SearchService,

View file

@ -66,7 +66,7 @@ export class EpisodeRequestComponent implements OnInit {
}); });
} else { } else {
this.notificationService.send("Request Added", requestResult.errorMessage ? requestResult.errorMessage : requestResult.message); this.notificationService.send(requestResult.errorMessage ? requestResult.errorMessage : requestResult.message);
} }
this.dialogRef.close(); this.dialogRef.close();
} }

View file

@ -188,5 +188,8 @@
"Votes": { "Votes": {
"CompletedVotesTab": "Voted", "CompletedVotesTab": "Voted",
"VotesTab": "Votes Needed" "VotesTab": "Votes Needed"
},
"MediaDetails": {
"Denied": "Denied"
} }
} }