pullStatus()

in angular/src/app/stage/namespace-edit/namespace-edit.component.ts [85:112]


  pullStatus() {
    this.waitingSince = moment();
    this.waitingTranslate = { when: this.waitingSince.fromNow() };
    this.waiting = true;
    const inter = interval(10000)
      .pipe(
        switchMap((i) => { return of(i); }),
        takeWhile(() => this.waiting)
      );
    
    inter.subscribe((val) => {
      this.namespaceService.info(this.stageEndpoint, this.namespaceCode)
      .subscribe(
        (res: any) => {
          if (res.Status && res.Status === 'ACTIVE') {
            this.waiting = false;
            this.formHelperService.showMessage('Messages.NamespaceProvisionedSuccessfully', null);
            this.router.navigate(['/stages', this.stageCode, this.namespaceCode]);
          } else {
            this.waitingTranslate = { when: this.waitingSince.fromNow() };
          }
        },
        (err: any) => {
          this.formHelperService.showError('Errors.GenericError', null);
        }
      );
    });
  }