From 1af9c766b53a3af7b72c8f55c76e0ae71007bf02 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Mon, 15 Jun 2020 15:36:09 +0000 Subject: [PATCH] mgr/dashboard: Fix tslint warnings Signed-off-by: Tiago Melo --- .../iscsi-target-form.component.ts | 9 ++++---- .../bootstrap-create-modal.component.ts | 2 +- .../bootstrap-import-modal.component.ts | 9 +++++--- .../edit-site-name-modal.component.ts | 9 ++++---- .../pool-edit-mode-modal.component.ts | 9 ++++---- .../pool-edit-peer-modal.component.ts | 9 ++++---- .../pool-list/pool-list.component.ts | 9 ++++---- .../ceph/block/rbd-list/rbd-list.component.ts | 6 +++-- .../rbd-trash-move-modal.component.ts | 6 +++-- .../rbd-trash-purge-modal.component.ts | 9 ++++---- .../rbd-trash-restore-modal.component.ts | 9 ++++---- .../cephfs-directories.component.spec.ts | 2 +- .../hosts/host-form/host-form.component.ts | 9 ++++---- .../osd-creation-preview-modal.component.ts | 9 ++++---- .../osd/osd-list/osd-list.component.ts | 9 ++++---- .../ceph/nfs/nfs-form/nfs-form.component.ts | 9 ++++---- .../crush-rule-form-modal.component.ts | 9 ++++---- ...asure-code-profile-form-modal.component.ts | 9 ++++---- .../pool/pool-form/pool-form.component.ts | 9 ++++---- .../rgw-bucket-list.component.ts | 9 ++++---- .../rgw-user-list/rgw-user-list.component.ts | 9 ++++---- .../shared/smart-list/smart-list.component.ts | 22 ++++++++++++------- .../breadcrumbs/breadcrumbs.component.ts | 8 +++---- .../critical-confirmation-modal.component.ts | 9 ++++---- .../shared/datatable/table/table.component.ts | 2 +- .../services/prometheus-alert.service.spec.ts | 2 +- .../services/task-wrapper.service.spec.ts | 8 +++---- 27 files changed, 108 insertions(+), 112 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts index a5d2acf60d329..68d24a4613abe 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts @@ -770,13 +770,12 @@ export class IscsiTargetFormComponent extends CdForm implements OnInit { }); } - 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() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.ts index 63ccdc71175c0..fb92f27fa704a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.ts @@ -148,6 +148,6 @@ export class BootstrapCreateModalComponent implements OnDestroy, OnInit { task: new FinishedTask('rbd/mirroring/bootstrap/create', {}), call: apiActionsObs }); - taskObs.subscribe(undefined, finishHandler, finishHandler); + taskObs.subscribe({ error: finishHandler, complete: finishHandler }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.ts index ca6c833631202..0b7c9e0c90fec 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.ts @@ -174,9 +174,12 @@ export class BootstrapImportModalComponent implements OnInit, OnDestroy { 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(); + } }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.ts index e7e256bd39351..c6ede8467422f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.ts @@ -45,13 +45,12 @@ export class EditSiteNameModalComponent implements OnInit { 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(); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts index 64054aabb0838..13ab438f4fece 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts @@ -93,13 +93,12 @@ export class PoolEditModeModalComponent implements OnInit, OnDestroy { 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(); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.ts index 2181bc4a7e1b8..4fd127cb34675 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.ts @@ -128,13 +128,12 @@ export class PoolEditPeerModalComponent implements OnInit { }); } - action.subscribe( - undefined, - () => this.editPeerForm.setErrors({ cdSubmitButton: true }), - () => { + action.subscribe({ + error: () => this.editPeerForm.setErrors({ cdSubmitButton: true }), + complete: () => { this.rbdMirroringService.refresh(); this.modalRef.hide(); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts index 2cb0bfd46a673..7009a8a41fdfe 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts @@ -142,14 +142,13 @@ export class PoolListComponent implements OnInit, OnDestroy { }), call: this.rbdMirroringService.deletePeer(poolName, peerUUID) }) - .subscribe( - undefined, - (resp) => observer.error(resp), - () => { + .subscribe({ + error: (resp) => observer.error(resp), + complete: () => { this.rbdMirroringService.refresh(); observer.complete(); } - ); + }); }) } }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts index d8e8958d81bc9..7a1d9bfa42fb1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts @@ -376,8 +376,10 @@ export class RbdListComponent extends ListWithDetails implements OnInit { }), call: this.rbdService.flatten(imageSpec) }) - .subscribe(undefined, undefined, () => { - this.modalRef.hide(); + .subscribe({ + complete: () => { + this.modalRef.hide(); + } }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.ts index 7ef805795da0a..17ac15d85841a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.ts @@ -88,8 +88,10 @@ export class RbdTrashMoveModalComponent implements OnInit { }), call: this.rbdService.moveTrash(this.imageSpec, delay) }) - .subscribe(undefined, undefined, () => { - this.modalRef.hide(); + .subscribe({ + complete: () => { + this.modalRef.hide(); + } }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.ts index fdb629c6f5391..e0f95cb5c1b89 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.ts @@ -60,14 +60,13 @@ export class RbdTrashPurgeModalComponent implements OnInit { }), call: this.rbdService.purgeTrash(poolName) }) - .subscribe( - undefined, - () => { + .subscribe({ + error: () => { this.purgeForm.setErrors({ cdSubmitButton: true }); }, - () => { + complete: () => { this.modalRef.hide(); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.ts index 4e687994e505c..6392d31c05f12 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.ts @@ -51,14 +51,13 @@ export class RbdTrashRestoreModalComponent implements OnInit { }), call: this.rbdService.restoreTrash(imageSpec, name) }) - .subscribe( - undefined, - () => { + .subscribe({ + error: () => { this.restoreForm.setErrors({ cdSubmitButton: true }); }, - () => { + complete: () => { this.modalRef.hide(); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts index bfb71ab0c4636..4017453b3b9e4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts @@ -1063,7 +1063,7 @@ describe('CephfsDirectoriesComponent', () => { }); 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); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts index 43aaef199f9a5..5bb66497d3aeb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts @@ -67,14 +67,13 @@ export class HostFormComponent extends CdForm implements OnInit { }), call: this.hostService.create(hostname) }) - .subscribe( - undefined, - () => { + .subscribe({ + error: () => { this.hostForm.setErrors({ cdSubmitButton: true }); }, - () => { + complete: () => { this.router.navigate(['/hosts']); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.ts index ed911f5cf6e3d..37d59f2b3b760 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.ts @@ -48,15 +48,14 @@ export class OsdCreationPreviewModalComponent { }), call: this.osdService.create(this.driveGroups) }) - .subscribe( - undefined, - () => { + .subscribe({ + error: () => { this.formGroup.setErrors({ cdSubmitButton: true }); }, - () => { + complete: () => { this.submitAction.emit(); this.bsModalRef.hide(); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts index e9dfb0c29f320..580f82f206603 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts @@ -510,14 +510,13 @@ export class OsdListComponent extends ListWithDetails implements OnInit { 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( () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts index 7719e60105416..eb075741e7c62 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts @@ -528,11 +528,10 @@ export class NfsFormComponent extends CdForm implements OnInit { }); } - 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() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts index 3e9edb699e364..37324979bf9e6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts @@ -97,15 +97,14 @@ export class CrushRuleFormModalComponent extends CrushNodeSelectionClass impleme 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); } - ); + }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts index 7f5aa7aed763c..298ceaff36d93 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts @@ -319,16 +319,15 @@ export class ErasureCodeProfileFormModalComponent extends CrushNodeSelectionClas 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() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts index 460a4157d47c2..1685f727b096e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts @@ -907,16 +907,15 @@ export class PoolFormComponent extends CdForm implements OnInit { }), 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() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts index 1a99482b5bbe5..cbfca2d5c4038 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts @@ -130,22 +130,21 @@ export class RgwBucketListComponent extends ListWithDetails { 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(); } - ); + }); }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts index b920ecd7d30fd..7688c84484c07 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts @@ -150,22 +150,21 @@ export class RgwUserListComponent extends ListWithDetails { 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(); } - ); + }); }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts index 4bccee8c4d922..7c29c98fda33b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts @@ -130,16 +130,22 @@ smartmontools is required to successfully retrieve data.`, 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; + } }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts index 52a1c2ded1c08..f57e45c68247c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts @@ -25,8 +25,8 @@ THE SOFTWARE. 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'; @@ -90,7 +90,7 @@ export class BreadcrumbsComponent implements OnDestroy { let resolver: BreadcrumbsResolver; if (data.breadcrumbs.prototype instanceof BreadcrumbsResolver) { - resolver = this.injector.get(data.breadcrumbs); + resolver = this.injector.get(data.breadcrumbs); } else { resolver = this.defaultResolver; } @@ -102,7 +102,7 @@ export class BreadcrumbsComponent implements OnDestroy { } if (route.firstChild) { - crumbs$ = crumbs$.pipe(concat(this._resolveCrumbs(route.firstChild))); + crumbs$ = concat(crumbs$, this._resolveCrumbs(route.firstChild)); } return crumbs$; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts index 868c6d6ea42bd..8f395e9c7bdee 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts @@ -38,11 +38,10 @@ export class CriticalConfirmationModalComponent implements OnInit { 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(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index b08d7a489f26f..fe4fd756b15ed 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -353,7 +353,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O } _initUserConfigAutoSave() { - const source: Observable = Observable.create(this._initUserConfigProxy.bind(this)); + const source: Observable = new Observable(this._initUserConfigProxy.bind(this)); this.saveSubscriber = source.subscribe(this._saveUserConfig.bind(this)); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts index f2235f53953e1..cefbb78be0b6f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts @@ -44,7 +44,7 @@ describe('PrometheusAlertService', () => { 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); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts index f039af4fd89da..698b2affa2c98 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts @@ -61,14 +61,14 @@ describe('TaskWrapperService', () => { }); 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); @@ -79,12 +79,12 @@ describe('TaskWrapperService', () => { 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(); -- 2.39.5