diff --git a/src/Ombi/ClientApp/app/interfaces/IRadarr.ts b/src/Ombi/ClientApp/app/interfaces/IRadarr.ts index 1e8030fbd..ebc92507c 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRadarr.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRadarr.ts @@ -1,16 +1,11 @@ -import { ICutoff, IItem } from "./ICommon"; - -export interface IRadarrRootFolder { +export interface IRadarrRootFolder { id: number; path: string; - freespace: number; } export interface IRadarrProfile { name: string; id: number; - cutoff: ICutoff; - items: IItem[]; } export interface IMinimumAvailability { diff --git a/src/Ombi/ClientApp/app/interfaces/ISonarr.ts b/src/Ombi/ClientApp/app/interfaces/ISonarr.ts index 681f2c2d7..3c71b835c 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISonarr.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISonarr.ts @@ -1,14 +1,9 @@ -import { ICutoff, IItem } from "./ICommon"; - -export interface ISonarrRootFolder { +export interface ISonarrRootFolder { id: number; path: string; - freespace: number; } export interface ISonarrProfile { name: string; id: number; - cutoff: ICutoff; - items: IItem[]; } diff --git a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html index 714355447..4985bf926 100644 --- a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html +++ b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html @@ -56,14 +56,14 @@
- +
A Default Quality Profile is required @@ -71,7 +71,7 @@
- +
@@ -80,7 +80,7 @@
A Default Root Path is required diff --git a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts index 502e08a9f..97b43e13c 100644 --- a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import "rxjs/add/operator/takeUntil"; -import { Subject } from "rxjs/Subject"; import { IMinimumAvailability, IRadarrProfile, IRadarrRootFolder } from "../../interfaces"; import { IRadarrSettings } from "../../interfaces"; @@ -23,8 +21,6 @@ export class RadarrComponent implements OnInit { public advanced = false; public form: FormGroup; - private subscriptions = new Subject(); - constructor(private settingsService: SettingsService, private radarrService: RadarrService, private notificationService: NotificationService, @@ -33,7 +29,6 @@ export class RadarrComponent implements OnInit { public ngOnInit() { this.settingsService.getRadarr() - .takeUntil(this.subscriptions) .subscribe(x => { this.form = this.fb.group({ @@ -57,6 +52,11 @@ export class RadarrComponent implements OnInit { } }); + this.qualities = []; + this.qualities.push({ name: "Please Select", id: -1 }); + + this.rootFolders = []; + this.rootFolders.push({ path: "Please Select", id: -1 }); this.minimumAvailabilityOptions = [ { name: "Announced", value: "Announced" }, { name: "In Cinemas", value: "InCinemas" }, @@ -70,9 +70,10 @@ export class RadarrComponent implements OnInit { this.profilesRunning = true; this.radarrService.getQualityProfiles(form.value).subscribe(x => { this.qualities = x; + this.qualities.unshift({ name: "Please Select", id: -1 }); this.profilesRunning = false; - this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles"); + this.notificationService.success("Quality Profiles", "Successfully retrieved the Quality Profiles"); }); } @@ -80,9 +81,10 @@ export class RadarrComponent implements OnInit { this.rootFoldersRunning = true; this.radarrService.getRootFolders(form.value).subscribe(x => { this.rootFolders = x; + this.rootFolders.unshift({ path: "Please Select", id: -1 }); this.rootFoldersRunning = false; - this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders"); + this.notificationService.success("Settings Saved", "Successfully retrieved the Root Folders"); }); } @@ -106,6 +108,10 @@ public onSubmit(form: FormGroup) { this.notificationService.error("Please check your entered values"); return; } + if(form.controls.defaultQualityProfile.value === "-1" || form.controls.defaultRootPath.value === "Please Select") { + this.notificationService.error("Please check your entered values"); + return; + } const settings = form.value; this.settingsService.saveRadarr(settings).subscribe(x => { @@ -117,9 +123,4 @@ public onSubmit(form: FormGroup) { }); } - - public ngOnDestroy() { - this.subscriptions.next(); - this.subscriptions.complete(); - } } diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html index 71e9b4f5c..8d01abb48 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html @@ -62,7 +62,7 @@
A Default Quality Profile is required @@ -72,7 +72,6 @@
-
@@ -80,7 +79,7 @@
A Default Root Path is required diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index 0bb8a98af..a727d9ffc 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -1,7 +1,5 @@ -import { Component, OnDestroy, OnInit } from "@angular/core"; +import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import "rxjs/add/operator/takeUntil"; -import { Subject } from "rxjs/Subject"; import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; @@ -14,7 +12,7 @@ import { SettingsService } from "../../services"; @Component({ templateUrl: "./sonarr.component.html", }) -export class SonarrComponent implements OnInit, OnDestroy { +export class SonarrComponent implements OnInit { public qualities: ISonarrProfile[]; public rootFolders: ISonarrRootFolder[]; @@ -25,8 +23,6 @@ export class SonarrComponent implements OnInit, OnDestroy { public form: FormGroup; public advanced = false; - private subscriptions = new Subject(); - constructor(private settingsService: SettingsService, private sonarrService: SonarrService, private notificationService: NotificationService, @@ -36,9 +32,7 @@ export class SonarrComponent implements OnInit, OnDestroy { public ngOnInit() { this.settingsService.getSonarr() - .takeUntil(this.subscriptions) .subscribe(x => { - this.form = this.fb.group({ enabled: [x.enabled], apiKey: [x.apiKey, [Validators.required]], @@ -59,29 +53,33 @@ export class SonarrComponent implements OnInit, OnDestroy { this.getRootFolders(this.form); } }); + this.rootFolders = []; + this.qualities = []; + this.rootFolders.push({ path: "Please Select", id: -1 }); + this.qualities.push({ name: "Please Select", id: -1 }); } public getProfiles(form: FormGroup) { this.profilesRunning = true; this.sonarrService.getQualityProfiles(form.value) - .takeUntil(this.subscriptions) .subscribe(x => { this.qualities = x; + this.qualities.unshift({ name: "Please Select", id: -1 }); this.profilesRunning = false; - this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles"); + this.notificationService.success("Quality Profiles", "Successfully retrieved the Quality Profiles"); }); } public getRootFolders(form: FormGroup) { this.rootFoldersRunning = true; this.sonarrService.getRootFolders(form.value) - .takeUntil(this.subscriptions) .subscribe(x => { this.rootFolders = x; + this.rootFolders.unshift({ path: "Please Select", id: -1 }); this.rootFoldersRunning = false; - this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders"); + this.notificationService.success("Settings Saved", "Successfully retrieved the Root Folders"); }); } @@ -105,8 +103,11 @@ export class SonarrComponent implements OnInit, OnDestroy { this.notificationService.error("Please check your entered values"); return; } + if(form.controls.defaultQualityProfile.value === "-1" || form.controls.defaultRootPath.value === "Please Select") { + this.notificationService.error("Please check your entered values"); + return; + } this.settingsService.saveSonarr(form.value) - .takeUntil(this.subscriptions) .subscribe(x => { if (x) { this.notificationService.success("Settings Saved", "Successfully saved Sonarr settings"); @@ -115,9 +116,4 @@ export class SonarrComponent implements OnInit, OnDestroy { } }); } - - public ngOnDestroy() { - this.subscriptions.next(); - this.subscriptions.complete(); - } }