diff --git a/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts b/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts index 23547add3..b507001e4 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISearchMovieResult.ts @@ -22,4 +22,8 @@ available: boolean; plexUrl: string; quality: string; + + // for the UI + requestProcessing: boolean; + processed: boolean; } diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.html b/src/Ombi/ClientApp/app/search/moviesearch.component.html index 391946c2e..a036a371c 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.html +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.html @@ -85,7 +85,9 @@ - + diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index eff33508a..f5119bc81 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -60,23 +60,38 @@ export class MovieSearchComponent implements OnInit { public request(searchResult: ISearchMovieResult) { searchResult.requested = true; + searchResult.requestProcessing = true; if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) { searchResult.approved = true; } - this.requestService.requestMovie(searchResult) - .subscribe(x => { - this.result = x; + try { + this.requestService.requestMovie(searchResult) + .subscribe(x => { + this.result = x; - if (this.result.requestAdded) { - this.notificationService.success("Request Added", - `Request for ${searchResult.title} has been added successfully`); - } else { - this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage); - searchResult.requested = false; - searchResult.approved = false; - } - }); + if (this.result.requestAdded) { + this.notificationService.success("Request Added", + `Request for ${searchResult.title} has been added successfully`); + searchResult.processed = true; + } else { + if (this.result.errorMessage && this.result.message) { + this.notificationService.warning("Request Added", `${this.result.message} - ${this.result.errorMessage}`); + } else { + this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage); + } + searchResult.requested = false; + searchResult.approved = false; + searchResult.processed = false; + searchResult.requestProcessing = false; + } + }); + } catch (e) { + + searchResult.processed = false; + searchResult.requestProcessing = false; + this.notificationService.error("Something went wrong", e); + } } public popularMovies() { diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index d3cfe2e70..bd6cdf31c 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -158,7 +158,11 @@ export class TvSearchComponent implements OnInit, OnDestroy { this.notificationService.success("Request Added", `Request for ${searchResult.title} has been added successfully`); } else { - this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage); + if (this.result.errorMessage && this.result.message) { + this.notificationService.warning("Request Added", `${this.result.message} - ${this.result.errorMessage}`); + } else { + this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage); + } } }); }