fix(radarr): 🐛 Enable validation on the radarr settings page

pull/5174/head
Jamie Rees 5 months ago
parent fc1ad67246
commit 0af3511e81

@ -105,7 +105,6 @@
"options": {
"tsConfig": [
"src/tsconfig.json"
"src/tsconfig.json"
],
"exclude": [
"**/node_modules/**"

@ -293,7 +293,6 @@ export class CarouselListComponent implements OnInit {
}
this.discoverResults.push(...tempResults);
this.carousel.ngAfterContentInit();
this.finishLoading();
}

@ -28,10 +28,12 @@
<mat-form-field appearance="outline" >
<mat-label>Hostname or IP</mat-label>
<input matInput formControlName="ip">
<mat-error>Please enter a valid hostname or ip address</mat-error>
</mat-form-field>
<mat-form-field appearance="outline" >
<mat-label>Port</mat-label>
<input matInput formControlName="port">
<mat-error>Please enter a valid port number</mat-error>
</mat-form-field>
<mat-slide-toggle formControlName="ssl">
SSL
@ -42,6 +44,7 @@
<mat-form-field appearance="outline" >
<mat-label>API key</mat-label>
<input matInput formControlName="apiKey">
<mat-error>Please enter an API Key</mat-error>
</mat-form-field>
</div>
<div class="md-form-field">
@ -65,6 +68,7 @@
{{quality.name}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>
</div>
@ -80,6 +84,7 @@
{{folder.path}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>
</div>
@ -95,6 +100,7 @@
{{tag.label}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>
</div>
@ -107,6 +113,7 @@
{{min.name}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>
</div>
</div>

@ -63,14 +63,14 @@ export class RadarrFormComponent implements OnInit {
}
public toggleValidators() {
debugger;
const enabled = this.form.controls.enabled.value as boolean;
this.form.controls.apiKey.setValidators(enabled ? [Validators.required] : null);
this.form.controls.defaultQualityProfile.setValidators(enabled ? [Validators.required] : null);
this.form.controls.defaultQualityProfile.setValidators(enabled ? [Validators.required, Validators.min(1)] : null);
this.form.controls.defaultRootPath.setValidators(enabled ? [Validators.required] : null);
this.form.controls.ip.setValidators(enabled ? [Validators.required] : null);
this.form.controls.port.setValidators(enabled ? [Validators.required] : null);
this.form.controls.port.setValidators(enabled ? [Validators.required, Validators.min(1)] : null);
this.form.controls.minimumAvailability.setValidators(enabled ? [Validators.required] : null);
enabled ? this.form.markAllAsTouched() : this.form.markAsUntouched();
}
public getProfiles(form: UntypedFormGroup) {
@ -120,6 +120,7 @@ export class RadarrFormComponent implements OnInit {
this.notificationService.success("Successfully connected to Radarr!");
} else if (result.expectedSubDir) {
this.notificationService.error("Your Radarr Base URL must be set to " + result.expectedSubDir);
form.controls.subDir.setValue(result.expectedSubDir);
} else {
this.notificationService.error("We could not connect to Radarr!");
}

Loading…
Cancel
Save