From: Tiago Melo Date: Wed, 30 May 2018 15:04:01 +0000 (+0100) Subject: mgr/dashboard: Add 'no-unused-variable' rule to tslint X-Git-Tag: v14.0.1~1202^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=79865d88fb9ab59b24e46868e4c6d258c461da94;p=ceph.git mgr/dashboard: Add 'no-unused-variable' rule to tslint Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts index c9e0e7e8773b..9f5024eb6215 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app.component.ts @@ -13,15 +13,16 @@ import { AuthStorageService } from './shared/services/auth-storage.service'; export class AppComponent { title = 'cd'; - constructor(private authStorageService: AuthStorageService, - private router: Router, - public toastr: ToastsManager, - private vcr: ViewContainerRef) { - this.toastr.setRootViewContainerRef(vcr); + constructor( + private authStorageService: AuthStorageService, + private router: Router, + public toastr: ToastsManager, + private vcr: ViewContainerRef + ) { + this.toastr.setRootViewContainerRef(this.vcr); } isLoginActive() { return this.router.url === '/login' || !this.authStorageService.isLoggedIn(); } - } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts index 74de5628536d..bf4a68c94723 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts @@ -1,8 +1,5 @@ -import { HttpClient } from '@angular/common/http'; import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import * as _ from 'lodash'; - import { RbdMirroringService } from '../../../shared/api/rbd-mirroring.service'; import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum'; import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe'; @@ -43,10 +40,9 @@ export class MirroringComponent implements OnInit { }; constructor( - private http: HttpClient, private rbdMirroringService: RbdMirroringService, private cephShortVersionPipe: CephShortVersionPipe - ) { } + ) {} ngOnInit() { this.daemons.columns = [ 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 dae781dc1537..2e3ecbaec551 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 @@ -1,22 +1,10 @@ -import { - Component, - Input, - OnChanges, - OnInit, - TemplateRef, - ViewChild -} from '@angular/core'; +import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core'; import * as _ from 'lodash'; -import { ToastsManager } from 'ng2-toastr'; import { BsModalRef, BsModalService } from 'ngx-bootstrap'; -import { - RbdService -} from '../../../shared/api/rbd.service'; -import { - DeletionModalComponent -} from '../../../shared/components/deletion-modal/deletion-modal.component'; +import { RbdService } from '../../../shared/api/rbd.service'; +import { DeletionModalComponent } from '../../../shared/components/deletion-modal/deletion-modal.component'; import { CellTemplate } from '../../../shared/enum/cell-template.enum'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; @@ -24,14 +12,10 @@ import { ExecutingTask } from '../../../shared/models/executing-task'; import { FinishedTask } from '../../../shared/models/finished-task'; import { CdDatePipe } from '../../../shared/pipes/cd-date.pipe'; import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe'; -import { - NotificationService -} from '../../../shared/services/notification.service'; +import { NotificationService } from '../../../shared/services/notification.service'; import { TaskManagerService } from '../../../shared/services/task-manager.service'; import { RbdSnapshotFormComponent } from '../rbd-snapshot-form/rbd-snapshot-form.component'; -import { - RollbackConfirmationModalComponent -} from '../rollback-confirmation-modal/rollback-confimation-modal.component'; +import { RollbackConfirmationModalComponent } from '../rollback-confirmation-modal/rollback-confimation-modal.component'; import { RbdSnapshotModel } from './rbd-snapshot.model'; @Component({ @@ -40,7 +24,6 @@ import { RbdSnapshotModel } from './rbd-snapshot.model'; styleUrls: ['./rbd-snapshot-list.component.scss'] }) export class RbdSnapshotListComponent implements OnInit, OnChanges { - @Input() snapshots: RbdSnapshotModel[] = []; @Input() poolName: string; @Input() rbdName: string; @@ -57,13 +40,14 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { selection = new CdTableSelection(); - constructor(private modalService: BsModalService, - private dimlessBinaryPipe: DimlessBinaryPipe, - private cdDatePipe: CdDatePipe, - private rbdService: RbdService, - private toastr: ToastsManager, - private taskManagerService: TaskManagerService, - private notificationService: NotificationService) { } + constructor( + private modalService: BsModalService, + private dimlessBinaryPipe: DimlessBinaryPipe, + private cdDatePipe: CdDatePipe, + private rbdService: RbdService, + private taskManagerService: TaskManagerService, + private notificationService: NotificationService + ) {} ngOnInit() { this.columns = [ @@ -116,10 +100,8 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { if (snapshotExecuting) { if (executingTask.name === 'rbd/snap/delete') { snapshotExecuting.cdExecuting = 'deleting'; - } else if (executingTask.name === 'rbd/snap/edit') { snapshotExecuting.cdExecuting = 'updating'; - } else if (executingTask.name === 'rbd/snap/rollback') { snapshotExecuting.cdExecuting = 'rolling back'; } @@ -152,7 +134,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { this.modalRef.content.onSubmit.subscribe((snapshotName: string) => { const executingTask = new ExecutingTask(); executingTask.name = taskName; - executingTask.metadata = {'snapshot_name': snapshotName}; + executingTask.metadata = { snapshot_name: snapshotName }; this.executingTasks.push(executingTask); this.ngOnChanges(); }); @@ -172,21 +154,26 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { const finishedTask = new FinishedTask(); finishedTask.name = 'rbd/snap/edit'; finishedTask.metadata = { - 'pool_name': this.poolName, - 'image_name': this.rbdName, - 'snapshot_name': snapshotName + pool_name: this.poolName, + image_name: this.rbdName, + snapshot_name: snapshotName }; - this.rbdService.protectSnapshot(this.poolName, this.rbdName, snapshotName, !isProtected) - .toPromise().then((resp) => { + this.rbdService + .protectSnapshot(this.poolName, this.rbdName, snapshotName, !isProtected) + .toPromise() + .then((resp) => { const executingTask = new ExecutingTask(); executingTask.name = finishedTask.name; executingTask.metadata = finishedTask.metadata; this.executingTasks.push(executingTask); this.ngOnChanges(); - this.taskManagerService.subscribe(finishedTask.name, finishedTask.metadata, + this.taskManagerService.subscribe( + finishedTask.name, + finishedTask.metadata, (asyncFinishedTask: FinishedTask) => { this.notificationService.notifyTask(asyncFinishedTask); - }); + } + ); }); } @@ -194,22 +181,26 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { const finishedTask = new FinishedTask(); finishedTask.name = taskName; finishedTask.metadata = { - 'pool_name': this.poolName, - 'image_name': this.rbdName, - 'snapshot_name': snapshotName + pool_name: this.poolName, + image_name: this.rbdName, + snapshot_name: snapshotName }; this.rbdService[task](this.poolName, this.rbdName, snapshotName) - .toPromise().then(() => { + .toPromise() + .then(() => { const executingTask = new ExecutingTask(); executingTask.name = finishedTask.name; executingTask.metadata = finishedTask.metadata; this.executingTasks.push(executingTask); this.modalRef.hide(); this.ngOnChanges(); - this.taskManagerService.subscribe(executingTask.name, executingTask.metadata, + this.taskManagerService.subscribe( + executingTask.name, + executingTask.metadata, (asyncFinishedTask: FinishedTask) => { this.notificationService.notifyTask(asyncFinishedTask); - }); + } + ); }) .catch((resp) => { this.modalRef.content.stopLoadingSpinner(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts index d6ac4d1db215..b95b7a5469d4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import * as _ from 'lodash'; - import { CephfsService } from '../../../shared/api/cephfs.service'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; 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 196d871066ac..92c2b983371b 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 @@ -10,7 +10,6 @@ import { } from '@angular/core'; import * as Chart from 'chart.js'; -import * as _ from 'lodash'; import { ChartTooltip } from '../../../shared/models/chart-tooltip'; import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe'; @@ -99,11 +98,10 @@ export class HealthPieComponent implements OnChanges, OnInit { this.chartCanvasRef, this.chartTooltipRef, getStyleLeft, - getStyleTop, + getStyleTop ); chartTooltip.getBody = getBody; - const self = this; this.chart.options.tooltips.custom = (tooltip) => { chartTooltip.customTooltips(tooltip); }; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts index ce9e045f08e5..bbf33b5ac9a0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts @@ -12,7 +12,6 @@ describe('MdsSummaryPipe', () => { standbys: [0], filesystems: [{ mdsmap: { info: [{ state: 'up:standby-replay' }] } }] }; - const result = { color: '#FF2222' }; expect(pipe.transform(value)).toBe('0 active, 2 standby'); }); @@ -21,7 +20,6 @@ describe('MdsSummaryPipe', () => { standbys: [0], filesystems: [{ mdsmap: { info: [{ state: 'up:active' }] } }] }; - const result = { color: '#FF2222' }; expect(pipe.transform(value)).toBe('1 active, 1 standby'); }); 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 45857a69f0b1..1e449b094340 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 @@ -10,8 +10,6 @@ describe('PoolListComponent', () => { let component: PoolListComponent; let fixture: ComponentFixture; - const fakeService = {}; - beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [PoolListComponent], diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.ts index d25ac7ba6973..77bea30a6be1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.ts @@ -1,8 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import * as _ from 'lodash'; - @Component({ selector: 'cd-rgw-501', templateUrl: './rgw-501.component.html', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts index 82e32c050fb2..3628460800fd 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts @@ -1,5 +1,4 @@ import { Component, ViewChild } from '@angular/core'; -import { Router } from '@angular/router'; import { BsModalService } from 'ngx-bootstrap'; import 'rxjs/add/observable/forkJoin'; @@ -24,11 +23,7 @@ export class RgwBucketListComponent { buckets: object[] = []; selection: CdTableSelection = new CdTableSelection(); - constructor( - private router: Router, - private rgwBucketService: RgwBucketService, - private bsModalService: BsModalService - ) { + constructor(private rgwBucketService: RgwBucketService, private bsModalService: BsModalService) { this.columns = [ { name: 'Name', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts index 70c4d9142b25..8c9376fdfb4e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts @@ -1,5 +1,4 @@ import { Component, ViewChild } from '@angular/core'; -import { Router } from '@angular/router'; import { BsModalService } from 'ngx-bootstrap'; import 'rxjs/add/observable/forkJoin'; @@ -25,11 +24,7 @@ export class RgwUserListComponent { users: object[] = []; selection: CdTableSelection = new CdTableSelection(); - constructor( - private router: Router, - private rgwUserService: RgwUserService, - private bsModalService: BsModalService - ) { + constructor(private rgwUserService: RgwUserService, private bsModalService: BsModalService) { this.columns = [ { name: 'Username', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts index 4147af813980..a1ff473e80c7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewContainerRef } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { AuthService } from '../../../shared/api/auth.service'; @@ -11,13 +11,13 @@ import { AuthStorageService } from '../../../shared/services/auth-storage.servic styleUrls: ['./login.component.scss'] }) export class LoginComponent implements OnInit { - model = new Credentials(); - constructor(private authService: AuthService, - private authStorageService: AuthStorageService, - private router: Router) { - } + constructor( + private authService: AuthService, + private authStorageService: AuthStorageService, + private router: Router + ) {} ngOnInit() { if (this.authStorageService.isLoggedIn()) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts index dcb5a9e10b9f..63381cfa28e4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts @@ -1,5 +1,5 @@ import { HttpClientModule } from '@angular/common/http'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; import { ConfigurationService } from './configuration.service'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts index bf061e9f6452..f84b856020c0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts @@ -1,9 +1,7 @@ import { HttpClientModule } from '@angular/common/http'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; -import { appendFile } from 'fs'; - import { DashboardService } from './dashboard.service'; describe('DashboardService', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts index 1d5f7de97b77..53ca7212bab7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts @@ -1,8 +1,5 @@ import { HttpClientModule } from '@angular/common/http'; -import { - HttpClientTestingModule, - HttpTestingController -} from '@angular/common/http/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; import { MonitorService } from './monitor.service'; @@ -15,7 +12,10 @@ describe('MonitorService', () => { }); }); - it('should be created', inject([MonitorService], (service: MonitorService) => { - expect(service).toBeTruthy(); - })); + it( + 'should be created', + inject([MonitorService], (service: MonitorService) => { + expect(service).toBeTruthy(); + }) + ); }); 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 0f598318a31d..832b1a657c0d 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 @@ -1,5 +1,5 @@ import { HttpClientModule } from '@angular/common/http'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; import { RbdMirroringService } from './rbd-mirroring.service'; @@ -12,7 +12,10 @@ describe('RbdMirroringService', () => { }); }); - it('should be created', inject([RbdMirroringService], (service: RbdMirroringService) => { - expect(service).toBeTruthy(); - })); + it( + 'should be created', + inject([RbdMirroringService], (service: RbdMirroringService) => { + expect(service).toBeTruthy(); + }) + ); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/deletion-modal/deletion-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/deletion-modal/deletion-modal.component.spec.ts index 9ac9876826a8..0781275be578 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/deletion-modal/deletion-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/deletion-modal/deletion-modal.component.spec.ts @@ -6,7 +6,6 @@ import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap'; import { Observable } from 'rxjs/Observable'; import { Subscriber } from 'rxjs/Subscriber'; -import { ModalComponent } from '../modal/modal.component'; import { DeletionModalComponent } from './deletion-modal.component'; @NgModule({ 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 9a748329cd26..23e0455838a9 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 @@ -1,6 +1,5 @@ -import { Component, Input, TemplateRef } from '@angular/core'; +import { Component, Input } from '@angular/core'; -import { BsModalService } from 'ngx-bootstrap/modal'; import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; @Component({ @@ -11,5 +10,5 @@ import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; export class ModalComponent { @Input() modalRef: BsModalRef; - constructor(private modalService: BsModalService) {} + constructor() {} } 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 35d6f3e593a8..69f1bbafe845 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 @@ -1,4 +1,4 @@ -import { Component, Input, OnChanges, OnInit } from '@angular/core'; +import { Component, Input, OnChanges } from '@angular/core'; @Component({ selector: 'cd-usage-bar', @@ -6,7 +6,6 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core'; styleUrls: ['./usage-bar.component.scss'] }) export class UsageBarComponent implements OnChanges { - @Input() totalBytes: number; @Input() usedBytes: number; @@ -14,12 +13,11 @@ export class UsageBarComponent implements OnChanges { freePercentage: number; freeBytes: number; - constructor() { } + constructor() {} ngOnChanges() { this.usedPercentage = Math.round(this.usedBytes / this.totalBytes * 100); this.freePercentage = 100 - this.usedPercentage; this.freeBytes = this.totalBytes - this.usedBytes; } - } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/chart-tooltip.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/chart-tooltip.ts index 56962f3da69f..9b6552dd93c3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/chart-tooltip.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/chart-tooltip.ts @@ -1,7 +1,5 @@ import { ElementRef } from '@angular/core'; -import * as _ from 'lodash'; - export class ChartTooltip { tooltipEl: any; chartEl: any; @@ -57,13 +55,13 @@ export class ChartTooltip { // Set Text if (tooltip.body) { const titleLines = tooltip.title || []; - const bodyLines = tooltip.body.map(bodyItem => { + const bodyLines = tooltip.body.map((bodyItem) => { return bodyItem.lines; }); let innerHtml = ''; - titleLines.forEach(title => { + titleLines.forEach((title) => { innerHtml += '' + this.getTitle(title) + ''; }); innerHtml += ''; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.spec.ts index 1daa3044c3c8..5e391e97f10d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.spec.ts @@ -59,7 +59,7 @@ describe('TaskManagerService', () => { let called = false; taskManagerService.subscribe('foo', {}, () => (called = true)); const original_subscriptions = _.cloneDeep(taskManagerService.subscriptions); - const new_summary = _.assign(summary, { + _.assign(summary, { executing_tasks: [{ name: 'foo', metadata: {} }], finished_tasks: [] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.ts index cac1df061dfc..b7435e50b7c9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.ts @@ -21,10 +21,9 @@ class TaskSubscription { @Injectable() export class TaskManagerService { - subscriptions: Array = []; - constructor(private summaryService: SummaryService) { + constructor(summaryService: SummaryService) { summaryService.summaryData$.subscribe((data: any) => { const executingTasks = data.executing_tasks; const finishedTasks = data.finished_tasks; @@ -49,8 +48,7 @@ export class TaskManagerService { _getTask(subscription: TaskSubscription, tasks: Array): Task { for (const task of tasks) { - if (task.name === subscription.name && - _.isEqual(task.metadata, subscription.metadata)) { + if (task.name === subscription.name && _.isEqual(task.metadata, subscription.metadata)) { return task; } } diff --git a/src/pybind/mgr/dashboard/frontend/tslint.json b/src/pybind/mgr/dashboard/frontend/tslint.json index d915d4d8fe19..e76a2d4e266b 100644 --- a/src/pybind/mgr/dashboard/frontend/tslint.json +++ b/src/pybind/mgr/dashboard/frontend/tslint.json @@ -15,7 +15,7 @@ "indent": [true, "spaces"], "interface-over-type-literal": true, "label-position": true, - "max-line-length": [true, {"limit": 100, "ignore-pattern": "^import |^export {(.*?)}"}], + "max-line-length": [true, { "limit": 100, "ignore-pattern": "^import |^export {(.*?)}" }], "member-access": false, "member-ordering": [ true, @@ -42,6 +42,7 @@ "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,