]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix tslint warnings 35574/head
authorTiago Melo <tmelo@suse.com>
Mon, 15 Jun 2020 15:36:09 +0000 (15:36 +0000)
committerTiago Melo <tmelo@suse.com>
Wed, 17 Jun 2020 17:41:30 +0000 (17:41 +0000)
Signed-off-by: Tiago Melo <tmelo@suse.com>
27 files changed:
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts

index a5d2acf60d32941c1b901fbbcaf93aca911205d2..68d24a4613abe4f6d7584486f75c5fe2f325a1ea 100644 (file)
@@ -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() {
index 63ccdc71175c0e9b04da5f8fd718e6c7fe933358..fb92f27fa704a017d05a43525a325a8e380472bf 100644 (file)
@@ -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 });
   }
 }
index ca6c833631202f1a49a39b7de2a02bc86aaaaa5e..0b7c9e0c90feca9ea5354b71d1f13f9954c8d70e 100644 (file)
@@ -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();
+      }
     });
   }
 }
index e7e256bd39351db6ffd9d01c7747c3c304bc1cff..c6ede8467422f008c63152e703394d8178325b65 100644 (file)
@@ -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();
       }
-    );
+    });
   }
 }
index 64054aabb0838a6101ee3b391a3eb0fdc50fec3b..13ab438f4fece25335aa3e9cf9184739fed65602 100644 (file)
@@ -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();
       }
-    );
+    });
   }
 }
index 2181bc4a7e1b826b4807fd8bec2b53b8ffcf42a9..4fd127cb346750bffd5dbbc8877333f558787c09 100644 (file)
@@ -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();
       }
-    );
+    });
   }
 }
index 2cb0bfd46a67346c60600d3db2ca06e81e6edc5c..7009a8a41fdfe739ed2f18a04f2239e09a4441a6 100644 (file)
@@ -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();
                 }
-              );
+              });
           })
       }
     });
index d8e8958d81bc9864016b88986a40be3188e4b2ff..7a1d9bfa42fb15ae07ddae4e1da69947e2bb5058 100644 (file)
@@ -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();
+        }
       });
   }
 
index 7ef805795da0a685a3952d8829d68033a404d378..17ac15d85841adf3900e972711e2f1e75d8ad975 100644 (file)
@@ -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();
+        }
       });
   }
 }
index fdb629c6f539161f42cc77a64d1f1e4723a5aa99..e0f95cb5c1b89f20c9b97e49e4a84c3e0dd11224 100644 (file)
@@ -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();
         }
-      );
+      });
   }
 }
index 4e687994e505c364192799d4503fc82478f6b9f7..6392d31c05f12a0dcccd59754ede6e757ff07f8b 100644 (file)
@@ -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();
         }
-      );
+      });
   }
 }
index bfb71ab0c4636cc5f0db0aeec466edec171b8582..4017453b3b9e4c4fcea0eb49672db35bedebe195 100644 (file)
@@ -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);
index 43aaef199f9a52b33a581de5b7daaff08cb27f5f..5bb66497d3aebf1c407021088ae877d2b5e3d140 100644 (file)
@@ -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']);
         }
-      );
+      });
   }
 }
index ed911f5cf6e3d4ea33e37a7789ddc045e062e59c..37d59f2b3b760fb6a44dd2f7dcb9ed34fcd38603 100644 (file)
@@ -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();
         }
-      );
+      });
   }
 }
index e9dfb0c29f320537e7c3bea84e154e3968cd47e9..580f82f206603a0a116e21bbb51321b10c9079d7 100644 (file)
@@ -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(
                 () => {
index 7719e601054168d17d258d3a141f6f6b5f0ffa5b..eb075741e7c625d2d6da8c3c138c8c295d6db1c7 100644 (file)
@@ -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() {
index 3e9edb699e364b0cb7d1dd1639c3fbf08dada5ab..37324979bf9e68e1f95427f33e730c97a6ecd02e 100644 (file)
@@ -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);
         }
-      );
+      });
   }
 }
index 7f5aa7aed763c6045a33350ea43d828c88f0f791..298ceaff36d93299a199d4ce62e8292d7394124e 100644 (file)
@@ -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() {
index 460a4157d47c2a4b9561dd569c7742f5182bb7a4..1685f727b096e4fcf0333a6d2e2e857255c491b0 100644 (file)
@@ -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() {
index 1a99482b5bbe5f0a0b9fec97d5405398cbdf6b33..cbfca2d5c403833e4bc296275e34f4225db0fd1a 100644 (file)
@@ -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();
               }
-            );
+            });
           });
         }
       }
index b920ecd7d30fdbe3d434d00c7d27aa113715408b..7688c84484c0773ef66ddccc070998e3a57d79cf 100644 (file)
@@ -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();
               }
-            );
+            });
           });
         }
       }
index 4bccee8c4d92263fd96714147bcd3cd259f41f38..7c29c98fda33b33df3e3c257d88723bb282c7c3f 100644 (file)
@@ -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;
+        }
       });
     }
   }
index 52a1c2ded1c08a9b5ff7076b45f8c10f9a4d409c..f57e45c68247ced6e387a88912c68d4139df9c90 100644 (file)
@@ -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<BreadcrumbsResolver>(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<IBreadcrumb[]>(crumbs$, this._resolveCrumbs(route.firstChild));
     }
 
     return crumbs$;
index 868c6d6ea42bd98eabb577e954938874f38115e1..8f395e9c7bdee30c38751339288a0a51ae800798 100644 (file)
@@ -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();
     }
index b08d7a489f26f52dc45f2ffcf82a80fe76b46dc7..fe4fd756b15ed46b1e53efa398953872ebbb0798 100644 (file)
@@ -353,7 +353,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   }
 
   _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));
   }
 
index f2235f53953e1f1154bcf6a6efd9b6a47da5dc3e..cefbb78be0b6f5782c9412c937eac5a531508ee1 100644 (file)
@@ -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);
index f039af4fd89dadd01814135ff2196788aebc347c..698b2affa2c9816ab4e066be74ffe31ea5a5ca2b 100644 (file)
@@ -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();