Skip to content

Commit

Permalink
IP validation
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-wilson committed Nov 26, 2023
1 parent c685383 commit 1879a84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form [formGroup]="form">
<label>AxeOS Device IP: </label>
<input formControlName="ip" type="text">
<button style="margin-left: 15px;" class="btn btn-primary" (click)="add()">Add</button>
<button style="margin-left: 15px;" class="btn btn-primary" (click)="add()" [disabled]="form.invalid">Add</button>
<!-- <input type="checkbox" formControlName="sync"> Sync All -->
</form>
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { BehaviorSubject, catchError, combineLatest, forkJoin, map, Observable, of, startWith, switchMap } from 'rxjs';
import { SystemService } from 'src/app/services/system.service';
Expand All @@ -26,7 +26,7 @@ export class SwarmComponent {
private toastr: ToastrService
) {
this.form = this.fb.group({
ip: []
ip: [null, [Validators.required, Validators.pattern('(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)')]]
});

this.swarm$ = this.systemService.getSwarmInfo().pipe(
Expand Down

0 comments on commit 1879a84

Please sign in to comment.