Fixed up the episode request modal a bit

This commit is contained in:
Jamie Rees 2019-03-12 13:10:06 +00:00
commit 619e22827f
7 changed files with 191 additions and 173 deletions

View file

@ -9,7 +9,7 @@ namespace Ombi.Helpers
{
const string mutexId = "Global\\OMBI";
using (var mutex = new Mutex(false, mutexId, out __))
using (var mutex = new Mutex(false, mutexId, out var __))
{
var hasHandle = false;
try

View file

@ -150,11 +150,4 @@
</div>
</section>
</div>

View file

@ -51,7 +51,7 @@ export class TvDetailsComponent {
}
public async request() {
this.dialog.open(EpisodeRequestComponent, { width: "700px", data: this.tv })
this.dialog.open(EpisodeRequestComponent, { width: "800px", data: this.tv })
}
public openDialog() {

View file

@ -2,13 +2,26 @@
<mat-spinner *ngIf="loading" [color]="'accent'"></mat-spinner>
</div>
<div *ngIf="!loading" mat-dialog-content class="background">
<div class="row">
<div class="row">
<div class="col-12 action-buttons-right">
<button (click)="requestAllSeasons()" color="primary" mat-raised-button class="btn-spacing"
matTooltip="{{'MediaDetails.EpisodeSelector.AllSeasonsTooltip' | translate}}">{{'Search.TvShows.AllSeasons' | translate }}</button>
<button (click)="requestFirstSeason()" color="accent" mat-raised-button class="btn-spacing"
matTooltip="{{'MediaDetails.EpisodeSelector.FirstSeasonTooltip' | translate}}">{{ 'Search.TvShows.FirstSeason' | translate }}</button>
<button (click)="requestLatestSeason()" color="warn" mat-raised-button class="btn-spacing"
matTooltip="{{'MediaDetails.EpisodeSelector.LatestSeasonTooltip' | translate}}">{{ 'Search.TvShows.LatestSeason' | translate }}</button>
</div>
</div>
<div class="row">
<div class="col-12" *ngFor="let season of series.seasonRequests">
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
<mat-checkbox *ngIf="!season.seasonAvailable" (click)="$event.stopPropagation();" (change)="seasonChanged($event, season)"> Season {{season.seasonNumber}}</mat-checkbox>
<mat-checkbox *ngIf="!season.seasonAvailable" (click)="$event.stopPropagation();" (change)="seasonChanged($event, season)">
Season {{season.seasonNumber}}</mat-checkbox>
<span *ngIf="season.seasonAvailable">Season {{season.seasonNumber}}</span>
</mat-panel-title>
<mat-panel-description>
@ -36,17 +49,15 @@
{{ep.airDateDisplay }}
</div>
<div class="col-3">
<ng-template [ngIf]="ep.available"><span class="label label-success"
id="availableLabel">Available</span></ng-template>
<ng-template [ngIf]="ep.approved && !ep.available "><span class="label label-info"
id="processingRequestLabel">Processing Request</span></ng-template>
<ng-template [ngIf]="ep.selected"><span class="label label-info"
id="selectedLabel">Selected</span></ng-template>
<ng-template [ngIf]="ep.requested && !ep.approved && !ep.available && !ep.selected"><span
class="label label-warning" id="pendingApprovalLabel">Pending Approval</span>
<ng-template [ngIf]="ep.available"><span class="label label-success" id="availableLabel">Available</span></ng-template>
<ng-template [ngIf]="ep.approved && !ep.available "><span class="label label-info" id="processingRequestLabel">Processing
Request</span></ng-template>
<ng-template [ngIf]="ep.selected"><span class="label label-info" id="selectedLabel">Selected</span></ng-template>
<ng-template [ngIf]="ep.requested && !ep.approved && !ep.available && !ep.selected"><span class="label label-warning"
id="pendingApprovalLabel">Pending Approval</span>
</ng-template>
<ng-template [ngIf]="!ep.requested && !ep.available && !ep.approved && !ep.selected"><span
class="label label-danger" id="notRequetsedLabel">Not Requested</span></ng-template>
<ng-template [ngIf]="!ep.requested && !ep.available && !ep.approved && !ep.selected"><span class="label label-danger"
id="notRequetsedLabel">Not Requested</span></ng-template>
</div>
</div>
@ -63,11 +74,10 @@
</div>
<div mat-dialog-actions>
<div class="action-buttons-right">
<div class="col-md-12">
<button (click)="submitRequests()" mat-raised-button class="btn-spacing btn-orange">{{
'Common.Request' | translate }}</button>
</div>
</div>
</div>

View file

@ -29,8 +29,8 @@ export class EpisodeRequestComponent implements OnInit {
return ep.selected;
});
});
if (!selected) {
debugger;
if (!selected && !this.series.requestAll && !this.series.firstSeason && !this.series.latestSeason) {
this.notificationService.send("You need to select some episodes!", "OK");
return;
}
@ -41,15 +41,14 @@ export class EpisodeRequestComponent implements OnInit {
viewModel.seasons = [];
this.series.seasonRequests.forEach((season) => {
const seasonsViewModel = <ISeasonsViewModel>{ seasonNumber: season.seasonNumber, episodes: [] };
if (!this.series.latestSeason && !this.series.requestAll && !this.series.firstSeason) {
season.episodes.forEach(ep => {
if (!this.series.latestSeason || !this.series.requestAll || !this.series.firstSeason) {
if (ep.selected) {
ep.requested = true;
seasonsViewModel.episodes.push({ episodeNumber: ep.episodeNumber });
}
}
});
}
viewModel.seasons.push(seasonsViewModel);
});
@ -81,11 +80,26 @@ export class EpisodeRequestComponent implements OnInit {
public seasonChanged(checkbox: MatCheckboxChange, season: INewSeasonRequests) {
season.episodes.forEach((ep) => {
if (checkbox.checked) {
if (checkbox.checked && (!ep.available && !ep.requested && !ep.approved)) {
this.addRequest(ep)
} else {
this.removeRequest(ep);
}
});
}
public async requestAllSeasons() {
this.series.requestAll = true;
await this.submitRequests();
}
public async requestFirstSeason() {
this.series.firstSeason = true;
await this.submitRequests();
}
public async requestLatestSeason() {
this.series.latestSeason = true;
await this.submitRequests();
}
}

View file

@ -43,6 +43,7 @@ import { EpisodeRequestComponent } from "./episode-request/episode-request.compo
TranslateModule,
MatExpansionModule,
MatDialogModule,
MatTooltipModule,
],
entryComponents: [
EpisodeRequestComponent

View file

@ -38,10 +38,8 @@
"OnlineParagraph": "The media server is currently online",
"PartiallyOnlineHeading": "Partially Online",
"PartiallyOnlineParagraph": "The media server is partially online.",
"MultipleServersUnavailable":
"There are {{serversUnavailable}} servers offline out of {{totalServers}}.",
"SingleServerUnavailable":
"There is {{serversUnavailable}} server offline out of {{totalServers}}.",
"MultipleServersUnavailable": "There are {{serversUnavailable}} servers offline out of {{totalServers}}.",
"SingleServerUnavailable": "There is {{serversUnavailable}} server offline out of {{totalServers}}.",
"OfflineHeading": "Currently Offline",
"OfflineParagraph": "The media server is currently offline.",
"CheckPageForUpdates": "Check this page for continuous site updates."
@ -55,8 +53,7 @@
"Vote": "Vote",
"Donate": "Donate!",
"DonateLibraryMaintainer": "Donate to Library Maintainer",
"DonateTooltip":
"This is how I convince my wife to let me spend my spare time developing Ombi ;)",
"DonateTooltip": "This is how I convince my wife to let me spend my spare time developing Ombi ;)",
"UpdateAvailableTooltip": "Update Available!",
"Settings": "Settings",
"Welcome": "Welcome {{username}}",
@ -67,8 +64,7 @@
},
"Search": {
"Title": "Search",
"Paragraph":
"Want to watch something that is not currently available? No problem, just search for it below and request it!",
"Paragraph": "Want to watch something that is not currently available? No problem, just search for it below and request it!",
"MoviesTab": "Movies",
"TvTab": "TV Shows",
"MusicTab": "Music",
@ -107,8 +103,7 @@
},
"Requests": {
"Title": "Requests",
"Paragraph":
"Below you can see yours and all other requests, as well as their download and approval status.",
"Paragraph": "Below you can see yours and all other requests, as well as their download and approval status.",
"MoviesTab": "Movies",
"TvTab": "TV Shows",
"MusicTab": "Music",
@ -200,6 +195,12 @@
"Character": "Character",
"Actor": "Actor"
},
"EpisodeSelector":{
"AllSeasonsTooltip":"This will request every season for this show",
"FirstSeasonTooltip":"This will only request the First Season for this show",
"LatestSeasonTooltip":"This will only request the Latest Season for this show"
}
},
"Discovery": {
"PopularTab": "Popular",
"TrendingTab": "Trending",
@ -218,4 +219,3 @@
}
}
}
}