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();
}
-
}
-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';
};
constructor(
- private http: HttpClient,
private rbdMirroringService: RbdMirroringService,
private cephShortVersionPipe: CephShortVersionPipe
- ) { }
+ ) {}
ngOnInit() {
this.daemons.columns = [
-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';
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({
styleUrls: ['./rbd-snapshot-list.component.scss']
})
export class RbdSnapshotListComponent implements OnInit, OnChanges {
-
@Input() snapshots: RbdSnapshotModel[] = [];
@Input() poolName: string;
@Input() rbdName: string;
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 = [
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';
}
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();
});
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);
- });
+ }
+ );
});
}
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();
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';
} 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';
this.chartCanvasRef,
this.chartTooltipRef,
getStyleLeft,
- getStyleTop,
+ getStyleTop
);
chartTooltip.getBody = getBody;
- const self = this;
this.chart.options.tooltips.custom = (tooltip) => {
chartTooltip.customTooltips(tooltip);
};
standbys: [0],
filesystems: [{ mdsmap: { info: [{ state: 'up:standby-replay' }] } }]
};
- const result = { color: '#FF2222' };
expect(pipe.transform(value)).toBe('0 active, 2 standby');
});
standbys: [0],
filesystems: [{ mdsmap: { info: [{ state: 'up:active' }] } }]
};
- const result = { color: '#FF2222' };
expect(pipe.transform(value)).toBe('1 active, 1 standby');
});
let component: PoolListComponent;
let fixture: ComponentFixture<PoolListComponent>;
- const fakeService = {};
-
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PoolListComponent],
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',
import { Component, ViewChild } from '@angular/core';
-import { Router } from '@angular/router';
import { BsModalService } from 'ngx-bootstrap';
import 'rxjs/add/observable/forkJoin';
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',
import { Component, ViewChild } from '@angular/core';
-import { Router } from '@angular/router';
import { BsModalService } from 'ngx-bootstrap';
import 'rxjs/add/observable/forkJoin';
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',
-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';
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()) {
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';
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', () => {
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';
});
});
- it('should be created', inject([MonitorService], (service: MonitorService) => {
- expect(service).toBeTruthy();
- }));
+ it(
+ 'should be created',
+ inject([MonitorService], (service: MonitorService) => {
+ expect(service).toBeTruthy();
+ })
+ );
});
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';
});
});
- it('should be created', inject([RbdMirroringService], (service: RbdMirroringService) => {
- expect(service).toBeTruthy();
- }));
+ it(
+ 'should be created',
+ inject([RbdMirroringService], (service: RbdMirroringService) => {
+ expect(service).toBeTruthy();
+ })
+ );
});
import { Observable } from 'rxjs/Observable';
import { Subscriber } from 'rxjs/Subscriber';
-import { ModalComponent } from '../modal/modal.component';
import { DeletionModalComponent } from './deletion-modal.component';
@NgModule({
-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({
export class ModalComponent {
@Input() modalRef: BsModalRef;
- constructor(private modalService: BsModalService) {}
+ constructor() {}
}
-import { Component, Input, OnChanges, OnInit } from '@angular/core';
+import { Component, Input, OnChanges } from '@angular/core';
@Component({
selector: 'cd-usage-bar',
styleUrls: ['./usage-bar.component.scss']
})
export class UsageBarComponent implements OnChanges {
-
@Input() totalBytes: number;
@Input() usedBytes: number;
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;
}
-
}
import { ElementRef } from '@angular/core';
-import * as _ from 'lodash';
-
export class ChartTooltip {
tooltipEl: any;
chartEl: any;
// 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 = '<thead>';
- titleLines.forEach(title => {
+ titleLines.forEach((title) => {
innerHtml += '<tr><th>' + this.getTitle(title) + '</th></tr>';
});
innerHtml += '</thead><tbody>';
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: []
});
@Injectable()
export class TaskManagerService {
-
subscriptions: Array<TaskSubscription> = [];
- constructor(private summaryService: SummaryService) {
+ constructor(summaryService: SummaryService) {
summaryService.summaryData$.subscribe((data: any) => {
const executingTasks = data.executing_tasks;
const finishedTasks = data.finished_tasks;
_getTask(subscription: TaskSubscription, tasks: Array<Task>): 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;
}
}
"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,
"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,