probe detail modify bug fix
This commit is contained in:
		
							parent
							
								
									f26e14bad3
								
							
						
					
					
						commit
						28b5e819fa
					
				@ -6,6 +6,7 @@ import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
 | 
				
			|||||||
import { AuthContainerSelector } from '@overflow/shared/auth/store';
 | 
					import { AuthContainerSelector } from '@overflow/shared/auth/store';
 | 
				
			||||||
import { DomainMember } from '@overflow/commons-typescript/model/domain';
 | 
					import { DomainMember } from '@overflow/commons-typescript/model/domain';
 | 
				
			||||||
import { ProbeHostService } from '../service/probe-host.service';
 | 
					import { ProbeHostService } from '../service/probe-host.service';
 | 
				
			||||||
 | 
					import { ProbeService } from '../service/probe.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'of-probe-detail',
 | 
					  selector: 'of-probe-detail',
 | 
				
			||||||
@ -18,10 +19,8 @@ export class ProbeDetailComponent implements OnInit {
 | 
				
			|||||||
  probeHost: ProbeHost;
 | 
					  probeHost: ProbeHost;
 | 
				
			||||||
  error$: Observable<any>;
 | 
					  error$: Observable<any>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Output() modify = new EventEmitter<ProbeHost>();
 | 
					 | 
				
			||||||
  @Output() discovery = new EventEmitter<number>();
 | 
					  @Output() discovery = new EventEmitter<number>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  editMode = false;
 | 
					  editMode = false;
 | 
				
			||||||
  displayNameErrMsg: string;
 | 
					  displayNameErrMsg: string;
 | 
				
			||||||
  descriptionErrMsg: string;
 | 
					  descriptionErrMsg: string;
 | 
				
			||||||
@ -30,27 +29,28 @@ export class ProbeDetailComponent implements OnInit {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private store: Store<any>,
 | 
					    private store: Store<any>,
 | 
				
			||||||
    private probeHostService: ProbeHostService
 | 
					    private probeHostService: ProbeHostService,
 | 
				
			||||||
 | 
					    private probeService: ProbeService,
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
    this.probeHostService.read(this.probeHostID)
 | 
					    this.probeHostService.read(this.probeHostID)
 | 
				
			||||||
    .pipe(
 | 
					      .pipe(
 | 
				
			||||||
      tap(() => {
 | 
					        tap(() => {
 | 
				
			||||||
        this.pending$ = of(true);
 | 
					          this.pending$ = of(true);
 | 
				
			||||||
      }),
 | 
					        }),
 | 
				
			||||||
      map((probeHost: ProbeHost) => {
 | 
					        map((probeHost: ProbeHost) => {
 | 
				
			||||||
        this.probeHost = probeHost;
 | 
					          this.probeHost = probeHost;
 | 
				
			||||||
      }),
 | 
					        }),
 | 
				
			||||||
      catchError(error => {
 | 
					        catchError(error => {
 | 
				
			||||||
        this.error$ = of(error);
 | 
					          this.error$ = of(error);
 | 
				
			||||||
        return of();
 | 
					          return of();
 | 
				
			||||||
      }),
 | 
					        }),
 | 
				
			||||||
      tap(() => {
 | 
					        tap(() => {
 | 
				
			||||||
        this.pending$ = of(false);
 | 
					          this.pending$ = of(false);
 | 
				
			||||||
      }),
 | 
					        }),
 | 
				
			||||||
  ).take(1).subscribe();
 | 
					    ).take(1).subscribe();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -60,7 +60,7 @@ export class ProbeDetailComponent implements OnInit {
 | 
				
			|||||||
      this.displayNameErrMsg = msg;
 | 
					      this.displayNameErrMsg = msg;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.displayNameErrMsg = null;
 | 
					      this.displayNameErrMsg = null;
 | 
				
			||||||
      this.displayName = value;
 | 
					      this.displayName = value.trim();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -70,15 +70,31 @@ export class ProbeDetailComponent implements OnInit {
 | 
				
			|||||||
      this.descriptionErrMsg = msg;
 | 
					      this.descriptionErrMsg = msg;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.descriptionErrMsg = null;
 | 
					      this.descriptionErrMsg = null;
 | 
				
			||||||
      this.description = value;
 | 
					      this.description = value.trim();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onEditSave() {
 | 
					  onEditSave() {
 | 
				
			||||||
    this.probeHost.probe.displayName = this.displayName ? this.displayName : this.probeHost.probe.displayName;
 | 
					    this.probeHost.probe.displayName = this.displayName ? this.displayName : this.probeHost.probe.displayName;
 | 
				
			||||||
    this.probeHost.probe.description = this.description ? this.description : this.probeHost.probe.description;
 | 
					    this.probeHost.probe.description = this.description ? this.description : this.probeHost.probe.description;
 | 
				
			||||||
    this.modify.emit(this.probeHost);
 | 
					
 | 
				
			||||||
    this.editMode = false;
 | 
					    this.probeService.modify(this.probeHost.probe)
 | 
				
			||||||
 | 
					      .pipe(
 | 
				
			||||||
 | 
					        tap(() => {
 | 
				
			||||||
 | 
					          this.pending$ = of(true);
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        map((probe: Probe) => {
 | 
				
			||||||
 | 
					          this.editMode = false;
 | 
				
			||||||
 | 
					          this.probeHost.probe = probe;
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        catchError(error => {
 | 
				
			||||||
 | 
					          this.error$ = of(error);
 | 
				
			||||||
 | 
					          return of();
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        tap(() => {
 | 
				
			||||||
 | 
					          this.pending$ = of(false);
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					    ).take(1).subscribe();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  checkValidDisplayName(value: string): string | null {
 | 
					  checkValidDisplayName(value: string): string | null {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user