});
}
- wrapTask.subscribe(
- undefined,
- () => {
+ wrapTask.subscribe({
+ error: () => {
this.targetForm.setErrors({ cdSubmitButton: true });
},
- () => this.router.navigate(['/block/iscsi/targets'])
- );
+ complete: () => this.router.navigate(['/block/iscsi/targets'])
+ });
}
targetSettingsModal() {
task: new FinishedTask('rbd/mirroring/bootstrap/create', {}),
call: apiActionsObs
});
- taskObs.subscribe(undefined, finishHandler, finishHandler);
+ taskObs.subscribe({ error: finishHandler, complete: finishHandler });
}
}
task: new FinishedTask('rbd/mirroring/bootstrap/import', {}),
call: apiActionsObs
});
- taskObs.subscribe(undefined, finishHandler, () => {
- finishHandler();
- this.modalRef.hide();
+ taskObs.subscribe({
+ error: finishHandler,
+ complete: () => {
+ finishHandler();
+ this.modalRef.hide();
+ }
});
}
}
call: this.rbdMirroringService.setSiteName(this.editSiteNameForm.getValue('siteName'))
});
- action.subscribe(
- undefined,
- () => this.editSiteNameForm.setErrors({ cdSubmitButton: true }),
- () => {
+ action.subscribe({
+ error: () => this.editSiteNameForm.setErrors({ cdSubmitButton: true }),
+ complete: () => {
this.rbdMirroringService.refresh();
this.modalRef.hide();
}
- );
+ });
}
}
call: this.rbdMirroringService.updatePool(this.poolName, request)
});
- action.subscribe(
- undefined,
- () => this.editModeForm.setErrors({ cdSubmitButton: true }),
- () => {
+ action.subscribe({
+ error: () => this.editModeForm.setErrors({ cdSubmitButton: true }),
+ complete: () => {
this.rbdMirroringService.refresh();
this.modalRef.hide();
}
- );
+ });
}
}
});
}
- action.subscribe(
- undefined,
- () => this.editPeerForm.setErrors({ cdSubmitButton: true }),
- () => {
+ action.subscribe({
+ error: () => this.editPeerForm.setErrors({ cdSubmitButton: true }),
+ complete: () => {
this.rbdMirroringService.refresh();
this.modalRef.hide();
}
- );
+ });
}
}
}),
call: this.rbdMirroringService.deletePeer(poolName, peerUUID)
})
- .subscribe(
- undefined,
- (resp) => observer.error(resp),
- () => {
+ .subscribe({
+ error: (resp) => observer.error(resp),
+ complete: () => {
this.rbdMirroringService.refresh();
observer.complete();
}
- );
+ });
})
}
});
}),
call: this.rbdService.flatten(imageSpec)
})
- .subscribe(undefined, undefined, () => {
- this.modalRef.hide();
+ .subscribe({
+ complete: () => {
+ this.modalRef.hide();
+ }
});
}
}),
call: this.rbdService.moveTrash(this.imageSpec, delay)
})
- .subscribe(undefined, undefined, () => {
- this.modalRef.hide();
+ .subscribe({
+ complete: () => {
+ this.modalRef.hide();
+ }
});
}
}
}),
call: this.rbdService.purgeTrash(poolName)
})
- .subscribe(
- undefined,
- () => {
+ .subscribe({
+ error: () => {
this.purgeForm.setErrors({ cdSubmitButton: true });
},
- () => {
+ complete: () => {
this.modalRef.hide();
}
- );
+ });
}
}
}),
call: this.rbdService.restoreTrash(imageSpec, name)
})
- .subscribe(
- undefined,
- () => {
+ .subscribe({
+ error: () => {
this.restoreForm.setErrors({ cdSubmitButton: true });
},
- () => {
+ complete: () => {
this.modalRef.hide();
}
- );
+ });
}
}
});
it('should set an indicator to true during load', () => {
- lsDirSpy.and.callFake(() => Observable.create((): null => null));
+ lsDirSpy.and.callFake(() => new Observable((): null => null));
component.refreshAllDirectories();
expect(Object.values(component.loading).every((b) => b)).toBe(true);
expect(component.loadingIndicator).toBe(true);
}),
call: this.hostService.create(hostname)
})
- .subscribe(
- undefined,
- () => {
+ .subscribe({
+ error: () => {
this.hostForm.setErrors({ cdSubmitButton: true });
},
- () => {
+ complete: () => {
this.router.navigate(['/hosts']);
}
- );
+ });
}
}
}),
call: this.osdService.create(this.driveGroups)
})
- .subscribe(
- undefined,
- () => {
+ .subscribe({
+ error: () => {
this.formGroup.setErrors({ cdSubmitButton: true });
},
- () => {
+ complete: () => {
this.submitAction.emit();
this.bsModalRef.hide();
}
- );
+ });
}
}
this.getSelectedOsdIds().map((osd: any) => action.call(this.osdService, osd))
);
if (taskWrapped) {
- observable.subscribe(
- undefined,
- () => {
+ observable.subscribe({
+ error: () => {
this.getOsdList();
modalRef.hide();
},
- () => modalRef.hide()
- );
+ complete: () => modalRef.hide()
+ });
} else {
observable.subscribe(
() => {
});
}
- action.subscribe(
- undefined,
- () => this.nfsForm.setErrors({ cdSubmitButton: true }),
- () => this.router.navigate(['/nfs'])
- );
+ action.subscribe({
+ error: () => this.nfsForm.setErrors({ cdSubmitButton: true }),
+ complete: () => this.router.navigate(['/nfs'])
+ });
}
_buildRequest() {
task: new FinishedTask('crushRule/create', rule),
call: this.crushRuleService.create(rule)
})
- .subscribe(
- undefined,
- () => {
+ .subscribe({
+ error: () => {
this.form.setErrors({ cdSubmitButton: true });
},
- () => {
+ complete: () => {
this.bsModalRef.hide();
this.submitAction.emit(rule);
}
- );
+ });
}
}
task: new FinishedTask('ecp/create', { name: profile.name }),
call: this.ecpService.create(profile)
})
- .subscribe(
- undefined,
- () => {
+ .subscribe({
+ error: () => {
this.form.setErrors({ cdSubmitButton: true });
},
- () => {
+ complete: () => {
this.bsModalRef.hide();
this.submitAction.emit(profile);
}
- );
+ });
}
private createJson() {
}),
call: this.poolService[this.editing ? URLVerbs.UPDATE : URLVerbs.CREATE](pool)
})
- .subscribe(
- undefined,
- (resp) => {
+ .subscribe({
+ error: (resp) => {
if (_.isObject(resp.error) && resp.error.code === '34') {
this.form.get('pgNum').setErrors({ '34': true });
}
this.form.setErrors({ cdSubmitButton: true });
},
- () => this.router.navigate(['/pool'])
- );
+ complete: () => this.router.navigate(['/pool'])
+ });
}
appSelection() {
this.selection.selected.map((bucket: any) => {
return this.rgwBucketService.delete(bucket.bid);
})
- ).subscribe(
- null,
- (error) => {
+ ).subscribe({
+ error: (error) => {
// Forward the error to the observer.
observer.error(error);
// Reload the data table content because some deletions might
// have been executed successfully in the meanwhile.
this.table.refreshBtn();
},
- () => {
+ complete: () => {
// Notify the observer that we are done.
observer.complete();
// Reload the data table content.
this.table.refreshBtn();
}
- );
+ });
});
}
}
this.selection.selected.map((user: any) => {
return this.rgwUserService.delete(user.uid);
})
- ).subscribe(
- null,
- (error) => {
+ ).subscribe({
+ error: (error) => {
// Forward the error to the observer.
observer.error(error);
// Reload the data table content because some deletions might
// have been executed successfully in the meanwhile.
this.table.refreshBtn();
},
- () => {
+ complete: () => {
// Notify the observer that we are done.
observer.complete();
// Reload the data table content.
this.table.refreshBtn();
}
- );
+ });
});
}
}
this.loading = true;
if (this.osdId !== null) {
- this.osdService.getSmartData(this.osdId).subscribe(this.fetchData.bind(this), (error) => {
- error.preventDefault();
- this.error = error;
- this.loading = false;
+ this.osdService.getSmartData(this.osdId).subscribe({
+ next: this.fetchData.bind(this),
+ error: (error) => {
+ error.preventDefault();
+ this.error = error;
+ this.loading = false;
+ }
});
} else if (this.hostname !== null) {
- this.hostService.getSmartData(this.hostname).subscribe(this.fetchData.bind(this), (error) => {
- error.preventDefault();
- this.error = error;
- this.loading = false;
+ this.hostService.getSmartData(this.hostname).subscribe({
+ next: this.fetchData.bind(this),
+ error: (error) => {
+ error.preventDefault();
+ this.error = error;
+ this.loading = false;
+ }
});
}
}
import { Component, Injector, OnDestroy } from '@angular/core';
import { ActivatedRouteSnapshot, NavigationEnd, NavigationStart, Router } from '@angular/router';
-import { from, Observable, of, Subscription } from 'rxjs';
-import { concat, distinct, filter, first, flatMap, toArray } from 'rxjs/operators';
+import { concat, from, Observable, of, Subscription } from 'rxjs';
+import { distinct, filter, first, flatMap, toArray } from 'rxjs/operators';
import { BreadcrumbsResolver, IBreadcrumb } from '../../../shared/models/breadcrumbs';
let resolver: BreadcrumbsResolver;
if (data.breadcrumbs.prototype instanceof BreadcrumbsResolver) {
- resolver = this.injector.get(data.breadcrumbs);
+ resolver = this.injector.get<BreadcrumbsResolver>(data.breadcrumbs);
} else {
resolver = this.defaultResolver;
}
}
if (route.firstChild) {
- crumbs$ = crumbs$.pipe(concat(this._resolveCrumbs(route.firstChild)));
+ crumbs$ = concat<IBreadcrumb[]>(crumbs$, this._resolveCrumbs(route.firstChild));
}
return crumbs$;
callSubmitAction() {
if (this.submitActionObservable) {
- this.submitActionObservable().subscribe(
- null,
- this.stopLoadingSpinner.bind(this),
- this.hideModal.bind(this)
- );
+ this.submitActionObservable().subscribe({
+ error: this.stopLoadingSpinner.bind(this),
+ complete: this.hideModal.bind(this)
+ });
} else {
this.submitAction();
}
}
_initUserConfigAutoSave() {
- const source: Observable<any> = Observable.create(this._initUserConfigProxy.bind(this));
+ const source: Observable<any> = new Observable(this._initUserConfigProxy.bind(this));
this.saveSubscriber = source.subscribe(this._saveUserConfig.bind(this));
}
prometheusService = TestBed.inject(PrometheusService);
spyOn(prometheusService, 'ifAlertmanagerConfigured').and.callFake((fn) => fn());
spyOn(prometheusService, 'getAlerts').and.returnValue(
- Observable.create((observer: any) => observer.error({ status: statusCode, error: {} }))
+ new Observable((observer: any) => observer.error({ status: statusCode, error: {} }))
);
const disableFn = spyOn(prometheusService, 'disableAlertmanagerConfig').and.callFake(() => {
expect(expectedStatus).toBe(true);
});
it('should simulate a synchronous task', () => {
- callWrapTaskAroundCall(200, 'sync').subscribe(null, null, () => (passed = true));
+ callWrapTaskAroundCall(200, 'sync').subscribe({ complete: () => (passed = true) });
expect(service._handleExecutingTasks).not.toHaveBeenCalled();
expect(passed).toBeTruthy();
expect(summaryService.addRunningTask).not.toHaveBeenCalled();
});
it('should simulate a asynchronous task', () => {
- callWrapTaskAroundCall(202, 'async').subscribe(null, null, () => (passed = true));
+ callWrapTaskAroundCall(202, 'async').subscribe({ complete: () => (passed = true) });
expect(service._handleExecutingTasks).toHaveBeenCalled();
expect(passed).toBeTruthy();
expect(summaryService.addRunningTask).toHaveBeenCalledTimes(1);
spyOn(taskManager, 'subscribe').and.callFake((_name, _metadata, onTaskFinished) => {
onTaskFinished();
});
- callWrapTaskAroundCall(202, 'async').subscribe(null, null, () => (passed = true));
+ callWrapTaskAroundCall(202, 'async').subscribe({ complete: () => (passed = true) });
expect(notify.notifyTask).toHaveBeenCalled();
});
it('should simulate a task failure', () => {
- callWrapTaskAroundCall(null, 'async').subscribe(null, () => (passed = true), null);
+ callWrapTaskAroundCall(null, 'async').subscribe({ error: () => (passed = true) });
expect(service._handleExecutingTasks).not.toHaveBeenCalled();
expect(passed).toBeTruthy();
expect(summaryService.addRunningTask).not.toHaveBeenCalled();