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"; 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; var hasHandle = false;
try try

View file

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

View file

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

View file

@ -2,13 +2,26 @@
<mat-spinner *ngIf="loading" [color]="'accent'"></mat-spinner> <mat-spinner *ngIf="loading" [color]="'accent'"></mat-spinner>
</div> </div>
<div *ngIf="!loading" mat-dialog-content class="background"> <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"> <div class="col-12" *ngFor="let season of series.seasonRequests">
<mat-expansion-panel> <mat-expansion-panel>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <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> <span *ngIf="season.seasonAvailable">Season {{season.seasonNumber}}</span>
</mat-panel-title> </mat-panel-title>
<mat-panel-description> <mat-panel-description>
@ -36,17 +49,15 @@
{{ep.airDateDisplay }} {{ep.airDateDisplay }}
</div> </div>
<div class="col-3"> <div class="col-3">
<ng-template [ngIf]="ep.available"><span class="label label-success" <ng-template [ngIf]="ep.available"><span class="label label-success" id="availableLabel">Available</span></ng-template>
id="availableLabel">Available</span></ng-template> <ng-template [ngIf]="ep.approved && !ep.available "><span class="label label-info" id="processingRequestLabel">Processing
<ng-template [ngIf]="ep.approved && !ep.available "><span class="label label-info" Request</span></ng-template>
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.selected"><span class="label label-info" <ng-template [ngIf]="ep.requested && !ep.approved && !ep.available && !ep.selected"><span class="label label-warning"
id="selectedLabel">Selected</span></ng-template> id="pendingApprovalLabel">Pending Approval</span>
<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>
<ng-template [ngIf]="!ep.requested && !ep.available && !ep.approved && !ep.selected"><span <ng-template [ngIf]="!ep.requested && !ep.available && !ep.approved && !ep.selected"><span class="label label-danger"
class="label label-danger" id="notRequetsedLabel">Not Requested</span></ng-template> id="notRequetsedLabel">Not Requested</span></ng-template>
</div> </div>
</div> </div>
@ -63,11 +74,10 @@
</div> </div>
<div mat-dialog-actions> <div mat-dialog-actions>
<div class="action-buttons-right"> <div class="action-buttons-right">
<div class="col-md-12">
<button (click)="submitRequests()" mat-raised-button class="btn-spacing btn-orange">{{ <button (click)="submitRequests()" mat-raised-button class="btn-spacing btn-orange">{{
'Common.Request' | translate }}</button> 'Common.Request' | translate }}</button>
</div> </div>
</div> </div>
</div>

View file

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

View file

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