Fixed the movies page

pull/3895/head
Jamie Rees 6 years ago
parent cc5fb56e7b
commit e418cbae57

@ -1,7 +1,7 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { SearchService, RequestService } from "../services";
import { SearchService, RequestService, RadarrService } from "../services";
import {CarouselModule} from 'primeng/carousel';
@ -41,6 +41,7 @@ const routes: Routes = [
providers: [
SearchService,
RequestService,
RadarrService,
],
})

@ -36,24 +36,26 @@ export class MovieDetailsComponent {
}
public load() {
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => {
this.movie = x;
if(this.movie.requestId > 0) {
if (this.movie.requestId > 0) {
// Load up this request
this.hasRequest = true;
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
if (this.isAdmin) {
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
this.radarrProfiles = c;
this.setQualityOverrides();
});
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
this.radarrRootFolders = c;
this.setRootFolderOverrides();
});
if (await this.radarrService.isRadarrEnabled()) {
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
this.radarrProfiles = c;
this.setQualityOverrides();
});
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
this.radarrRootFolders = c;
this.setRootFolderOverrides();
});
}
}
}
@ -83,7 +85,7 @@ export class MovieDetailsComponent {
}
public async deny() {
const result = await this.requestService.denyMovie({id: this.theMovidDbId, reason: ""}).toPromise();
const result = await this.requestService.denyMovie({ id: this.theMovidDbId, reason: "" }).toPromise();
if (result.result) {
this.movie.approved = false;
this.messageService.send(result.message, "Ok");
@ -93,7 +95,7 @@ export class MovieDetailsComponent {
}
public async approve() {
const result = await this.requestService.approveMovie({id: this.theMovidDbId}).toPromise();
const result = await this.requestService.approveMovie({ id: this.theMovidDbId }).toPromise();
if (result.result) {
this.movie.approved = false;
this.messageService.send(result.message, "Ok");

@ -14,16 +14,19 @@ export class RadarrService extends ServiceHelpers {
}
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
return this.http.post<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, JSON.stringify(settings), {headers: this.headers});
return this.http.post<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers });
}
public getQualityProfiles(settings: IRadarrSettings): Observable<IRadarrProfile[]> {
return this.http.post<IRadarrProfile[]>(`${this.url}/Profiles/`, JSON.stringify(settings), {headers: this.headers});
return this.http.post<IRadarrProfile[]>(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers });
}
public getRootFoldersFromSettings(): Observable<IRadarrRootFolder[]> {
return this.http.get<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, {headers: this.headers});
return this.http.get<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, { headers: this.headers });
}
public getQualityProfilesFromSettings(): Observable<IRadarrProfile[]> {
return this.http.get<IRadarrProfile[]>(`${this.url}/Profiles/`, {headers: this.headers});
return this.http.get<IRadarrProfile[]>(`${this.url}/Profiles/`, { headers: this.headers });
}
public isRadarrEnabled(): Promise<boolean> {
return this.http.get<boolean>(`${this.url}/enabled/`, { headers: this.headers }).toPromise();
}
}

@ -13,9 +13,10 @@ namespace Ombi.Controllers.V1.External
{
[Authorize]
[ApiV1]
[ApiController]
[Produces("application/json")]
public class RadarrController : Controller
{
public class RadarrController : ControllerBase
{
public RadarrController(IRadarrApi radarr, ISettingsService<RadarrSettings> settings,
ICacheService mem)
{
@ -39,6 +40,14 @@ namespace Ombi.Controllers.V1.External
return await RadarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
}
[HttpGet("enabled")]
[PowerUser]
public async Task<bool> Enabled()
{
var settings = await RadarrSettings.GetSettingsAsync();
return settings.Enabled;
}
/// <summary>
/// Gets the Radarr root folders.
/// </summary>

Loading…
Cancel
Save