-
+
-
diff --git a/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.scss b/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.scss
index 2d51f1403..dd9ab640e 100644
--- a/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.scss
+++ b/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.scss
@@ -5,29 +5,11 @@
margin-top: 10px;
}
-.col-md-6 {
- display: contents;
+.col-8 {
+ display: inline-table;
}
-
.col-md-5 {
- display: contents;
-}
-
-.col-md-4 {
- display: contents;
-}
-
-.control-label {
- font-weight: 400;
-}
-
-.row {
- display: block;
-}
-
-::ng-deep .dark .btn:hover {
- box-shadow: 0 5px 11px 0 rgba(255, 255, 255, 0.18), 0 4px 15px 0 rgba(255, 255, 255, 0.15);
- color: inherit;
+ display: inline-table;
}
::ng-deep .load {
@@ -35,15 +17,3 @@
margin-left: 3em;
padding: 0.5rem 1.14rem;
}
-
-@media (min-width:1440px) {
- .col-md-6 {
- display: inline-table;
- }
- .col-md-5 {
- display: inline-table;
- }
- .col-md-4 {
- display: inline-table;
- }
-}
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.ts
index ec044d9e3..c4cb0d920 100644
--- a/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.ts
+++ b/src/Ombi/ClientApp/src/app/settings/sonarr/sonarr.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
-import { FormBuilder, FormGroup, Validators } from "@angular/forms";
+import { FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms";
import { ILanguageProfiles, ISonarrProfile, ISonarrRootFolder } from "../../interfaces";
@@ -28,12 +28,32 @@ export class SonarrComponent implements OnInit {
public langRunning: boolean;
public form: FormGroup;
public advanced = false;
+ formErrors: any;
constructor(private settingsService: SettingsService,
private sonarrService: SonarrService,
private notificationService: NotificationService,
private testerService: TesterService,
- private fb: FormBuilder) { }
+ private fb: FormBuilder){}
+
+ onFormValuesChanged()
+ {
+ for ( const field in this.formErrors )
+ {
+ if ( !this.formErrors.hasOwnProperty(field) )
+ {
+ continue;
+ }
+ // Clear previous errors
+ this.formErrors[field] = {};
+ // Get the control
+ const control = this.form.get(field);
+ if ( control && control.dirty && !control.valid && control.value === "Please Select")
+ {
+ this.formErrors[field] = control.errors;
+ }
+ }
+ }
public ngOnInit() {
this.settingsService.getSonarr()
@@ -41,8 +61,8 @@ export class SonarrComponent implements OnInit {
this.form = this.fb.group({
enabled: [x.enabled],
apiKey: [x.apiKey, [Validators.required]],
- qualityProfile: [x.qualityProfile, [Validators.required]],
- rootPath: [x.rootPath, [Validators.required]],
+ qualityProfile: [x.qualityProfile, [Validators.required, validateProfile]],
+ rootPath: [x.rootPath, [Validators.required, validateProfile]],
qualityProfileAnime: [x.qualityProfileAnime],
rootPathAnime: [x.rootPathAnime],
ssl: [x.ssl],
@@ -67,6 +87,16 @@ export class SonarrComponent implements OnInit {
if(x.v3) {
this.form.controls.languageProfile.setValidators([Validators.required]);
}
+
+ this.formErrors ={
+ apiKey: {},
+ qualityProfile: {},
+ rootPath: {},
+ ip: {},
+ port: {},
+
+ };
+ this.onFormValuesChanged();
});
this.rootFolders = [];
this.qualities = [];
@@ -81,9 +111,8 @@ export class SonarrComponent implements OnInit {
this.sonarrService.getQualityProfiles(form.value)
.subscribe(x => {
this.qualities = x;
- this.qualities.unshift({ name: "Please Select", id: -1 });
this.qualitiesAnime = x;
-
+ this.qualities.unshift({ name: "Please Select", id: -1 });
this.profilesRunning = false;
this.notificationService.success("Successfully retrieved the Quality Profiles");
});
@@ -155,3 +184,10 @@ export class SonarrComponent implements OnInit {
});
}
}
+function validateProfile(qualityProfile): { [key: string]:boolean } | null {
+
+ if (qualityProfile.value !== undefined && (isNaN(qualityProfile.value) || qualityProfile.value == -1)) {
+ return { 'profileValidation': true };
+ }
+ return null;
+}
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/src/styles/shared.scss b/src/Ombi/ClientApp/src/styles/shared.scss
index 1bee8b8d4..b37f141ef 100644
--- a/src/Ombi/ClientApp/src/styles/shared.scss
+++ b/src/Ombi/ClientApp/src/styles/shared.scss
@@ -1,5 +1,5 @@
@import "~styles/variables.scss";
-@media (max-width: 978px) {
+/*@media (max-width: 978px) {
.top-spacing {
padding-top: 2%;
}
@@ -14,7 +14,7 @@
.top-spacing {
padding-top: 2%;
}
-}
+}*/
html,
body {
@@ -100,4 +100,20 @@ table {
background-color: rgba(0, 0, 0, 0.18);
color:#fff;
border: 1px solid rgba(0, 0, 0, 0.18);
-}
\ No newline at end of file
+}
+
+::ng-deep .mat-toolbar.mat-primary{
+ margin-bottom: 0.5em;
+}
+
+::ng-deep .dark .mat-form-field.mat-focused .mat-form-field-label{
+ color: $accent-dark;
+}
+
+::ng-deep .mat-form-field.mat-focused .mat-form-field-label{
+ color: $accent;
+}
+
+::ng-deep .mat-form-field-appearance-outline .mat-form-field-wrapper{
+ margin:0.5em;
+}