mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
More work on the deny and also got the Partially flag working !wip
This commit is contained in:
parent
b7f74d9f96
commit
d4246abad5
12 changed files with 120 additions and 24 deletions
|
@ -21,6 +21,10 @@ namespace Ombi.Core.Rule.Rules.Search
|
|||
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)))
|
||||
{
|
||||
search.FullyAvailable = true;
|
||||
|
|
|
@ -7,6 +7,7 @@ import { TopBannerComponent } from "./shared/top-banner/top-banner.component";
|
|||
import { SocialIconsComponent } from "./shared/social-icons/social-icons.component";
|
||||
import { MediaPosterComponent } from "./shared/media-poster/media-poster.component";
|
||||
import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component";
|
||||
import { DenyDialogComponent } from "./shared/deny-dialog/deny-dialog.component";
|
||||
|
||||
export const components: any[] = [
|
||||
MovieDetailsComponent,
|
||||
|
@ -18,4 +19,12 @@ export const components: any[] = [
|
|||
SocialIconsComponent,
|
||||
MediaPosterComponent,
|
||||
CastCarouselComponent,
|
||||
DenyDialogComponent,
|
||||
];
|
||||
|
||||
|
||||
|
||||
export const entryComponents: any[] = [
|
||||
YoutubeTrailerComponent,
|
||||
DenyDialogComponent,
|
||||
];
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
<top-banner [background]="movie.background" [available]="movie.available" [title]="movie.title" [releaseDate]="movie.releaseDate"
|
||||
[tagline]="movie.tagline"></top-banner>
|
||||
|
||||
|
||||
|
||||
<section id="info-wrapper">
|
||||
<div class="small-middle-container">
|
||||
|
||||
|
@ -13,7 +11,7 @@
|
|||
<media-poster [posterPath]="'https://image.tmdb.org/t/p/w300/' + movie.posterPath"></media-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"
|
||||
(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"> {{
|
||||
'Common.Available' | translate }}</button>
|
||||
<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>
|
||||
<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>
|
||||
</ng-template>
|
||||
<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"
|
||||
class="fa fa-plus"></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 }}
|
||||
</button>
|
||||
|
||||
<button mat-raised-button class="btn-spacing" color="warn" (click)="deny()"> <i class="fa fa-times"></i> {{
|
||||
'Requests.Deny' | translate }}</button></span>
|
||||
<button *ngIf="hasRequest && !movieRequest.denied" mat-raised-button class="btn-spacing" color="warn" (click)="deny()">
|
||||
<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>
|
||||
|
@ -77,8 +87,8 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<cast-carousel [cast]="movie.credits.cast"></cast-carousel>
|
||||
|
||||
<cast-carousel [cast]="movie.credits.cast"></cast-carousel>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2";
|
|||
import { MatDialog } from "@angular/material";
|
||||
import { YoutubeTrailerComponent } from "../shared/youtube-trailer.component";
|
||||
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({
|
||||
templateUrl: "./movie-details.component.html",
|
||||
|
@ -85,13 +86,17 @@ export class MovieDetailsComponent {
|
|||
}
|
||||
|
||||
public async deny() {
|
||||
const result = await this.requestService.denyMovie({ id: this.movieRequest.id, reason: "" }).toPromise();
|
||||
if (result.result) {
|
||||
this.movie.approved = false;
|
||||
this.messageService.send(result.message, "Ok");
|
||||
} else {
|
||||
this.messageService.send(result.errorMessage, "Ok");
|
||||
}
|
||||
const dialogRef = this.dialog.open(DenyDialogComponent, {
|
||||
width: '250px',
|
||||
data: {requestId: this.movieRequest.id, requestType: RequestType.movie}
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
this.movieRequest.denied = result;
|
||||
if(this.movieRequest.denied) {
|
||||
this.movie.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async approve() {
|
||||
|
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import { RequestType } from "../../../../interfaces";
|
||||
|
||||
export interface IDenyDialogData {
|
||||
requestType: RequestType;
|
||||
requestId: number;
|
||||
denied: boolean;
|
||||
}
|
|
@ -19,12 +19,14 @@
|
|||
|
||||
<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>
|
||||
{{ '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>
|
||||
<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>
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
}
|
||||
|
||||
#info-wrapper .sidebar-poster {
|
||||
margin-top: -300px;
|
||||
margin-top: -280px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import { SharedModule } from "../shared/shared.module";
|
|||
import { MovieDetailsComponent } from "./components/movie/movie-details.component";
|
||||
import { TvDetailsComponent } from "./components/tv/tv-details.component";
|
||||
import { PipeModule } from "../pipes/pipe.module";
|
||||
import { YoutubeTrailerComponent } from "./components/shared/youtube-trailer.component";
|
||||
|
||||
import * as fromComponents from './components';
|
||||
import { AuthGuard } from "../auth/auth.guard";
|
||||
|
@ -34,7 +33,7 @@ const routes: Routes = [
|
|||
RouterModule,
|
||||
],
|
||||
entryComponents: [
|
||||
YoutubeTrailerComponent
|
||||
...fromComponents.entryComponents
|
||||
],
|
||||
providers: [
|
||||
SearchService,
|
||||
|
|
|
@ -66,7 +66,7 @@ export class EpisodeRequestComponent implements OnInit {
|
|||
});
|
||||
|
||||
} else {
|
||||
this.notificationService.send("Request Added", requestResult.errorMessage ? requestResult.errorMessage : requestResult.message);
|
||||
this.notificationService.send(requestResult.errorMessage ? requestResult.errorMessage : requestResult.message);
|
||||
}
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
|
|
@ -188,5 +188,8 @@
|
|||
"Votes": {
|
||||
"CompletedVotesTab": "Voted",
|
||||
"VotesTab": "Votes Needed"
|
||||
},
|
||||
"MediaDetails": {
|
||||
"Denied": "Denied"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue