From be0a3f44f14c5c8c702ce273b09f2fd7ea7052e7 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Mon, 15 Jun 2020 13:28:59 +0000 Subject: [PATCH] mgr/dashboard: Improve typescript lint Fixes: https://tracker.ceph.com/issues/46000 Signed-off-by: Tiago Melo --- .../mgr/dashboard/frontend/angular.json | 3 +- .../dashboard/frontend/src/app/app.module.ts | 3 +- .../block/iscsi-tabs/iscsi-tabs.component.ts | 1 - .../iscsi-target-details.component.spec.ts | 2 +- .../ceph/block/mirroring/mirroring.module.ts | 1 - .../pool-list/pool-list.component.spec.ts | 2 +- .../rbd-configuration-list.component.ts | 1 + .../rbd-details/rbd-details.component.ts | 2 -- .../block/rbd-form/rbd-form.component.spec.ts | 3 +- .../ceph/block/rbd-form/rbd-form.component.ts | 3 +- .../rbd-namespace-list.component.ts | 4 +-- .../rbd-performance.component.ts | 4 +-- .../cephfs-chart/cephfs-chart.component.ts | 2 -- .../cephfs-tabs/cephfs-tabs.component.spec.ts | 2 +- .../host-form/host-form.component.spec.ts | 4 +-- .../hosts/host-form/host-form.component.ts | 2 ++ .../inventory-devices.component.ts | 2 +- .../mgr-module-list.component.ts | 2 +- .../osd-creation-preview-modal.component.ts | 6 ++-- .../osd-devices-selection-groups.component.ts | 4 +-- .../osd-devices-selection-modal.component.ts | 2 +- .../osd-performance-histogram.component.ts | 2 -- .../osd-scrub-modal.component.spec.ts | 7 +++-- .../active-alert-list.component.ts | 2 ++ .../monitoring-list.component.spec.ts | 3 +- .../silence-form/silence-form.component.ts | 2 +- .../silence-list/silence-list.component.ts | 2 +- .../service-daemon-list.component.spec.ts | 4 +-- .../service-daemon-list.component.ts | 4 +-- .../services/services.component.spec.ts | 2 +- .../cluster/services/services.component.ts | 1 + .../telemetry/telemetry.component.spec.ts | 1 - .../dashboard/dashboard.component.ts | 8 ++--- .../ceph/dashboard/mgr-summary.pipe.spec.ts | 1 - .../ceph/dashboard/osd-summary.pipe.spec.ts | 1 + ...able-performance-counter.component.spec.ts | 2 +- .../rgw-bucket-details.component.ts | 2 -- .../rgw-user-capability-modal.component.ts | 2 +- .../rgw-user-subuser-modal.component.ts | 2 +- .../device-list/device-list.component.spec.ts | 2 +- .../device-list/device-list.component.ts | 2 ++ .../auth/user-tabs/user-tabs.component.ts | 1 - .../app/core/forbidden/forbidden.component.ts | 2 +- .../blank-layout/blank-layout.component.ts | 4 +-- .../login-layout.component.spec.ts | 2 +- .../core/navigation/about/about.component.ts | 1 + .../administration.component.ts | 6 ++-- .../app/core/not-found/not-found.component.ts | 4 +-- .../api/erasure-code-profile.service.ts | 2 +- .../src/app/shared/api/osd.service.ts | 2 +- .../src/app/shared/api/user.service.ts | 1 + .../alert-panel/alert-panel.component.ts | 2 ++ .../confirmation-modal.component.spec.ts | 2 +- .../components/helper/helper.component.ts | 3 +- .../language-selector.component.spec.ts | 2 +- .../loading-panel/loading-panel.component.ts | 1 + .../components/modal/modal.component.ts | 2 -- .../notifications-sidebar.component.spec.ts | 2 +- .../orchestrator-doc-modal.component.ts | 6 ++-- .../refresh-selector.component.spec.ts | 1 - .../select/select-messages.model.ts | 1 - .../sparkline/sparkline.component.ts | 11 +++++-- .../submit-button/submit-button.component.ts | 3 +- .../usage-bar/usage-bar.component.ts | 2 -- .../view-cache/view-cache.component.ts | 8 ++--- .../table-actions/table-actions.component.ts | 2 -- .../copy2clipboard-button.directive.ts | 2 +- .../app/shared/forms/cd-form-builder.spec.ts | 1 + .../src/app/shared/models/cd-notification.ts | 1 + .../shared/pipes/boolean-text.pipe.spec.ts | 2 +- .../pipes/dimless-binary-per-second.pipe.ts | 1 + .../app/shared/pipes/dimless-binary.pipe.ts | 1 + .../src/app/shared/pipes/dimless.pipe.ts | 1 + .../app/shared/pipes/iscsi-backstore.pipe.ts | 2 -- .../app/shared/pipes/relative-date.pipe.ts | 2 -- .../services/api-interceptor.service.spec.ts | 4 +-- .../shared/services/auth-storage.service.ts | 2 -- .../src/app/shared/services/device.service.ts | 2 -- .../app/shared/services/formatter.service.ts | 2 -- .../services/js-error-handler.service.ts | 1 + .../app/shared/services/language.service.ts | 3 +- .../services/ngzone-scheduler.service.ts | 1 + .../services/notification.service.spec.ts | 2 +- .../prometheus-alert-formatter.spec.ts | 2 +- .../prometheus-silence-matcher.service.ts | 2 +- .../services/task-message.service.spec.ts | 2 +- .../services/text-to-download.service.ts | 2 -- .../app/shared/services/time-diff.service.ts | 2 -- .../frontend/src/testing/unit-test-helper.ts | 2 +- src/pybind/mgr/dashboard/frontend/tslint.json | 30 +++++++++++++++++-- 90 files changed, 124 insertions(+), 128 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/angular.json b/src/pybind/mgr/dashboard/frontend/angular.json index 1972680ec6e..93769c34fac 100644 --- a/src/pybind/mgr/dashboard/frontend/angular.json +++ b/src/pybind/mgr/dashboard/frontend/angular.json @@ -191,7 +191,8 @@ "options": { "tsConfig": [ "src/tsconfig.app.json", - "tsconfig.spec.json" + "tsconfig.spec.json", + "cypress/tsconfig.json" ], "exclude": [ "**/node_modules/**" diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts index fb930c95a88..5a48d7eefdd 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts @@ -14,6 +14,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'; import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { ToastrModule } from 'ngx-toastr'; +import { environment } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { CephModule } from './ceph/ceph.module'; @@ -22,8 +23,6 @@ import { ApiInterceptorService } from './shared/services/api-interceptor.service import { JsErrorHandler } from './shared/services/js-error-handler.service'; import { SharedModule } from './shared/shared.module'; -import { environment } from '../environments/environment'; - export function jwtTokenGetter() { return localStorage.getItem('access_token'); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-tabs/iscsi-tabs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-tabs/iscsi-tabs.component.ts index 6f729bc8384..d4d21361bcd 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-tabs/iscsi-tabs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-tabs/iscsi-tabs.component.ts @@ -1,5 +1,4 @@ import { Component } from '@angular/core'; - import { Router } from '@angular/router'; @Component({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts index 9a4c9c2612d..4e0514e0c51 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts @@ -1,9 +1,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { TreeModel, TreeModule } from 'angular-tree-component'; import * as _ from 'lodash'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { IscsiTargetDetailsComponent } from './iscsi-target-details.component'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts index fda8c47dacf..1992f396566 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.module.ts @@ -8,7 +8,6 @@ import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation'; import { ModalModule } from 'ngx-bootstrap/modal'; import { SharedModule } from '../../../shared/shared.module'; - import { BootstrapCreateModalComponent } from './bootstrap-create-modal/bootstrap-create-modal.component'; import { BootstrapImportModalComponent } from './bootstrap-import-modal/bootstrap-import-modal.component'; import { DaemonListComponent } from './daemon-list/daemon-list.component'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts index e5a8f36666d..e40e1acd81c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts @@ -1,8 +1,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ToastrModule } from 'ngx-toastr'; import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts index 75e3b0f027c..c63a76dccff 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts @@ -1,6 +1,7 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { I18n } from '@ngx-translate/i18n-polyfill'; + import { TableComponent } from '../../../shared/datatable/table/table.component'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.ts index 46f95d1449c..bd6938bbdb7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.ts @@ -20,6 +20,4 @@ export class RbdDetailsComponent { @ViewChild(NgbNav, { static: true }) nav: NgbNav; - - constructor() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts index f0ba4ad48e4..ce34f019a67 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts @@ -1,12 +1,11 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; +import { By } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; - -import { By } from '@angular/platform-browser'; import { NEVER, of } from 'rxjs'; import { delay } from 'rxjs/operators'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts index 95d728ed02a..09ac2d9e937 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts @@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from '@angular/router'; import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; - import { forkJoin, Observable, ReplaySubject } from 'rxjs'; import { first, switchMap } from 'rxjs/operators'; @@ -728,7 +727,7 @@ export class RbdFormComponent extends CdForm implements OnInit { }) ) .subscribe( - () => {}, + () => undefined, () => this.rbdForm.setErrors({ cdSubmitButton: true }), () => this.router.navigate(['/block/rbd']) ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts index 80b0945f65d..50808a48718 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts @@ -1,10 +1,10 @@ import { Component, OnInit } from '@angular/core'; import { I18n } from '@ngx-translate/i18n-polyfill'; -import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; - import * as _ from 'lodash'; +import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import { forkJoin, Observable } from 'rxjs'; + import { PoolService } from '../../../shared/api/pool.service'; import { RbdService } from '../../../shared/api/rbd.service'; import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.ts index 3071f3a3d25..76750a8ceaa 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.ts @@ -5,6 +5,4 @@ import { Component } from '@angular/core'; templateUrl: './rbd-performance.component.html', styleUrls: ['./rbd-performance.component.scss'] }) -export class RbdPerformanceComponent { - constructor() {} -} +export class RbdPerformanceComponent {} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts index 8255b442713..61dbc974fe1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts @@ -102,8 +102,6 @@ export class CephfsChartComponent implements OnChanges, OnInit { chartType: 'line' }; - constructor() {} - ngOnInit() { if (_.isUndefined(this.mdsCounter)) { return; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts index 55c4baef6be..d165e589261 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts @@ -149,7 +149,7 @@ describe('CephfsTabsComponent', () => { data: [], status: ViewCacheStatus.ValueNone }; - component['subscribeInterval'] = () => {}; + component['subscribeInterval'] = () => undefined; updateData(); expect(component.clients).not.toEqual(defaultClients); expect(component.details).not.toEqual(defaultDetails); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts index d2a4dec9c7e..7015108ad2a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts @@ -1,10 +1,10 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; import { ToastrModule } from 'ngx-toastr'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { RouterTestingModule } from '@angular/router/testing'; import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; import { LoadingPanelComponent } from '../../../../shared/components/loading-panel/loading-panel.component'; import { SharedModule } from '../../../../shared/shared.module'; 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 1949338594a..43aaef199f9 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 @@ -1,7 +1,9 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { Router } from '@angular/router'; + import { I18n } from '@ngx-translate/i18n-polyfill'; + import { HostService } from '../../../../shared/api/host.service'; import { ActionLabelsI18n, URLVerbs } from '../../../../shared/constants/app.constants'; import { CdForm } from '../../../../shared/forms/cd-form'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts index 79744611fd7..19d6e5cce08 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts @@ -7,8 +7,8 @@ import { Output, ViewChild } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { BsModalService } from 'ngx-bootstrap/modal'; import { Subscription } from 'rxjs'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts index 75042749a92..4db0f6fd1d8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts @@ -191,7 +191,7 @@ export class MgrModuleListComponent extends ListWithDetails { $obs = this.mgrModuleService.enable(module.name); } $obs.subscribe( - () => {}, + () => undefined, () => { // Suspend showing the notification toasties. this.notificationService.suspendToasties(true); 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 eb8ded17349..ed911f5cf6e 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 @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import * as _ from 'lodash'; import { BsModalRef } from 'ngx-bootstrap/modal'; @@ -15,7 +15,7 @@ import { TaskWrapperService } from '../../../../shared/services/task-wrapper.ser templateUrl: './osd-creation-preview-modal.component.html', styleUrls: ['./osd-creation-preview-modal.component.scss'] }) -export class OsdCreationPreviewModalComponent implements OnInit { +export class OsdCreationPreviewModalComponent { @Input() driveGroups: Object[] = []; @@ -36,8 +36,6 @@ export class OsdCreationPreviewModalComponent implements OnInit { this.createForm(); } - ngOnInit() {} - createForm() { this.formGroup = this.formBuilder.group({}); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts index aea4c17d9d8..9f21b2dc93d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts @@ -1,9 +1,9 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; - import { BsModalService, ModalOptions } from 'ngx-bootstrap/modal'; + import { Icons } from '../../../../shared/enum/icons.enum'; import { CdTableColumnFiltersChange } from '../../../../shared/models/cd-table-column-filters-change'; import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.ts index 52da08a9c8e..5fb84e01692 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.ts @@ -1,9 +1,9 @@ import { AfterViewInit, Component, EventEmitter, Output, ViewChild } from '@angular/core'; +import { TableColumnProp } from '@swimlane/ngx-datatable'; import * as _ from 'lodash'; import { BsModalRef } from 'ngx-bootstrap/modal'; -import { TableColumnProp } from '@swimlane/ngx-datatable'; import { ActionLabelsI18n } from '../../../../shared/constants/app.constants'; import { Icons } from '../../../../shared/enum/icons.enum'; import { CdFormBuilder } from '../../../../shared/forms/cd-form-builder'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts index f81d51c2c00..f7024f72387 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts @@ -13,8 +13,6 @@ export class OsdPerformanceHistogramComponent implements OnChanges { valuesStyle: any; last = {}; - constructor() {} - ngOnChanges() { this.render(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts index 319e8664569..a32e173678c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts @@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; import { BsModalRef } from 'ngx-bootstrap/modal'; + import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper'; import { OsdService } from '../../../../shared/api/osd.service'; import { JoinPipe } from '../../../../shared/pipes/join.pipe'; @@ -15,13 +16,13 @@ describe('OsdScrubModalComponent', () => { const fakeService = { list: () => { - return new Promise(() => {}); + return new Promise(() => undefined); }, scrub: () => { - return new Promise(() => {}); + return new Promise(() => undefined); }, scrub_many: () => { - return new Promise(() => {}); + return new Promise(() => undefined); } }; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts index 0296f66486b..7f08731d1eb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; + import { I18n } from '@ngx-translate/i18n-polyfill'; + import { ListWithDetails } from '../../../../shared/classes/list-with-details.class'; import { CellTemplate } from '../../../../shared/enum/cell-template.enum'; import { Icons } from '../../../../shared/enum/icons.enum'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/monitoring-list/monitoring-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/monitoring-list/monitoring-list.component.spec.ts index bf0bf6c0567..6e0c85f349c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/monitoring-list/monitoring-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/monitoring-list/monitoring-list.component.spec.ts @@ -1,6 +1,5 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ToastrModule } from 'ngx-toastr'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts index d5ef6b35e6f..4f36ef92ad8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts @@ -1,8 +1,8 @@ import { Component } from '@angular/core'; import { Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { I18n } from '@ngx-translate/i18n-polyfill'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { BsModalService } from 'ngx-bootstrap/modal'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts index 3d27ac484d9..d2b36f6af75 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; + import { I18n } from '@ngx-translate/i18n-polyfill'; import { SortDirection, SortPropDir } from '@swimlane/ngx-datatable'; - import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import { Observable, Subscriber } from 'rxjs'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts index b357903a364..20683f0d284 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts @@ -102,13 +102,13 @@ describe('ServiceDaemonListComponent', () => { it('should list daemons by host', () => { component.hostname = 'mon0'; - component.getDaemons(new CdTableFetchDataContext(() => {})); + component.getDaemons(new CdTableFetchDataContext(() => undefined)); expect(component.daemons.length).toBe(1); }); it('should list daemons by service', () => { component.serviceName = 'osd'; - component.getDaemons(new CdTableFetchDataContext(() => {})); + component.getDaemons(new CdTableFetchDataContext(() => undefined)); expect(component.daemons.length).toBe(3); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts index 43cf10de322..e2758013297 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts @@ -10,11 +10,11 @@ import { ViewChild, ViewChildren } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; - import { Observable, Subscription } from 'rxjs'; + import { CephServiceService } from '../../../../shared/api/ceph-service.service'; import { HostService } from '../../../../shared/api/host.service'; import { OrchestratorService } from '../../../../shared/api/orchestrator.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts index d2e7470d188..6a2f4d34377 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts @@ -87,7 +87,7 @@ describe('ServicesComponent', () => { }); it('should return all services', () => { - component.getServices(new CdTableFetchDataContext(() => {})); + component.getServices(new CdTableFetchDataContext(() => undefined)); expect(component.services.length).toBe(2); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts index c65407ece86..2eb5afbae51 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core'; + import { I18n } from '@ngx-translate/i18n-polyfill'; import { CephServiceService } from '../../../shared/api/ceph-service.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts index a495c8507dc..0f0133512b0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts @@ -11,7 +11,6 @@ import { of as observableOf } from 'rxjs'; import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; import { MgrModuleService } from '../../../shared/api/mgr-module.service'; import { TelemetryService } from '../../../shared/api/telemetry.service'; - import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component'; import { TextToDownloadService } from '../../../shared/services/text-to-download.service'; import { SharedModule } from '../../../shared/shared.module'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard/dashboard.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard/dashboard.component.ts index 7d0b4244b65..354e3890359 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard/dashboard.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard/dashboard.component.ts @@ -1,14 +1,10 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; @Component({ selector: 'cd-dashboard', templateUrl: './dashboard.component.html', styleUrls: ['./dashboard.component.scss'] }) -export class DashboardComponent implements OnInit { +export class DashboardComponent { hasGrafana = false; // TODO: Temporary var, remove when grafana is implemented - - constructor() {} - - ngOnInit() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts index d9d0cba7330..84dea633592 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts @@ -1,7 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; - import { MgrSummaryPipe } from './mgr-summary.pipe'; describe('MgrSummaryPipe', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts index 0de9c21f9cf..20914d52a55 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts @@ -1,4 +1,5 @@ import { TestBed } from '@angular/core/testing'; + import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { OsdSummaryPipe } from './osd-summary.pipe'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts index f6c2d7a71b4..ae369f28281 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts @@ -33,7 +33,7 @@ describe('TablePerformanceCounterComponent', () => { }); describe('Error handling', () => { - const context = new CdTableFetchDataContext(() => {}); + const context = new CdTableFetchDataContext(() => undefined); beforeEach(() => { spyOn(context, 'error'); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts index 48f25540038..63c93492008 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts @@ -8,6 +8,4 @@ import { Component, Input } from '@angular/core'; export class RgwBucketDetailsComponent { @Input() selection: any; - - constructor() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts index 7666fc85ecc..50001eda91f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts @@ -1,10 +1,10 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { Validators } from '@angular/forms'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { BsModalRef } from 'ngx-bootstrap/modal'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; import { CdFormBuilder } from '../../../shared/forms/cd-form-builder'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts index 03a4b95e79e..04623f8c26d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts @@ -1,10 +1,10 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { AbstractControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; import { BsModalRef } from 'ngx-bootstrap/modal'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; import { CdFormBuilder } from '../../../shared/forms/cd-form-builder'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts index 63aa7755bf6..ff3156d8a36 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts @@ -1,8 +1,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + import { i18nProviders } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; - import { DeviceListComponent } from './device-list.component'; describe('DeviceListComponent', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts index d16ee7cbe8d..2465d29c216 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts @@ -1,6 +1,8 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core'; + import { I18n } from '@ngx-translate/i18n-polyfill'; + import { HostService } from '../../../shared/api/host.service'; import { OsdService } from '../../../shared/api/osd.service'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.ts index a143c1670fc..06626ec3e96 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.ts @@ -1,5 +1,4 @@ import { Component } from '@angular/core'; - import { Router } from '@angular/router'; @Component({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.ts index 45bd73c9089..81fffbc6307 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; + import { Icons } from '../../shared/enum/icons.enum'; @Component({ @@ -8,5 +9,4 @@ import { Icons } from '../../shared/enum/icons.enum'; }) export class ForbiddenComponent { icons = Icons; - constructor() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/blank-layout/blank-layout.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/blank-layout/blank-layout.component.ts index a0fef8e4a41..761bb3b8742 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/blank-layout/blank-layout.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/blank-layout/blank-layout.component.ts @@ -5,6 +5,4 @@ import { Component } from '@angular/core'; templateUrl: './blank-layout.component.html', styleUrls: ['./blank-layout.component.scss'] }) -export class BlankLayoutComponent { - constructor() {} -} +export class BlankLayoutComponent {} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/login-layout/login-layout.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/login-layout/login-layout.component.spec.ts index bd8a5ec1db2..47d85eff322 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/login-layout/login-layout.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/login-layout/login-layout.component.spec.ts @@ -1,10 +1,10 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { RouterTestingModule } from '@angular/router/testing'; import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; -import { RouterTestingModule } from '@angular/router/testing'; import { SharedModule } from '../../../shared/shared.module'; import { LoginLayoutComponent } from './login-layout.component'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/about/about.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/about/about.component.ts index 231929933fe..6b77c8f94ee 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/about/about.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/about/about.component.ts @@ -3,6 +3,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { detect } from 'detect-browser'; import { BsModalRef } from 'ngx-bootstrap/modal'; import { Subscription } from 'rxjs'; + import { environment } from '../../../../environments/environment'; import { UserService } from '../../../shared/api/user.service'; import { AppConstants } from '../../../shared/constants/app.constants'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.ts index 4d08bbe06eb..cbdae392259 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { Icons } from '../../../shared/enum/icons.enum'; import { Permission } from '../../../shared/models/permissions'; @@ -9,7 +9,7 @@ import { AuthStorageService } from '../../../shared/services/auth-storage.servic templateUrl: './administration.component.html', styleUrls: ['./administration.component.scss'] }) -export class AdministrationComponent implements OnInit { +export class AdministrationComponent { userPermission: Permission; configOptPermission: Permission; icons = Icons; @@ -19,6 +19,4 @@ export class AdministrationComponent implements OnInit { this.userPermission = permissions.user; this.configOptPermission = permissions.configOpt; } - - ngOnInit() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/not-found/not-found.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/not-found/not-found.component.ts index d12bc32100d..1b8d6b807dc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/not-found/not-found.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/not-found/not-found.component.ts @@ -5,6 +5,4 @@ import { Component } from '@angular/core'; templateUrl: './not-found.component.html', styleUrls: ['./not-found.component.scss'] }) -export class NotFoundComponent { - constructor() {} -} +export class NotFoundComponent {} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts index a8c414f3c06..c452779c683 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts @@ -1,9 +1,9 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import { Observable } from 'rxjs'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { ErasureCodeProfile } from '../models/erasure-code-profile'; import { ApiModule } from './api.module'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts index 8d6369a2162..f35fad2748a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts @@ -2,9 +2,9 @@ import { HttpClient, HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { I18n } from '@ngx-translate/i18n-polyfill'; +import * as _ from 'lodash'; import { map } from 'rxjs/operators'; -import * as _ from 'lodash'; import { CdDevice } from '../models/devices'; import { SmartDataResponseV1 } from '../models/smart'; import { DeviceService } from '../services/device.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/user.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/user.service.ts index c0b7acdb6de..ba35c061429 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/user.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/user.service.ts @@ -1,5 +1,6 @@ import { HttpClient, HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; + import { Observable, of as observableOf } from 'rxjs'; import { catchError, mapTo } from 'rxjs/operators'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts index 10e0801e8ea..d457a0ed7ef 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts @@ -1,5 +1,7 @@ import { Component, Input, OnInit } from '@angular/core'; + import { I18n } from '@ngx-translate/i18n-polyfill'; + import { Icons } from '../../enum/icons.enum'; @Component({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts index 77c5b153e51..d64a56d1460 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts @@ -1,11 +1,11 @@ import { Component, NgModule, NO_ERRORS_SCHEMA, TemplateRef, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; +import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal'; -import { By } from '@angular/platform-browser'; import { configureTestBed, FixtureHelper, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts index 227f260c67c..e1f6b28f5a7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts @@ -1,4 +1,5 @@ import { Component, Input } from '@angular/core'; + import { Icons } from '../../../shared/enum/icons.enum'; @Component({ @@ -14,6 +15,4 @@ export class HelperComponent { html: any; icons = Icons; - - constructor() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.spec.ts index 57753f17f4d..b895bc3c2a0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.spec.ts @@ -1,10 +1,10 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { listLocales } from 'ngx-bootstrap/chronos'; import { BsLocaleService } from 'ngx-bootstrap/datepicker'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { configureTestBed } from '../../../../testing/unit-test-helper'; import { LanguageSelectorComponent } from './language-selector.component'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/loading-panel/loading-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/loading-panel/loading-panel.component.ts index 3fe95f07f81..3d05fb9f400 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/loading-panel/loading-panel.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/loading-panel/loading-panel.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; + import { Icons } from '../../../shared/enum/icons.enum'; @Component({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/modal/modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/modal/modal.component.ts index 656e234c5d4..47cc5d74566 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/modal/modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/modal/modal.component.ts @@ -17,8 +17,6 @@ export class ModalComponent { @Output() hide = new EventEmitter(); - constructor() {} - close() { if (this.modalRef) { this.modalRef.hide(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts index f75b00f99da..fa3790b18fb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts @@ -1,5 +1,6 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap'; @@ -7,7 +8,6 @@ import { ClickOutsideModule } from 'ng-click-outside'; import { ToastrModule } from 'ngx-toastr'; import { SimplebarAngularModule } from 'simplebar-angular'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; import { PrometheusService } from '../../api/prometheus.service'; import { RbdService } from '../../api/rbd.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.ts index 91463bfbea1..e008edff634 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { BsModalRef } from 'ngx-bootstrap/modal'; @@ -7,14 +7,12 @@ import { BsModalRef } from 'ngx-bootstrap/modal'; templateUrl: './orchestrator-doc-modal.component.html', styleUrls: ['./orchestrator-doc-modal.component.scss'] }) -export class OrchestratorDocModalComponent implements OnInit { +export class OrchestratorDocModalComponent { actionDescription: string; itemDescription: string; constructor(public bsModalRef: BsModalRef) {} - ngOnInit() {} - onSubmit() { this.bsModalRef.hide(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.spec.ts index 87389fcc090..b8a438b3e4d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/refresh-selector/refresh-selector.component.spec.ts @@ -2,7 +2,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { configureTestBed } from '../../../../testing/unit-test-helper'; - import { RefreshIntervalService } from '../../services/refresh-interval.service'; import { RefreshSelectorComponent } from './refresh-selector.component'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts index 94f8c997df1..3f1f9fd264f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts @@ -1,5 +1,4 @@ import { I18n } from '@ngx-translate/i18n-polyfill'; - import * as _ from 'lodash'; export class SelectMessages { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.ts index 3a477f06589..ce9e9968f43 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.ts @@ -1,5 +1,12 @@ -import { Component, ElementRef, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core'; -import { Input } from '@angular/core'; +import { + Component, + ElementRef, + Input, + OnChanges, + OnInit, + SimpleChanges, + ViewChild +} from '@angular/core'; import { ChartTooltip } from '../../models/chart-tooltip'; import { DimlessBinaryPipe } from '../../pipes/dimless-binary.pipe'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/submit-button/submit-button.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/submit-button/submit-button.component.ts index 1ef6cb2ffb5..0d4d0e770b1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/submit-button/submit-button.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/submit-button/submit-button.component.ts @@ -1,9 +1,10 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { AbstractControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms'; -import { Icons } from '../../../shared/enum/icons.enum'; import * as _ from 'lodash'; +import { Icons } from '../../../shared/enum/icons.enum'; + /** * This component will render a submit button with the given label. * diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/usage-bar/usage-bar.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/usage-bar/usage-bar.component.ts index e8b4ddc148e..789e41cb4d6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/usage-bar/usage-bar.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/usage-bar/usage-bar.component.ts @@ -15,8 +15,6 @@ export class UsageBarComponent implements OnChanges { freePercentage: number; freeBytes: number; - constructor() {} - ngOnChanges() { this.usedPercentage = Math.round((this.usedBytes / this.totalBytes) * 100); this.freePercentage = 100 - this.usedPercentage; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.ts index 7370b07ae8b..ff669a0a1f4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { ViewCacheStatus } from '../../enum/view-cache-status.enum'; @@ -7,14 +7,10 @@ import { ViewCacheStatus } from '../../enum/view-cache-status.enum'; templateUrl: './view-cache.component.html', styleUrls: ['./view-cache.component.scss'] }) -export class ViewCacheComponent implements OnInit { +export class ViewCacheComponent { @Input() status: ViewCacheStatus; @Input() statusFor: string; vcs = ViewCacheStatus; - - constructor() {} - - ngOnInit() {} } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts index 57714dbae6b..4f34fc574be 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts @@ -33,8 +33,6 @@ export class TableActionsComponent implements OnInit { icons = Icons; - constructor() {} - ngOnInit() { this.removeActionsWithNoPermissions(); this.updateDropDownActions(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts index 91d76151950..ff5218acb70 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts @@ -1,6 +1,6 @@ import { Directive, ElementRef, HostListener, Input, OnInit, Renderer2 } from '@angular/core'; -import { I18n } from '@ngx-translate/i18n-polyfill'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import { ToastrService } from 'ngx-toastr'; @Directive({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-builder.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-builder.spec.ts index 07e7f00d897..188294b82ef 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-builder.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-builder.spec.ts @@ -1,4 +1,5 @@ import { Validators } from '@angular/forms'; + import { CdFormBuilder } from './cd-form-builder'; import { CdFormGroup } from './cd-form-group'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-notification.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-notification.ts index 3c8c0788932..da06cd3df8a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-notification.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-notification.ts @@ -1,4 +1,5 @@ import { IndividualConfig } from 'ngx-toastr'; + import { Icons } from '../enum/icons.enum'; import { NotificationType } from '../enum/notification-type.enum'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts index df6b4929396..5293059e75d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts @@ -1,8 +1,8 @@ import { TestBed } from '@angular/core/testing'; -import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { I18n } from '@ngx-translate/i18n-polyfill'; +import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { BooleanTextPipe } from './boolean-text.pipe'; describe('BooleanTextPipe', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary-per-second.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary-per-second.pipe.ts index 67faad2b402..21b59631789 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary-per-second.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary-per-second.pipe.ts @@ -1,4 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; + import { FormatterService } from '../services/formatter.service'; @Pipe({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary.pipe.ts index 493696ef931..cf5d2cdec24 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary.pipe.ts @@ -1,4 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; + import { FormatterService } from '../services/formatter.service'; @Pipe({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts index 18994bd12bd..1be11590dc4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts @@ -1,4 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; + import { FormatterService } from '../services/formatter.service'; @Pipe({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts index ae347b6f69b..19a0d66c196 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts @@ -4,8 +4,6 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'iscsiBackstore' }) export class IscsiBackstorePipe implements PipeTransform { - constructor() {} - transform(value: any): any { switch (value) { case 'user:rbd': diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.ts index 3ebc389eb22..c9e536c9034 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.ts @@ -6,8 +6,6 @@ import * as moment from 'moment'; name: 'relativeDate' }) export class RelativeDatePipe implements PipeTransform { - constructor() {} - transform(value: any): any { if (!value) { return 'unknown'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts index 6ed7153ac6a..9467cc3f7ba 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts @@ -19,9 +19,9 @@ describe('ApiInterceptorService', () => { let router: Router; const url = 'api/xyz'; - const httpError = (error: any, errorOpts: object, done = (_resp: any) => {}) => { + const httpError = (error: any, errorOpts: object, done = (_resp: any): any => undefined) => { httpClient.get(url).subscribe( - () => {}, + () => true, (resp) => { // Error must have been forwarded by the interceptor. expect(resp instanceof HttpErrorResponse).toBeTruthy(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.ts index fcc24cf5b95..5752f78c28a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.ts @@ -11,8 +11,6 @@ export class AuthStorageService { isPwdDisplayedSource = new BehaviorSubject(false); isPwdDisplayed$ = this.isPwdDisplayedSource.asObservable(); - constructor() {} - set( username: string, token: string, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.ts index b83982fb8dc..f81467f3825 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.ts @@ -8,8 +8,6 @@ import { CdDevice } from '../models/devices'; providedIn: 'root' }) export class DeviceService { - constructor() {} - /** * Calculates additional data and appends them as new attributes to the given device. */ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts index 67d6a17b0bf..1377dcdd2c2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts @@ -6,8 +6,6 @@ import * as _ from 'lodash'; providedIn: 'root' }) export class FormatterService { - constructor() {} - format_number(n: any, divisor: number, units: string[], decimals: number = 1): string { if (_.isString(n)) { n = Number(n); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts index 597e259f856..f7c45aa78ac 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts @@ -1,4 +1,5 @@ import { ErrorHandler, Injectable, Injector } from '@angular/core'; + import { LoggingService } from '../api/logging.service'; @Injectable() diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.ts index 438817103ea..bdb26d2df2b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.ts @@ -1,6 +1,5 @@ import { HttpClient } from '@angular/common/http'; -import { Inject, LOCALE_ID } from '@angular/core'; -import { Injectable } from '@angular/core'; +import { Inject, Injectable, LOCALE_ID } from '@angular/core'; import { environment } from '../../../environments/environment'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/ngzone-scheduler.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/ngzone-scheduler.service.ts index a39c6464810..a2c6b6c95d5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/ngzone-scheduler.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/ngzone-scheduler.service.ts @@ -1,4 +1,5 @@ import { Injectable, NgZone } from '@angular/core'; + import { asyncScheduler, SchedulerLike, Subscription } from 'rxjs'; abstract class NgZoneScheduler implements SchedulerLike { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts index 9d3fdc56356..fa235acefc6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts @@ -1,9 +1,9 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import * as _ from 'lodash'; import { ToastrService } from 'ngx-toastr'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { RbdService } from '../api/rbd.service'; import { NotificationType } from '../enum/notification-type.enum'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts index 02a7baefad3..ee76530ecc5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts @@ -1,8 +1,8 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; import { ToastrModule } from 'ngx-toastr'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { configureTestBed, i18nProviders, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts index 548dd00c565..dbd0da04eb1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import * as _ from 'lodash'; -import { I18n } from '@ngx-translate/i18n-polyfill'; import { AlertmanagerSilenceMatcher, AlertmanagerSilenceMatcherMatch diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts index 192e46d39dd..9d037aecb9b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts @@ -1,8 +1,8 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; import * as _ from 'lodash'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper'; import { RbdService } from '../api/rbd.service'; import { FinishedTask } from '../models/finished-task'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/text-to-download.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/text-to-download.service.ts index bcfb3abaaf0..6e63287eab3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/text-to-download.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/text-to-download.service.ts @@ -6,8 +6,6 @@ import { saveAs } from 'file-saver'; providedIn: 'root' }) export class TextToDownloadService { - constructor() {} - download(downloadText: string, filename?: string) { saveAs(new Blob([downloadText]), filename); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.ts index 8d3079a251c..16fd45a4a49 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.ts @@ -6,8 +6,6 @@ import * as _ from 'lodash'; providedIn: 'root' }) export class TimeDiffService { - constructor() {} - calculateDuration(startDate: Date, endDate: Date): string { const startTime = +startDate; const endTime = +endDate; diff --git a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts index 8045147f5b1..9ca18108182 100644 --- a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts +++ b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts @@ -4,11 +4,11 @@ import { AbstractControl } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { NgbNav, NgbNavItem } from '@ng-bootstrap/ng-bootstrap'; import { I18n } from '@ngx-translate/i18n-polyfill'; import { configureTestSuite } from 'ng-bullet'; import { BsModalRef } from 'ngx-bootstrap/modal'; -import { NgbNav, NgbNavItem } from '@ng-bootstrap/ng-bootstrap'; import { TableActionsComponent } from '../app/shared/datatable/table-actions/table-actions.component'; import { Icons } from '../app/shared/enum/icons.enum'; import { CdFormGroup } from '../app/shared/forms/cd-form-group'; diff --git a/src/pybind/mgr/dashboard/frontend/tslint.json b/src/pybind/mgr/dashboard/frontend/tslint.json index 59bc6bcd179..75dd53c5027 100644 --- a/src/pybind/mgr/dashboard/frontend/tslint.json +++ b/src/pybind/mgr/dashboard/frontend/tslint.json @@ -7,6 +7,9 @@ "class-name": true, "comment-format": [true, "check-space"], "curly": true, + "deprecation": { + "severity": "warning" + }, "eofline": true, "forin": true, "import-blacklist": [true, "rxjs/Rx", "ngx-bootstrap"], @@ -27,7 +30,8 @@ "no-construct": true, "no-debugger": true, "no-duplicate-super": true, - "no-empty": false, + "no-duplicate-imports": [true, { "allow-namespace-imports": true }], + "no-empty": [true, "allow-empty-catch"], "no-empty-interface": true, "no-eval": true, "no-inferrable-types": [true, "ignore-params"], @@ -83,7 +87,29 @@ "directive-class-suffix": true, "no-forward-ref": true, "no-output-native": true, - "ordered-imports": true + "ordered-imports": [ + true, + { + "grouped-imports": true, + "groups": [ + { + "name": "angular", + "match": "^@angular", + "order": 1 + }, + { + "name": "relative dir", + "match": "^([.]|src/).*", + "order": 3 + }, + { + "name": "node_modules", + "match": ".*", + "order": 2 + } + ] + } + ] }, "jsRules": { "no-empty": true } } -- 2.39.5