Skip to content

Commit

Permalink
fix(radarr): 🐛 Enable validation on the radarr settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
tidusjar committed Sep 3, 2024
1 parent fc1ad67 commit 0af3511
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/Ombi/ClientApp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"options": {
"tsConfig": [
"src/tsconfig.json"
"src/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ export class CarouselListComponent implements OnInit {
}

this.discoverResults.push(...tempResults);
this.carousel.ngAfterContentInit();

this.finishLoading();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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">
Expand All @@ -65,6 +68,7 @@
{{quality.name}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>

</div>
Expand All @@ -80,6 +84,7 @@
{{folder.path}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>

</div>
Expand All @@ -95,6 +100,7 @@
{{tag.label}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>

</div>
Expand All @@ -107,6 +113,7 @@
{{min.name}}
</mat-option>
</mat-select>
<mat-error>Please select a value</mat-error>
</mat-form-field>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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!");
}
Expand Down

0 comments on commit 0af3511

Please sign in to comment.