From: alfonsomthd Date: Wed, 20 Feb 2019 09:27:34 +0000 (+0100) Subject: mgr/dashboard: typescript cleanup X-Git-Tag: v14.1.1~136^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=516e1150a777606483ff41d5ae24108e68a7dcde;p=ceph-ci.git mgr/dashboard: typescript cleanup * Added npm script 'lint:tsc' to check for unused local variables & parameters. Notice that vars/params beginning with '_' are ignored by compiler. * tslint: removed 'no-unused-variable' controversial rule in favor of compiler checks. * Added npm script 'test:config' to address 'lint:tsc' complaining about not finding module 'unit-test-configuration.ts'. Signed-off-by: Alfonso Martínez --- diff --git a/src/pybind/mgr/dashboard/frontend/e2e/tsconfig.e2e.json b/src/pybind/mgr/dashboard/frontend/e2e/tsconfig.e2e.json index 1d9e5edf096..e3d6ae7644a 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/tsconfig.e2e.json +++ b/src/pybind/mgr/dashboard/frontend/e2e/tsconfig.e2e.json @@ -9,6 +9,7 @@ "jasmine", "jasminewd2", "node" - ] + ], + "noEmit": true } } diff --git a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json index ff3139e7964..a11a69e933f 100644 --- a/src/pybind/mgr/dashboard/frontend/package.json +++ b/src/pybind/mgr/dashboard/frontend/package.json @@ -8,14 +8,16 @@ "build": "npm run env_build && ng build", "env_build": "cp src/environments/environment.tpl.ts src/environments/environment.prod.ts && cp src/environments/environment.tpl.ts src/environments/environment.ts && node ./environment.build.js", "i18n": "ng xi18n --i18n-format xlf --i18n-locale en-US --output-path locale --progress=false && ngx-extractor -i 'src/**/*.ts' -f xlf -o src/locale/messages.xlf -l en-US", - "test": "jest --watch", - "test:ci": "JEST_SILENT_REPORTER_DOTS=true jest --coverage --reporters jest-silent-reporter", + "test": "npm run test:config && jest --watch", + "test:ci": "npm run test:config && JEST_SILENT_REPORTER_DOTS=true jest --coverage --reporters jest-silent-reporter", + "test:config": "if [ ! -e 'src/unit-test-configuration.ts' ]; then cp 'src/unit-test-configuration.ts.sample' 'src/unit-test-configuration.ts'; fi", "e2e": "npm run env_build && ng e2e", "e2e:dev": "npm run env_build && ng e2e --dev-server-target", "lint:tslint": "ng lint", "lint:prettier": "prettier --list-different \"{src,e2e}/**/*.{ts,scss}\"", "lint:html": "html-linter --config html-linter.config.json", - "lint": "npm run lint:tslint && npm run lint:prettier && npm run lint:html", + "lint:tsc": "npm run test:config && tsc -p src/tsconfig.app.json --noEmit --noUnusedLocals --noUnusedParameters && tsc -p src/tsconfig.spec.json --noEmit --noUnusedLocals --noUnusedParameters && tsc -p e2e/tsconfig.e2e.json --noEmit --noUnusedLocals --noUnusedParameters", + "lint": "npm run lint:tsc && npm run lint:tslint && npm run lint:prettier && npm run lint:html", "fix:prettier": "prettier --write \"{src,e2e}/**/*.{ts,scss}\"", "fix:tslint": "npm run lint:tslint -- --fix", "fixmod": "prettier --write $(git rev-parse --show-toplevel)/$(git status --porcelain | grep -E '^(\\sM|\\?\\?|A)' | sed -e 's/^...//' | grep -E '^(src|e2e).*\\.(ts|scss)$') 1>/dev/null 2>&1 && echo 'done' || echo 'no changes found'", @@ -44,6 +46,9 @@ "modulePathIgnorePatterns": [ "/coverage/" ], + "testMatch": [ + "**/*.spec.ts" + ], "testURL": "http://localhost/" }, "dependencies": { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.ts index df0d3d07711..758a34daf0b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.ts @@ -27,7 +27,7 @@ export class IscsiTargetImageSettingsModalComponent implements OnInit { const currentSettings = this.imagesSettings[this.image]; this.helpText = this.iscsiService.imageAdvancedSettings; - _.forIn(this.disk_default_controls, (value, key) => { + _.forIn(this.disk_default_controls, (_value, key) => { fg[key] = new FormControl(currentSettings[key]); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.ts index db0cdf33ea7..eef5276cb73 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.ts @@ -25,7 +25,7 @@ export class IscsiTargetIqnSettingsModalComponent implements OnInit { const fg = {}; this.helpText = this.iscsiService.targetAdvancedSettings; - _.forIn(this.target_default_controls, (value, key) => { + _.forIn(this.target_default_controls, (_value, key) => { fg[key] = new FormControl(this.target_controls.value[key]); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts index 45648292795..dcc1be8a1a0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts @@ -20,7 +20,7 @@ describe('IscsiComponent', () => { const fakeService = { tcmuiscsi: () => { - return new Promise(function(resolve, reject) { + return new Promise(function() { return; }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirror-health-color.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirror-health-color.pipe.ts index 43d880ffb1a..33e0204c69e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirror-health-color.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirror-health-color.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'mirrorHealthColor' }) export class MirrorHealthColorPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { if (value === 'warning') { return 'label label-warning'; } else if (value === 'error') { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-response.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-response.model.ts index 857bda59647..fb9c67fcb72 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-response.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-response.model.ts @@ -3,4 +3,5 @@ export class PoolEditPeerResponseModel { client_id: string; mon_host: string; key: string; + uuid: string; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts index 76c61b0c875..b4666d71ed6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts @@ -57,9 +57,8 @@ export class PoolListComponent implements OnInit, OnDestroy { icon: 'fa-plus', name: this.i18n('Add Peer'), click: () => this.editPeersModal('add'), - disable: (selection: CdTableSelection) => - !this.selection.first() || this.selection.first().mirror_mode === 'disabled', - visible: (selection: CdTableSelection) => !this.getPeerUUID(), + disable: () => !this.selection.first() || this.selection.first().mirror_mode === 'disabled', + visible: () => !this.getPeerUUID(), canBePrimary: () => false }; const editPeerAction: CdTableAction = { @@ -67,14 +66,14 @@ export class PoolListComponent implements OnInit, OnDestroy { icon: 'fa-exchange', name: this.i18n('Edit Peer'), click: () => this.editPeersModal('edit'), - visible: (selection: CdTableSelection) => !!this.getPeerUUID() + visible: () => !!this.getPeerUUID() }; const deletePeerAction: CdTableAction = { permission: 'delete', icon: 'fa-times', name: this.i18n('Delete Peer'), click: () => this.deletePeersModal(), - visible: (selection: CdTableSelection) => !!this.getPeerUUID() + visible: () => !!this.getPeerUUID() }; this.tableActions = [editModeAction, addPeerAction, editPeerAction, deletePeerAction]; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts index 72b0114b37d..426c76b0c37 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts @@ -1,4 +1,3 @@ -import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; @@ -59,7 +58,7 @@ describe('RbdConfigurationListComponent', () => { } as RbdConfigurationEntry; component.data = [fakeOption, realOption]; - component.ngOnChanges({ name: new SimpleChange(null, null, null) }); + component.ngOnChanges(); expect(component.data.length).toBe(1); expect(component.data.pop()).toBe(realOption); 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 55389fd43a7..aff443b0f3d 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,12 +1,4 @@ -import { - Component, - Input, - OnChanges, - OnInit, - SimpleChanges, - TemplateRef, - ViewChild -} from '@angular/core'; +import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { I18n } from '@ngx-translate/i18n-polyfill'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; @@ -51,7 +43,7 @@ export class RbdConfigurationListComponent implements OnInit, OnChanges { ]; } - ngOnChanges(changes: SimpleChanges): void { + ngOnChanges(): void { if (!this.data) { return; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.ts index 2805645027c..b5d2a080bc5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.ts @@ -73,7 +73,7 @@ export class RbdSnapshotFormComponent implements OnInit { this.rbdService .renameSnapshot(this.poolName, this.imageName, this.snapName, snapshotName) .toPromise() - .then((resp) => { + .then(() => { this.taskManagerService.subscribe( finishedTask.name, finishedTask.metadata, @@ -84,7 +84,7 @@ export class RbdSnapshotFormComponent implements OnInit { this.modalRef.hide(); this.onSubmit.next(this.snapName); }) - .catch((resp) => { + .catch(() => { this.snapshotForm.setErrors({ cdSubmitButton: true }); }); } @@ -101,7 +101,7 @@ export class RbdSnapshotFormComponent implements OnInit { this.rbdService .createSnapshot(this.poolName, this.imageName, snapshotName) .toPromise() - .then((resp) => { + .then(() => { this.taskManagerService.subscribe( finishedTask.name, finishedTask.metadata, @@ -112,7 +112,7 @@ export class RbdSnapshotFormComponent implements OnInit { this.modalRef.hide(); this.onSubmit.next(snapshotName); }) - .catch((resp) => { + .catch(() => { this.snapshotForm.setErrors({ cdSubmitButton: true }); }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts index 0294daf2b09..522c60f8737 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts @@ -83,8 +83,8 @@ describe('RbdSnapshotListComponent', () => { fixture.detectChanges(); const i18n = TestBed.get(I18n); called = false; - rbdService = new RbdService(null); - notificationService = new NotificationService(null, null); + rbdService = new RbdService(null, null); + notificationService = new NotificationService(null, null, null); authStorageService = new AuthStorageService(); authStorageService.set('user', '', { 'rbd-image': ['create', 'read', 'update', 'delete'] }); component = new RbdSnapshotListComponent( diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts index b1fd47fa13e..cc40bea3032 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts @@ -206,7 +206,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { this.rbdService .protectSnapshot(this.poolName, this.rbdName, snapshotName, !isProtected) .toPromise() - .then((resp) => { + .then(() => { const executingTask = new ExecutingTask(); executingTask.name = finishedTask.name; executingTask.metadata = finishedTask.metadata; @@ -247,7 +247,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { } ); }) - .catch((resp) => { + .catch(() => { this.modalRef.content.stopLoadingSpinner(); }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts index 1db21cedac6..420e35e7c29 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts @@ -86,7 +86,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit { { name: this.i18n('Usage'), cellTemplate: this.poolUsageTpl, - comparator: (valueA, valueB, rowA, rowB, sortDirection) => { + comparator: (_valueA, _valueB, rowA, rowB) => { const valA = rowA.used / rowA.avail; const valB = rowB.used / rowB.avail; @@ -124,7 +124,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit { }); this.cephfsService.getMdsCounters(this.id).subscribe((data) => { - _.each(this.mdsCounters, (value, key) => { + _.each(this.mdsCounters, (_value, key) => { if (data[key] === undefined) { delete this.mdsCounters[key]; } @@ -137,7 +137,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit { }); } - trackByFn(index, item) { + trackByFn(_index, item) { return item.name; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts index b7e0fca6bf5..d775fb0208f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts @@ -160,7 +160,8 @@ describe('OsdListComponent', () => { const expectOpensModal = (actionName: string, modalClass): void => { openActionModal(actionName); - expect(modalServiceShowSpy.calls.any()).toBe(true, 'modalService.show called'); + // @TODO: check why tsc is complaining when passing 'expectationFailOutput' param. + expect(modalServiceShowSpy.calls.any()).toBeTruthy(); expect(modalServiceShowSpy.calls.first().args[0]).toBe(modalClass); modalServiceShowSpy.calls.reset(); 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 1fc99668bcb..cf08843c263 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 @@ -15,19 +15,13 @@ describe('OsdScrubModalComponent', () => { const fakeService = { list: () => { - return new Promise(function(resolve, reject) { - return {}; - }); + return new Promise(() => {}); }, - scrub: (data: any) => { - return new Promise(function(resolve, reject) { - return {}; - }); + scrub: () => { + return new Promise(() => {}); }, - scrub_many: (data: any) => { - return new Promise(function(resolve, reject) { - return {}; - }); + scrub_many: () => { + return new Promise(() => {}); } }; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts index de76ea884e8..18b03254f61 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts @@ -33,7 +33,7 @@ export class OsdScrubModalComponent implements OnInit { const id = this.selected[0].id; this.osdService.scrub(id, this.deep).subscribe( - (res) => { + () => { const operation = this.deep ? 'Deep scrub' : 'Scrub'; this.notificationService.show( diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health-pie/health-pie.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health-pie/health-pie.component.ts index 94daabbb8e7..a28afa613e8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health-pie/health-pie.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health-pie/health-pie.component.ts @@ -183,7 +183,7 @@ export class HealthPieComponent implements OnChanges, OnInit { } private hideSlices() { - _.forEach(this.chartConfig.dataset[0].data, (slice, sliceIndex) => { + _.forEach(this.chartConfig.dataset[0].data, (_slice, sliceIndex) => { if (this.hiddenSlices[sliceIndex]) { this.chartConfig.dataset[0].data[sliceIndex] = undefined; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts index ae75eca6482..a722afebd7e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts @@ -52,7 +52,7 @@ export class HealthComponent implements OnInit, OnDestroy { }); } - prepareReadWriteRatio(chart, data) { + prepareReadWriteRatio(chart) { const ratioLabels = []; const ratioData = []; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts index 3bfdd5267bf..5d43e4244e5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts @@ -9,7 +9,7 @@ import * as _ from 'lodash'; export class MdsSummaryPipe implements PipeTransform { constructor(private i18n: I18n) {} - transform(value: any, args?: any): any { + transform(value: any): any { if (!value) { return ''; } @@ -19,7 +19,7 @@ export class MdsSummaryPipe implements PipeTransform { let standbys = 0; let active = 0; let standbyReplay = 0; - _.each(value.standbys, (s, i) => { + _.each(value.standbys, () => { standbys += 1; }); @@ -29,8 +29,8 @@ export class MdsSummaryPipe implements PipeTransform { } else if (value.filesystems.length === 0) { contentLine1 = this.i18n('no filesystems'); } else { - _.each(value.filesystems, (fs, i) => { - _.each(fs.mdsmap.info, (mds, j) => { + _.each(value.filesystems, (fs) => { + _.each(fs.mdsmap.info, (mds) => { if (mds.state === 'up:standby-replay') { standbyReplay += 1; } else { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts index c37eb88606d..b3782ca32c1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts @@ -9,7 +9,7 @@ import * as _ from 'lodash'; export class MgrSummaryPipe implements PipeTransform { constructor(private i18n: I18n) {} - transform(value: any, args?: any): any { + transform(value: any): any { if (!value) { return ''; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts index 48949a04fa8..31339f52e29 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts @@ -8,7 +8,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'; export class MonSummaryPipe implements PipeTransform { constructor(private i18n: I18n) {} - transform(value: any, args?: any): any { + transform(value: any): any { if (!value) { return ''; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts index b6a444be673..c007c313cf3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts @@ -9,7 +9,7 @@ import * as _ from 'lodash'; export class OsdSummaryPipe implements PipeTransform { constructor(private i18n: I18n) {} - transform(value: any, args?: any): any { + transform(value: any): any { if (!value) { return ''; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts index 2ab70555b63..128782fc961 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts @@ -109,20 +109,15 @@ export class NfsFormComponent implements OnInit { } getData(promises) { - forkJoin(promises).subscribe( - (data: any[]) => { - this.resolveDaemons(data[0]); - this.resolvefsals(data[1]); - this.resolveClients(data[2]); - this.resolveFilesystems(data[3]); - if (data[4]) { - this.resolveModel(data[4]); - } - }, - (error) => { - // this.error = error; + forkJoin(promises).subscribe((data: any[]) => { + this.resolveDaemons(data[0]); + this.resolvefsals(data[1]); + this.resolveClients(data[2]); + this.resolveFilesystems(data[3]); + if (data[4]) { + this.resolveModel(data[4]); } - ); + }); } createForm() { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts index fb00a8ae3e9..2a52098923e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts @@ -149,7 +149,7 @@ export class NfsListComponent implements OnInit, OnDestroy { this.builders ); }, - (error) => { + () => { this.onFetchError(); } ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.ts index 7599833bc2a..128e221867f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.ts @@ -239,7 +239,7 @@ export class ErasureCodeProfileFormComponent implements OnInit { }) .subscribe( undefined, - (resp) => { + () => { this.form.setErrors({ cdSubmitButton: true }); }, () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts index 117b7d26590..da7161dd4dc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts @@ -177,7 +177,7 @@ describe('PoolListComponent', () => { describe('getPgStatusCellClass', () => { const testMethod = (value, expected) => - expect(component.getPgStatusCellClass({ row: '', column: '', value: value })).toEqual({ + expect(component.getPgStatusCellClass('', '', value)).toEqual({ 'text-right': true, [expected]: true }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts index 9ddc9a8391a..86ec1c35a01 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts @@ -103,7 +103,7 @@ export class PoolListComponent implements OnInit { name: this.i18n('PG Status'), flexGrow: 3, cellClass: ({ row, column, value }): any => { - return this.getPgStatusCellClass({ row, column, value }); + return this.getPgStatusCellClass(row, column, value); } }, { @@ -190,7 +190,7 @@ export class PoolListComponent implements OnInit { }); } - getPgStatusCellClass({ row, column, value }): object { + getPgStatusCellClass(_row, _column, value): object { return { 'text-right': true, [`pg-${this.pgCategoryService.getTypeByStates(value)}`]: true diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.spec.ts index e03aaf866b7..daa96f34e8b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.spec.ts @@ -25,8 +25,8 @@ describe('LoginComponent', () => { }); it('should ensure no modal dialogs are opened', () => { - component.bsModalService.modalsCount = 2; + component['bsModalService']['modalsCount'] = 2; component.ngOnInit(); - expect(component.bsModalService.getModalsCount()).toBe(0); + expect(component['bsModalService'].getModalsCount()).toBe(0); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts index b80fa441176..639fa915018 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts @@ -123,7 +123,9 @@ describe('RoleFormComponent', () => { cephfs: ['read', 'delete'], grafana: ['update'] }); - component.onClickHeaderCheckbox('scope', { target: { checked: false } }); + component.onClickHeaderCheckbox('scope', ({ + target: { checked: false } + } as unknown) as Event); const scopes_permissions = form.getValue('scopes_permissions'); expect(scopes_permissions).toEqual({}); }); @@ -134,7 +136,7 @@ describe('RoleFormComponent', () => { cephfs: ['create', 'update'], grafana: ['delete'] }); - component.onClickHeaderCheckbox('scope', { target: { checked: true } }); + component.onClickHeaderCheckbox('scope', ({ target: { checked: true } } as unknown) as Event); const scopes_permissions = form.getValue('scopes_permissions'); const keys = Object.keys(scopes_permissions); expect(keys).toEqual(['cephfs', 'grafana']); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts index 47276a8f561..9d0cfb72b89 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts @@ -193,7 +193,7 @@ describe('UserFormComponent', () => { it('should alert if user is removing needed role permission', () => { spyOn(TestBed.get(AuthStorageService), 'getUsername').and.callFake(() => user.username); let modalBodyTpl = null; - spyOn(modalService, 'show').and.callFake((content, config) => { + spyOn(modalService, 'show').and.callFake((_content, config) => { modalBodyTpl = config.initialState.bodyTpl; }); formHelper.setValue('roles', ['read-only']); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts index 6432e187ce3..cc4b7d31c65 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts @@ -16,7 +16,8 @@ describe('RbdMirroringService', () => { image_error: [], image_syncing: [], image_ready: [] - } + }, + executing_tasks: [{}] }; configureTestBed( diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts index 1bd28c2e10a..9602ad784c2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts @@ -104,7 +104,7 @@ describe('CriticalConfirmationModalComponent', () => { mockFixture = TestBed.createComponent(MockComponent); mockComponent = mockFixture.componentInstance; // Mocking the modals as a lot would be left over - spyOn(mockComponent.modalService, 'show').and.callFake((modalComp, config) => { + spyOn(mockComponent.modalService, 'show').and.callFake((_modalComp, config) => { const ref = new BsModalRef(); fixture = TestBed.createComponent(CriticalConfirmationModalComponent); component = fixture.componentInstance; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts index ed0ec929e47..1a2656e00ca 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts @@ -216,7 +216,7 @@ export class GrafanaComponent implements OnInit, OnChanges { this.grafanaSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.url); } - onTimepickerChange(event) { + onTimepickerChange() { if (this.grafanaExist) { this.getFrame(); } @@ -229,7 +229,7 @@ export class GrafanaComponent implements OnInit, OnChanges { } } - ngOnChanges(changes) { + ngOnChanges() { if (this.grafanaExist) { this.getFrame(); } 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 906fb64d49c..565f7e4dbce 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 @@ -90,7 +90,7 @@ export class SparklineComponent implements OnInit, OnChanges { constructor(private dimlessBinaryPipe: DimlessBinaryPipe) {} ngOnInit() { - const getStyleTop = (tooltip, positionY) => { + const getStyleTop = (tooltip) => { return tooltip.caretY - tooltip.height - tooltip.yPadding - 5 + 'px'; }; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.ts index ae110a7e77d..aab90c9545e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.ts @@ -91,7 +91,7 @@ export class TableKeyValueComponent implements OnInit, OnChanges { this.useData(); } - ngOnChanges(changes) { + ngOnChanges() { this.useData(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts index 703368fbb42..e82a10978ce 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts @@ -125,7 +125,7 @@ describe('TableComponent', () => { it('should test search manipulation', () => { let searchTerms = []; - spyOn(component, 'subSearch').and.callFake((d, search) => { + spyOn(component, 'subSearch').and.callFake((_d, search) => { expect(search).toEqual(searchTerms); }); const searchTest = (s: string, st: string[]) => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index 19ba5e427ee..efb2644d00c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -333,7 +333,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O return _.isEmpty(css) ? undefined : css; } - ngOnChanges(changes) { + ngOnChanges() { this.useData(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts index ac19aa34f35..7ee51b63bb2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/empty.pipe.ts @@ -6,7 +6,7 @@ import * as _ from 'lodash'; name: 'empty' }) export class EmptyPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { return _.isUndefined(value) || _.isNull(value) ? '-' : value; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts index 6af1b6b4d06..911f320410f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts @@ -7,7 +7,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class CdDatePipe implements PipeTransform { constructor(private datePipe: DatePipe) {} - transform(value: any, args?: any): any { + transform(value: any): any { if (value === null || value === '') { return ''; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-release-name.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-release-name.pipe.ts index 5374d56e40d..c7c1e1d7423 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-release-name.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-release-name.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'cephReleaseName' }) export class CephReleaseNamePipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { // Expect "ceph version 13.1.0-419-g251e2515b5 // (251e2515b563856349498c6caf34e7a282f62937) nautilus (dev)" const result = /ceph version\s+[^ ]+\s+\(.+\)\s+(.+)\s+\((.+)\)/.exec(value); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-short-version.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-short-version.pipe.ts index 9599112c811..03e75dfb385 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-short-version.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-short-version.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'cephShortVersion' }) export class CephShortVersionPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { // Expect "ceph version 1.2.3-g9asdasd (as98d7a0s8d7)" const result = /ceph version\s+([^ ]+)\s+\(.+\)/.exec(value); if (result) { 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 bcd8f666c7e..67faad2b402 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 @@ -7,7 +7,7 @@ import { FormatterService } from '../services/formatter.service'; export class DimlessBinaryPerSecondPipe implements PipeTransform { constructor(private formatter: FormatterService) {} - transform(value: any, args?: any): any { + transform(value: any): any { return this.formatter.format_number(value, 1024, [ 'B/s', 'kB/s', 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 b1784fcf16b..493696ef931 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 @@ -7,7 +7,7 @@ import { FormatterService } from '../services/formatter.service'; export class DimlessBinaryPipe implements PipeTransform { constructor(private formatter: FormatterService) {} - transform(value: any, args?: any): any { + transform(value: any): any { return this.formatter.format_number(value, 1024, [ 'B', 'KiB', 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 7cd6a45aeed..18994bd12bd 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 @@ -7,7 +7,7 @@ import { FormatterService } from '../services/formatter.service'; export class DimlessPipe implements PipeTransform { constructor(private formatter: FormatterService) {} - transform(value: any, args?: any): any { + transform(value: any): any { return this.formatter.format_number(value, 1000, ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.spec.ts index c516ad3835d..94e5f8bdfec 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.spec.ts @@ -44,7 +44,7 @@ describe('FilterPipe', () => { const filters = [ { value: '', - applyFilter: (row, val) => { + applyFilter: () => { return false; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts index 9d82475a14f..4b95022668c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'healthColor' }) export class HealthColorPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { if (value === 'HEALTH_OK') { return { color: '#00bb00' }; } else if (value === 'HEALTH_WARN') { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iops.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iops.pipe.ts index 921e773af61..9644801f8ce 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iops.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iops.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'iops' }) export class IopsPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { return `${value} IOPS`; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/list.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/list.pipe.ts index 1e379190e04..9a044c1b0f6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/list.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/list.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'list' }) export class ListPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { return value.join(', '); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts index ea46d16c0e3..c7f5e50b5ee 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'logPriority' }) export class LogPriorityPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { if (value === '[INF]') { return 'info'; } else if (value === '[WRN]') { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/milliseconds.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/milliseconds.pipe.ts index c2e45ca33cb..b0dc68604a7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/milliseconds.pipe.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/milliseconds.pipe.ts @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'milliseconds' }) export class MillisecondsPipe implements PipeTransform { - transform(value: any, args?: any): any { + transform(value: any): any { return `${value} ms`; } } 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 6bfa3958c62..3ebc389eb22 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 @@ -8,7 +8,7 @@ import * as moment from 'moment'; export class RelativeDatePipe implements PipeTransform { constructor() {} - transform(value: any, args?: any): any { + 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 5ae427572a3..67e93e2a045 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 @@ -18,7 +18,7 @@ describe('ApiInterceptorService', () => { let router: Router; const url = 'api/xyz'; - const httpError = (error, errorOpts, done = (resp) => {}) => { + const httpError = (error, errorOpts, done = (_resp) => {}) => { httpClient.get(url).subscribe( () => {}, (resp) => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.spec.ts index bf8c71c34d8..f23d7dc2670 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.spec.ts @@ -35,13 +35,13 @@ describe('AuthGuardService', () => { it('should allow the user if loggedIn', () => { spyOn(authStorageService, 'isLoggedIn').and.returnValue(true); - expect(service.canActivate(null, null)).toBe(true); + expect(service.canActivate()).toBe(true); }); it('should prevent user if not loggedIn and redirect to login page', fakeAsync(() => { const router = TestBed.get(Router); ngZone.run(() => { - expect(service.canActivate(null, null)).toBe(false); + expect(service.canActivate()).toBe(false); }); tick(); expect(router.url).toBe('/login'); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts index f376e6a8cab..2b4f635f63d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts @@ -1,11 +1,5 @@ import { Injectable } from '@angular/core'; -import { - ActivatedRouteSnapshot, - CanActivate, - CanActivateChild, - Router, - RouterStateSnapshot -} from '@angular/router'; +import { CanActivate, CanActivateChild, Router } from '@angular/router'; import { AuthStorageService } from './auth-storage.service'; import { ServicesModule } from './services.module'; @@ -16,7 +10,7 @@ import { ServicesModule } from './services.module'; export class AuthGuardService implements CanActivate, CanActivateChild { constructor(private router: Router, private authStorageService: AuthStorageService) {} - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + canActivate() { if (this.authStorageService.isLoggedIn()) { return true; } @@ -24,7 +18,7 @@ export class AuthGuardService implements CanActivate, CanActivateChild { return false; } - canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { - return this.canActivate(route, state); + canActivateChild(): boolean { + return this.canActivate(); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.spec.ts index 068a1e1d6a0..e9726a47e10 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.spec.ts @@ -13,18 +13,18 @@ describe('AuthStorageService', () => { }); it('should store username', () => { - service.set(username); + service.set(username, ''); expect(localStorage.getItem('dashboard_username')).toBe(username); }); it('should remove username', () => { - service.set(username); + service.set(username, ''); service.remove(); expect(localStorage.getItem('dashboard_username')).toBe(null); }); it('should be loggedIn', () => { - service.set(username); + service.set(username, ''); expect(service.isLoggedIn()).toBe(true); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts index 961b7c82644..6665647bb2a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts @@ -52,7 +52,7 @@ describe('FeatureTogglesGuardService', () => { ngZone.run(() => { service - .canActivate({ routeConfig: { path: path } }, null) + .canActivate({ routeConfig: { path: path } }) .subscribe((val) => (result = val)); }); tick(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.ts index 9114ffd6326..07ee7d5c4fb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.ts @@ -1,11 +1,5 @@ import { Injectable } from '@angular/core'; -import { - ActivatedRouteSnapshot, - CanActivate, - CanActivateChild, - Router, - RouterStateSnapshot -} from '@angular/router'; +import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router } from '@angular/router'; import { map } from 'rxjs/operators'; @@ -18,7 +12,7 @@ import { ServicesModule } from './services.module'; export class FeatureTogglesGuardService implements CanActivate, CanActivateChild { constructor(private router: Router, private featureToggles: FeatureTogglesService) {} - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + canActivate(route: ActivatedRouteSnapshot) { return this.featureToggles.get().pipe( map((enabledFeatures: FeatureTogglesMap) => { if (enabledFeatures[route.routeConfig.path] === false) { @@ -30,7 +24,7 @@ export class FeatureTogglesGuardService implements CanActivate, CanActivateChild ); } - canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { - return this.canActivate(route.parent, state); + canActivateChild(route: ActivatedRouteSnapshot) { + return this.canActivate(route.parent); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.spec.ts index 5da62ddc19e..b0c1860dcdb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.spec.ts @@ -63,7 +63,7 @@ describe('FormatterService', () => { expect(service.toBytes('1.1 kib')).toBeNull(); expect(service.toBytes('1.kib')).toBeNull(); expect(service.toBytes('1 ki')).toBeNull(); - expect(service.toBytes()).toBeNull(); + expect(service.toBytes(undefined)).toBeNull(); expect(service.toBytes('')).toBeNull(); expect(service.toBytes('-')).toBeNull(); expect(service.toBytes(null)).toBeNull(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts index 112a194f12a..2528826783c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts @@ -29,7 +29,7 @@ describe('ModuleStatusGuardService', () => { let result: boolean; spyOn(httpClient, 'get').and.returnValue(observableOf(getResult)); ngZone.run(() => { - service.canActivateChild(route, null).subscribe((resp) => { + service.canActivateChild(route).subscribe((resp) => { result = resp; }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts index 5f47c2dc20c..f37024ea63c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts @@ -1,12 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { - ActivatedRouteSnapshot, - CanActivate, - CanActivateChild, - Router, - RouterStateSnapshot -} from '@angular/router'; +import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router } from '@angular/router'; import { of as observableOf } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; @@ -44,11 +38,11 @@ import { ServicesModule } from './services.module'; export class ModuleStatusGuardService implements CanActivate, CanActivateChild { constructor(private http: HttpClient, private router: Router) {} - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + canActivate(route: ActivatedRouteSnapshot) { return this.doCheck(route); } - canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + canActivateChild(childRoute: ActivatedRouteSnapshot) { return this.doCheck(childRoute); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.ts index 0612d2f7f28..08b6ff8878b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.ts @@ -36,7 +36,7 @@ export class NotificationService { let notifications: CdNotification[] = []; if (_.isString(stringNotifications)) { - notifications = JSON.parse(stringNotifications, (key, value) => { + notifications = JSON.parse(stringNotifications, (_key, value) => { if (_.isPlainObject(value)) { return _.assign(new CdNotification(), value); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts index 36fe4c66fbd..71d12c0f428 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts @@ -42,7 +42,7 @@ describe('PrometheusAlertService', () => { const resp = { status: 500, error: {} }; service = new PrometheusAlertService(null, { ifAlertmanagerConfigured: (fn) => fn(), - list: () => ({ subscribe: (fn, err) => err(resp) }) + list: () => ({ subscribe: (_fn, err) => err(resp) }) }); expect(service['connected']).toBe(true); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts index 08069359891..f457423fcd8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts @@ -293,24 +293,24 @@ export class TaskMessageService { 'rbd/mirroring/pool/edit': this.newTaskMessage( this.commonOperations.update, this.rbd_mirroring.pool, - (metadata) => ({ + () => ({ 16: this.i18n('Cannot disable mirroring because it contains a peer.') }) ), 'rbd/mirroring/peer/add': this.newTaskMessage( this.commonOperations.create, this.rbd_mirroring.pool_peer, - (metadata) => ({}) + () => ({}) ), 'rbd/mirroring/peer/edit': this.newTaskMessage( this.commonOperations.update, this.rbd_mirroring.pool_peer, - (metadata) => ({}) + () => ({}) ), 'rbd/mirroring/peer/delete': this.newTaskMessage( this.commonOperations.delete, this.rbd_mirroring.pool_peer, - (metadata) => ({}) + () => ({}) ), // iSCSI target tasks 'iscsi/target/create': this.newTaskMessage(this.commonOperations.create, (metadata) => diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts index 75968de6904..1dda8afc226 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts @@ -76,7 +76,7 @@ describe('TaskWrapperService', () => { it('should call notifyTask if asynchronous task would have been finished', () => { const taskManager = TestBed.get(TaskManagerService); - spyOn(taskManager, 'subscribe').and.callFake((name, metadata, onTaskFinished) => { + spyOn(taskManager, 'subscribe').and.callFake((_name, _metadata, onTaskFinished) => { onTaskFinished(); }); callWrapTaskAroundCall(202, 'async').subscribe(null, null, () => (passed = true)); diff --git a/src/pybind/mgr/dashboard/frontend/src/jestGlobalMocks.ts b/src/pybind/mgr/dashboard/frontend/src/jestGlobalMocks.ts index 3ccce9a1d28..6c6750adbbd 100644 --- a/src/pybind/mgr/dashboard/frontend/src/jestGlobalMocks.ts +++ b/src/pybind/mgr/dashboard/frontend/src/jestGlobalMocks.ts @@ -12,7 +12,7 @@ Object.defineProperty(window, 'localStorage', { value: mock() }); Object.defineProperty(window, 'sessionStorage', { value: mock() }); Object.defineProperty(window, 'getComputedStyle', { value: () => ({ - getPropertyValue: (prop) => { + getPropertyValue: () => { return ''; } }) diff --git a/src/pybind/mgr/dashboard/frontend/src/tsconfig.app.json b/src/pybind/mgr/dashboard/frontend/src/tsconfig.app.json index 89c61e3f07d..05a9aad1935 100644 --- a/src/pybind/mgr/dashboard/frontend/src/tsconfig.app.json +++ b/src/pybind/mgr/dashboard/frontend/src/tsconfig.app.json @@ -8,7 +8,6 @@ }, "exclude": [ "**/*.spec.ts", - "test.ts", "testing/*.ts" ] } diff --git a/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json b/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json index b5de1d67b30..0533feab559 100644 --- a/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json +++ b/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json @@ -6,12 +6,12 @@ "module": "commonjs", "target": "es5", "types": [ - "jasmine", + "jest", "node" - ] + ], + "noEmit": true }, "files": [ - "test.ts", "polyfills.ts" ], "include": [ diff --git a/src/pybind/mgr/dashboard/frontend/tslint.json b/src/pybind/mgr/dashboard/frontend/tslint.json index e4c09adcb81..f0ce66cf44c 100644 --- a/src/pybind/mgr/dashboard/frontend/tslint.json +++ b/src/pybind/mgr/dashboard/frontend/tslint.json @@ -40,7 +40,6 @@ "no-trailing-whitespace": true, "no-unnecessary-initializer": true, "no-unused-expression": true, - "no-unused-variable": true, "no-use-before-declare": true, "no-var-keyword": true, "object-literal-sort-keys": false, @@ -61,7 +60,7 @@ } ], "unified-signatures": true, - "variable-name": [true, "check-format", "allow-snake-case"], + "variable-name": [true, "check-format", "allow-snake-case", "allow-leading-underscore"], "whitespace": [ true, "check-branch",