.logs()
.get('browser')
.then(function(browserLog) {
- browserLog = browserLog.filter(log => {
+ browserLog = browserLog.filter((log) => {
return log.level.value > 900; // SEVERE level
});
}
@NgModule({
- declarations: [
- AppComponent
- ],
+ declarations: [AppComponent],
imports: [
HttpClientModule,
BrowserModule,
providers: [
{
provide: ErrorHandler,
- useClass: JsErrorHandler,
+ useClass: JsErrorHandler
},
{
provide: HTTP_INTERCEPTORS,
{
provide: ToastOptions,
useClass: CustomOption
- },
+ }
],
bootstrap: [AppComponent]
})
-export class AppModule { }
+export class AppModule {}
styleUrls: ['./iscsi.component.scss']
})
export class IscsiComponent {
-
daemons = [];
daemonsColumns: any;
images = [];
imagesColumns: any;
- constructor(private tcmuIscsiService: TcmuIscsiService,
- cephShortVersionPipe: CephShortVersionPipe,
- dimlessPipe: DimlessPipe,
- relativeDatePipe: RelativeDatePipe,
- listPipe: ListPipe) {
+ constructor(
+ private tcmuIscsiService: TcmuIscsiService,
+ cephShortVersionPipe: CephShortVersionPipe,
+ dimlessPipe: DimlessPipe,
+ relativeDatePipe: RelativeDatePipe,
+ listPipe: ListPipe
+ ) {
this.daemonsColumns = [
{
name: 'Hostname',
},
{
name: '# Active/Optimized',
- prop: 'optimized_paths',
+ prop: 'optimized_paths'
},
{
name: '# Active/Non-Optimized',
name: 'A/O Since',
prop: 'optimized_since',
pipe: relativeDatePipe
- },
+ }
];
-
}
refresh() {
this.daemons = resp.daemons;
this.images = resp.images;
this.images.map((image) => {
- image.stats_history.rd_bytes = image.stats_history.rd_bytes.map(i => i[1]);
- image.stats_history.wr_bytes = image.stats_history.wr_bytes.map(i => i[1]);
+ image.stats_history.rd_bytes = image.stats_history.rd_bytes.map((i) => i[1]);
+ image.stats_history.wr_bytes = image.stats_history.wr_bytes.map((i) => i[1]);
return image;
});
});
}
-
}
styleUrls: ['./rbd-details.component.scss']
})
export class RbdDetailsComponent implements OnChanges {
-
@Input() selection: CdTableSelection;
selectedItem: any;
- constructor() { }
+ constructor() {}
ngOnChanges() {
if (this.selection.hasSelection) {
],
declarations: []
})
-export class CephModule { }
+export class CephModule {}
-
.filter {
padding-right: 8px;
}
runtime: 'The value can be updated at runtime.',
no_mon_update:
'Daemons/clients do not pull this value from the monitor config database. ' +
- 'We disallow setting this option via \'ceph config set ...\'. This option should be ' +
+ `We disallow setting this option via 'ceph config set ...'. This option should be ` +
'configured via ceph.conf or via the command line.',
startup: 'Option takes effect only during daemon startup.',
cluster_create: 'Option only affects cluster creation.',
mgr: 'manager'
};
this.isLoadingHosts = true;
- this.hostService.list().then((resp) => {
- resp.map((host) => {
- host.services.map((service) => {
- service.cdLink = `/perf_counters/${service.type}/${service.id}`;
- const permissionKey = typeToPermissionKey[service.type];
- service.canRead = this.permissions[permissionKey].read;
- return service;
+ this.hostService
+ .list()
+ .then((resp) => {
+ resp.map((host) => {
+ host.services.map((service) => {
+ service.cdLink = `/perf_counters/${service.type}/${service.id}`;
+ const permissionKey = typeToPermissionKey[service.type];
+ service.canRead = this.permissions[permissionKey].read;
+ return service;
+ });
+ return host;
});
- return host;
+ this.hosts = resp;
+ this.isLoadingHosts = false;
+ })
+ .catch(() => {
+ this.isLoadingHosts = false;
+ context.error();
});
- this.hosts = resp;
- this.isLoadingHosts = false;
- }).catch(() => {
- this.isLoadingHosts = false;
- context.error();
- });
}
}
styleUrls: ['./monitor.component.scss']
})
export class MonitorComponent {
-
mon_status: any;
inQuorum: any;
notInQuorum: any;
refresh() {
this.monitorService.getMonitor().subscribe((data: any) => {
data.in_quorum.map((row) => {
- row.cdOpenSessions = row.stats.num_sessions.map(i => i[1]);
+ row.cdOpenSessions = row.stats.num_sessions.map((i) => i[1]);
row.cdLink = '/perf_counters/mon/' + row.name;
- row.cdParams = {fromLink: '/monitor'};
+ row.cdParams = { fromLink: '/monitor' };
return row;
});
data.out_quorum.map((row) => {
row.cdLink = '/perf_counters/mon/' + row.name;
- row.cdParams = {fromLink: '/monitor'};
+ row.cdParams = { fromLink: '/monitor' };
return row;
});
}
refresh() {
- this.osdService.getDetails(this.osd.tree.id)
- .subscribe((data: any) => {
- this.osd.details = data;
- if (!_.isObject(data.histogram)) {
- this.osd.histogram_failed = data.histogram;
- this.osd.details.histogram = undefined;
- }
- this.osd.loaded = true;
- });
+ this.osdService.getDetails(this.osd.tree.id).subscribe((data: any) => {
+ this.osd.details = data;
+ if (!_.isObject(data.histogram)) {
+ this.osd.histogram_failed = data.histogram;
+ this.osd.details.histogram = undefined;
+ }
+ this.osd.loaded = true;
+ });
}
}
.osd-modal {
- .oa-hr-small{
+ .oa-hr-small {
margin: 5px;
}
}
valuesStyle: any;
last = {};
- constructor() { }
+ constructor() {}
ngOnChanges() {
this.render();
const val = this.last && this.last[i] && this.last[i][j] ? col - this.last[i][j] : col;
const g = max ? val / max : 0;
const r = 1 - g;
- return {backgroundColor: this.hexcolor(r, g, 0)};
+ return { backgroundColor: this.hexcolor(r, g, 0) };
});
});
export class DashboardComponent implements OnInit {
hasGrafana = false; // TODO: Temporary var, remove when grafana is implemented
- constructor() { }
-
- ngOnInit() {
- }
+ constructor() {}
+ ngOnInit() {}
}
});
it('transforms with pg status warning', () => {
- const value = { 'active': 8 };
+ const value = { active: 8 };
expect(pipe.transform(value)).toEqual({ color: '#FFC200' });
});
import { RouterModule } from '@angular/router';
import { SharedModule } from '../../shared/shared.module';
-import {
- PerformanceCounterComponent
-} from './performance-counter/performance-counter.component';
-import {
- TablePerformanceCounterComponent
-} from './table-performance-counter/table-performance-counter.component';
+import { PerformanceCounterComponent } from './performance-counter/performance-counter.component';
+import { TablePerformanceCounterComponent } from './table-performance-counter/table-performance-counter.component';
@NgModule({
- imports: [
- CommonModule,
- SharedModule,
- RouterModule
- ],
- declarations: [
- TablePerformanceCounterComponent,
- PerformanceCounterComponent
- ],
- exports: [
- TablePerformanceCounterComponent
- ]
+ imports: [CommonModule, SharedModule, RouterModule],
+ declarations: [TablePerformanceCounterComponent, PerformanceCounterComponent],
+ exports: [TablePerformanceCounterComponent]
})
-export class PerformanceCounterModule { }
+export class PerformanceCounterModule {}
styleUrls: ['./performance-counter.component.scss']
})
export class PerformanceCounterComponent {
-
static defaultFromLink = '/hosts';
serviceId: string;
fromLink: string;
constructor(private route: ActivatedRoute) {
- this.route.queryParams.subscribe(
- (params: { fromLink: string }) => {
- this.fromLink = params.fromLink || PerformanceCounterComponent.defaultFromLink;
- }
- );
- this.route.params.subscribe(
- (params: { type: string; id: string }) => {
- this.serviceId = params.id;
- this.serviceType = params.type;
- }
- );
+ this.route.queryParams.subscribe((params: { fromLink: string }) => {
+ this.fromLink = params.fromLink || PerformanceCounterComponent.defaultFromLink;
+ });
+ this.route.params.subscribe((params: { type: string; id: string }) => {
+ this.serviceId = params.id;
+ this.serviceType = params.type;
+ });
}
-
}
import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import {
- PerformanceCounterService
-} from '../../../shared/api/performance-counter.service';
+import { PerformanceCounterService } from '../../../shared/api/performance-counter.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
/**
styleUrls: ['./table-performance-counter.component.scss']
})
export class TablePerformanceCounterComponent implements OnInit {
-
columns: Array<CdTableColumn> = [];
counters: Array<object> = [];
*/
@Input() serviceId: string;
- constructor(private performanceCounterService: PerformanceCounterService) { }
+ constructor(private performanceCounterService: PerformanceCounterService) {}
ngOnInit() {
this.columns = [
}
getCounters() {
- this.performanceCounterService.get(this.serviceType, this.serviceId)
+ this.performanceCounterService
+ .get(this.serviceType, this.serviceId)
.subscribe((resp: object[]) => {
this.counters = resp;
});
import { PoolListComponent } from './pool-list/pool-list.component';
@NgModule({
- imports: [
- CommonModule,
- TabsModule,
- SharedModule,
- ServicesModule
- ],
- exports: [
- PoolListComponent
- ],
- declarations: [
- PoolListComponent
- ]
+ imports: [CommonModule, TabsModule, SharedModule, ServicesModule],
+ exports: [PoolListComponent],
+ declarations: [PoolListComponent]
})
-export class PoolModule { }
+export class PoolModule {}
declarations: [LoginComponent, LogoutComponent, UserListComponent, UserFormComponent],
exports: [LogoutComponent]
})
-export class AuthModule { }
+export class AuthModule {}
outline-color: $color-password-toggle-focus;
}
- .checkbox-primary input[type="checkbox"]:checked + label::before,
- .checkbox-primary input[type="radio"]:checked + label::before {
+ .checkbox-primary input[type='checkbox']:checked + label::before,
+ .checkbox-primary input[type='radio']:checked + label::before {
background-color: $color-login-checkbox-bg;
border-color: $color-login-checkbox-border;
}
{ path: 'users', component: FakeComponent }
];
- configureTestBed({
- imports: [
- [RouterTestingModule.withRoutes(routes)],
- HttpClientTestingModule,
- ReactiveFormsModule,
- RouterTestingModule,
- ComponentsModule,
- ToastModule.forRoot(),
- SharedModule
- ],
- declarations: [UserFormComponent, FakeComponent]
- }, true);
+ configureTestBed(
+ {
+ imports: [
+ [RouterTestingModule.withRoutes(routes)],
+ HttpClientTestingModule,
+ ReactiveFormsModule,
+ RouterTestingModule,
+ ComponentsModule,
+ ToastModule.forRoot(),
+ SharedModule
+ ],
+ declarations: [UserFormComponent, FakeComponent]
+ },
+ true
+ );
beforeEach(() => {
fixture = TestBed.createComponent(UserFormComponent);
float: none;
}
- .navbar-brand,.navbar-brand:hover{
+ .navbar-brand,
+ .navbar-brand:hover {
color: $color-navbar-brand;
height: auto;
margin: 15px 0 15px 20px;
align-self: flex-start;
}
- .navbar-brand>img {
+ .navbar-brand > img {
height: 25px;
}
});
}
- removeAll () {
+ removeAll() {
this.notificationService.removeAll();
}
}
font-size: -webkit-xxx-large;
}
-*{
+* {
font-family: monospace;
}
-img{
+img {
width: 50vw;
}
providedIn: ApiModule
})
export class HostService {
-
- constructor(private http: HttpClient) {
- }
+ constructor(private http: HttpClient) {}
list() {
- return this.http.get('api/host').toPromise().then((resp: any) => {
- return resp;
- });
+ return this.http
+ .get('api/host')
+ .toPromise()
+ .then((resp: any) => {
+ return resp;
+ });
}
}
const req = httpTesting.expectOne('api/role');
expect(req.request.method).toBe('GET');
});
-
});
providedIn: ApiModule
})
export class TcmuIscsiService {
-
- constructor(private http: HttpClient) {
- }
+ constructor(private http: HttpClient) {}
tcmuiscsi() {
- return this.http.get('api/tcmuiscsi').toPromise().then((resp: any) => {
- return resp;
- });
+ return this.http
+ .get('api/tcmuiscsi')
+ .toPromise()
+ .then((resp: any) => {
+ return resp;
+ });
}
}
const req = httpTesting.expectOne('api/user');
expect(req.request.method).toBe('GET');
});
-
});
styleUrls: ['./helper.component.scss']
})
export class HelperComponent {
-
@Input() html: any;
- constructor() { }
-
+ constructor() {}
}
templateUrl: './loading-panel.component.html',
styleUrls: ['./loading-panel.component.scss']
})
-export class LoadingPanelComponent {
-}
+export class LoadingPanelComponent {}
@import '../../../../defaults';
.select-menu-edit {
- margin-left: -20px
+ margin-left: -20px;
}
.select-menu-item {
display: block;
it('should add item', () => {
component.options = [
- {name: 'option1', description: '', selected: false},
- {name: 'option2', description: '', selected: false}
+ { name: 'option1', description: '', selected: false },
+ { name: 'option2', description: '', selected: false }
];
component.data = [];
component.selectOption(component.options[1]);
it('should update selected', () => {
component.options = [
- {name: 'option1', description: '', selected: false},
- {name: 'option2', description: '', selected: false}
+ { name: 'option1', description: '', selected: false },
+ { name: 'option2', description: '', selected: false }
];
component.data = ['option2'];
component.ngOnChanges();
it('should remove item', () => {
component.options = [
- {name: 'option1', description: '', selected: true},
- {name: 'option2', description: '', selected: true}
+ { name: 'option1', description: '', selected: true },
+ { name: 'option2', description: '', selected: true }
];
component.data = ['option1', 'option2'];
component.removeItem('option1');
expect(component.data).toEqual(['option2']);
});
-
});
ngOnInit() {
const getStyleTop = (tooltip, positionY) => {
- return (tooltip.caretY - tooltip.height - tooltip.yPadding - 5) + 'px';
+ return tooltip.caretY - tooltip.height - tooltip.yPadding - 5 + 'px';
};
const getStyleLeft = (tooltip, positionX) => {
borderColor: this.colors[0].pointBorderColor
};
- this.options.tooltips.custom = tooltip => {
+ this.options.tooltips.custom = (tooltip) => {
chartTooltip.customTooltips(tooltip);
};
}
if (_.has(this.form.errors, 'cdSubmitButton')) {
this.loading = false;
_.unset(this.form.errors, 'cdSubmitButton');
- // Handle Reactive forms.
+ // Handle Reactive forms.
if (this.form instanceof AbstractControl) {
(<AbstractControl>this.form).updateValueAndValidity();
}
}
focusButton() {
- this.elRef.nativeElement.offsetParent.querySelector(
- `button[type="${this.type}"]`
- ).focus();
+ this.elRef.nativeElement.offsetParent.querySelector(`button[type="${this.type}"]`).focus();
}
focusInvalid() {
constructor() {}
ngOnChanges() {
- this.usedPercentage = Math.round(this.usedBytes / this.totalBytes * 100);
+ this.usedPercentage = Math.round((this.usedBytes / this.totalBytes) * 100);
this.freePercentage = 100 - this.usedPercentage;
this.freeBytes = this.totalBytes - this.usedBytes;
}
ComponentsModule,
RouterModule
],
- declarations: [
- TableComponent,
- TableKeyValueComponent
- ],
- exports: [
- TableComponent,
- NgxDatatableModule,
- TableKeyValueComponent
- ]
+ declarations: [TableComponent, TableKeyValueComponent],
+ exports: [TableComponent, NgxDatatableModule, TableKeyValueComponent]
})
-export class DataTableModule { }
+export class DataTableModule {}
th.oadatatablecheckbox {
width: 16px;
}
- .dataTables_length>input {
+ .dataTables_length > input {
line-height: 25px;
text-align: right;
}
}
::ng-deep .oadatatable {
- border:1px solid $color-table-header-border;
+ border: 1px solid $color-table-header-border;
margin-bottom: 0;
max-width: none !important;
.progress-linear {
overflow: hidden;
background-color: $color-table-active-row;
}
- .bar:before{
+ .bar:before {
display: block;
position: absolute;
- content: "";
+ content: '';
left: -200px;
width: 200px;
height: 100%;
.datatable-header {
background-clip: padding-box;
background-color: $color-table-datatable-header;
- background-image: -webkit-linear-gradient(top,$color-table-gradient-1 0,$color-table-gradient-2 100%);
- background-image: -o-linear-gradient(top,$color-table-gradient-1 0,$color-table-gradient-2 100%);
- background-image: linear-gradient(to bottom,$color-table-gradient-1 0,$color-table-gradient-2 100%);
+ background-image: -webkit-linear-gradient(
+ top,
+ $color-table-gradient-1 0,
+ $color-table-gradient-2 100%
+ );
+ background-image: -o-linear-gradient(
+ top,
+ $color-table-gradient-1 0,
+ $color-table-gradient-2 100%
+ );
+ background-image: linear-gradient(
+ to bottom,
+ $color-table-gradient-1 0,
+ $color-table-gradient-2 100%
+ );
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa', endColorstr='#ffededed', GradientType=0);
- .sort-asc, .sort-desc {
+ .sort-asc,
+ .sort-desc {
color: $color-table-sort;
}
- .datatable-header-cell{
+ .datatable-header-cell {
@include table-cell;
text-align: left;
font-weight: bold;
}
&.sortable {
.datatable-header-cell-label:after {
- content: " \f0dc";
+ content: ' \f0dc';
}
&.sort-active {
&.sort-asc .datatable-header-cell-label:after {
- content: " \f160";
+ content: ' \f160';
}
&.sort-desc .datatable-header-cell-label:after {
- content: " \f161";
+ content: ' \f161';
}
}
}
}
.datatable-body-row {
&.clickable:hover .datatable-row-group {
- background-color: $color-table-hover-row ;
+ background-color: $color-table-hover-row;
transition-property: background;
- transition-duration: .3s;
+ transition-duration: 0.3s;
transition-timing-function: linear;
}
&.datatable-row-even {
&.datatable-row-odd {
background-color: $color-table-odd-row-bg;
}
- &.active, &.active:hover {
+ &.active,
+ &.active:hover {
background-color: $color-table-active-row-hover;
}
- .datatable-body-cell{
+ .datatable-body-cell {
@include table-cell;
&:first-child {
border-left: none;
}
}
.datatable-footer {
- .selected-count, .page-count {
+ .selected-count,
+ .page-count {
font-style: italic;
padding-left: 5px;
}
/** Add space between buttons */
margin-left: 3px;
}
- & li > a, & li > span {
+ & li > a,
+ & li > span {
border-radius: 3px;
}
.pages {
- & > a, & > span {
+ & > a,
+ & > span {
display: inline-block;
padding: 5px 10px;
margin-bottom: 5px;
}
@keyframes progress-loading {
- from {
- left: -200px;
- width: 15%;
- }
- 50% {
- width: 30%;
- }
- 70% {
- width: 70%;
- }
- 80% {
- left: 50%;
- }
- 95% {
- left: 120%;
- }
- to {
- left: 100%;
- }
+ from {
+ left: -200px;
+ width: 15%;
+ }
+ 50% {
+ width: 30%;
+ }
+ 70% {
+ width: 70%;
+ }
+ 80% {
+ left: 50%;
+ }
+ 95% {
+ left: 120%;
+ }
+ to {
+ left: 100%;
+ }
}
selector: '[autofocus]' // tslint:disable-line
})
export class AutofocusDirective implements OnInit {
-
constructor(private elementRef: ElementRef) {}
ngOnInit() {
selector: '[cdCopy2ClipboardButton]'
})
export class Copy2ClipboardButtonDirective implements OnInit {
-
@Input('cdCopy2ClipboardButton') private cdCopy2ClipboardButton: string;
- constructor(private elementRef: ElementRef,
- private renderer: Renderer2,
- private toastr: ToastsManager) {}
+ constructor(
+ private elementRef: ElementRef,
+ private renderer: Renderer2,
+ private toastr: ToastsManager
+ ) {}
ngOnInit() {
const iElement = this.renderer.createElement('i');
selector: '[cdDimlessBinary]'
})
export class DimlessBinaryDirective implements OnInit {
-
@Output() ngModelChange: EventEmitter<any> = new EventEmitter();
/**
private el: HTMLInputElement;
- constructor(private elementRef: ElementRef,
- private control: NgControl,
- private dimlessBinaryPipe: DimlessBinaryPipe,
- private formatter: FormatterService) {
+ constructor(
+ private elementRef: ElementRef,
+ private control: NgControl,
+ private dimlessBinaryPipe: DimlessBinaryPipe,
+ private formatter: FormatterService
+ ) {
this.el = this.elementRef.nativeElement;
}
onBlur(value) {
this.setValue(value);
}
-
}
name: 'empty'
})
export class EmptyPipe implements PipeTransform {
-
transform(value: any, args?: any): any {
return _.isUndefined(value) || _.isNull(value) ? '-' : value;
}
-
}
// http://www.virtsync.com/c-error-codes-include-errno
export enum UnixErrno {
- EEXIST = 17, // File exists
+ EEXIST = 17 // File exists
}
});
it('should throw an error if element could be found', () => {
- expect(() => form.get('d')).toThrowError('Control \'d\' could not be found!');
- expect(() => form.get('sth')).toThrowError('Control \'sth\' could not be found!');
+ expect(() => form.get('d')).toThrowError(`Control 'd' could not be found!`);
+ expect(() => form.get('sth')).toThrowError(`Control 'sth' could not be found!`);
});
});
});
it('should nested throw an error if control could not be found', () => {
- expect(() => form.get('d')).toThrowError('Control \'d\' could not be found!');
- expect(() => form.getValue('sth')).toThrowError('Control \'sth\' could not be found!');
+ expect(() => form.get('d')).toThrowError(`Control 'd' could not be found!`);
+ expect(() => form.getValue('sth')).toThrowError(`Control 'sth' could not be found!`);
});
});
* @param {Function} condition
* @param {ValidatorFn[]} validators
*/
- static validateIf(
- formControl: AbstractControl,
- condition: Function,
- validators: ValidatorFn[]
- ) {
- formControl.setValidators((control: AbstractControl): {
- [key: string]: any;
- } => {
- const value = condition.call(this);
- if (value) {
- return Validators.compose(validators)(control);
+ static validateIf(formControl: AbstractControl, condition: Function, validators: ValidatorFn[]) {
+ formControl.setValidators(
+ (
+ control: AbstractControl
+ ): {
+ [key: string]: any;
+ } => {
+ const value = condition.call(this);
+ if (value) {
+ return Validators.compose(validators)(control);
+ }
+ return null;
}
- return null;
- });
+ );
}
/**
export class CdTableFetchDataContext {
errorConfig = {
- resetData: true, // Force data table to show no data
+ resetData: true, // Force data table to show no data
displayError: true // Show an error panel above the data table
};
name: 'cdDate'
})
export class CdDatePipe implements PipeTransform {
-
- constructor(private datePipe: DatePipe) {
- }
+ constructor(private datePipe: DatePipe) {}
transform(value: any, args?: any): any {
if (value === null || value === '') {
return '';
}
- return this.datePipe.transform(value, 'shortDate') + ' ' +
- this.datePipe.transform(value, 'mediumTime');
+ return (
+ this.datePipe.transform(value, 'shortDate') +
+ ' ' +
+ this.datePipe.transform(value, 'mediumTime')
+ );
}
-
}
});
it('transforms with wrong version format', () => {
- const value =
- 'foo';
+ const value = 'foo';
expect(pipe.transform(value)).toBe('foo');
});
});
constructor(private formatter: FormatterService) {}
transform(value: any, args?: any): any {
- return this.formatter.format_number(value, 1000, [
- '',
- 'k',
- 'M',
- 'G',
- 'T',
- 'P',
- 'E',
- 'Z',
- 'Y'
- ]);
+ return this.formatter.format_number(value, 1000, ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']);
}
}
})
export class FilterPipe implements PipeTransform {
transform(value: any, args?: any): any {
- return value.filter(row => {
+ return value.filter((row) => {
let result = true;
- args.forEach(filter => {
+ args.forEach((filter) => {
if (!filter.value) {
return;
}
});
it('transforms "in 7 days"', () => {
- const value = moment().add(7, 'days').unix();
+ const value = moment()
+ .add(7, 'days')
+ .unix();
expect(pipe.transform(value)).toBe('in 7 days');
});
it('transforms "7 days ago"', () => {
- const value = moment().subtract(7, 'days').unix();
+ const value = moment()
+ .subtract(7, 'days')
+ .unix();
expect(pipe.transform(value)).toBe('7 days ago');
});
});
providedIn: ServicesModule
})
export class AuthGuardService implements CanActivate {
-
- constructor(private router: Router, private authStorageService: AuthStorageService) {
- }
+ constructor(private router: Router, private authStorageService: AuthStorageService) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (this.authStorageService.isLoggedIn()) {
return '-';
}
let unit = n < 1 ? 0 : Math.floor(Math.log(n) / Math.log(divisor));
- unit = (unit >= units.length) ? units.length - 1 : unit;
+ unit = unit >= units.length ? units.length - 1 : unit;
let result = _.round(n / Math.pow(divisor, unit), decimals).toString();
if (result === '') {
return '-';
@Injectable()
export class JsErrorHandler implements ErrorHandler {
-
- constructor(private injector: Injector) { }
+ constructor(private injector: Injector) {}
handleError(error) {
const loggingService = this.injector.get(LoggingService);
loggingService.jsError(url, message, stack).subscribe();
throw error;
}
-
}
});
it('should call getCurrentSummary', () => {
- expect(summaryService.getCurrentSummary ()).toEqual(summary);
+ expect(summaryService.getCurrentSummary()).toEqual(summary);
});
it('should call subscribe', () => {
image_name: 'someImage'
})
);
- const result = summaryService.getCurrentSummary ();
+ const result = summaryService.getCurrentSummary();
expect(result.executing_tasks.length).toBe(1);
expect(result.executing_tasks[0]).toEqual({
metadata: { image_name: 'someImage', pool_name: 'somePool' },
* @returns {object}
* @memberof SummaryService
*/
- getCurrentSummary () {
+ getCurrentSummary() {
return this.summaryDataSource.getValue();
}
image_name: 'someImage'
};
const message = service.getRunningMessage(finishedTask);
- expect(message).toBe('Creating RBD \'somePool/someImage\'');
+ expect(message).toBe(`Creating RBD 'somePool/someImage'`);
});
it('should getErrorMessage', () => {
ApiModule,
AutofocusDirective
],
- providers: [
- AuthStorageService,
- AuthGuardService,
- FormatterService
- ]
+ providers: [AuthStorageService, AuthGuardService, FormatterService]
})
export class SharedModule {}
$color-green: #71843f;
$color-darker-blue: #2172bf;
-$color-dark-blue: #2582D9;
+$color-dark-blue: #2582d9;
$color-blue: #288cea;
$color-light-blue: #d9edf7;
$color-sky-blue: #afd9ee;
$color-white-gray: #eee;
$color-off-white: #f5f5f5;
$color-solid-white: #ffffff;
-$color-transparent: rgba(0,0,0,.09);
+$color-transparent: rgba(0, 0, 0, 0.09);
$color-app-bg: $color-solid-white;
$color-bg-darken: $color-dark-gray;
const mock = () => {
let storage = {};
return {
- getItem: key => key in storage ? storage[key] : null,
- setItem: (key, value) => storage[key] = value || '',
- removeItem: key => delete storage[key],
- clear: () => storage = {},
+ getItem: (key) => (key in storage ? storage[key] : null),
+ setItem: (key, value) => (storage[key] = value || ''),
+ removeItem: (key) => delete storage[key],
+ clear: () => (storage = {})
};
};
-Object.defineProperty(window, 'localStorage', {value: mock()});
-Object.defineProperty(window, 'sessionStorage', {value: mock()});
+Object.defineProperty(window, 'localStorage', { value: mock() });
+Object.defineProperty(window, 'sessionStorage', { value: mock() });
Object.defineProperty(window, 'getComputedStyle', {
value: () => ['-webkit-appearance']
});
enableProdMode();
}
-platformBrowserDynamic().bootstrapModule(AppModule)
- .catch(err => console.log(err));
+platformBrowserDynamic()
+ .bootstrapModule(AppModule)
+ .catch((err) => console.log(err));
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
-import 'zone.js/dist/zone'; // Included with Angular CLI.
+import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
/* You can add global styles to this file, and also import other style files */
@import 'defaults';
-$fa-font-path: "../node_modules/fork-awesome/fonts";
-@import "../node_modules/fork-awesome/scss/fork-awesome";
+$fa-font-path: '../node_modules/fork-awesome/fonts';
+@import '../node_modules/fork-awesome/scss/fork-awesome';
$font_family_1: 'ForkAwesome';
/* Basics */
cursor: pointer;
}
a:hover,
-a:focus{
- color: $color-links-focus
+a:focus {
+ color: $color-links-focus;
}
h1 {
letter-spacing: -1px;
letter-spacing: -1px;
font-size: 1.833em;
}
-h3{
+h3 {
display: block;
font-size: 1.583em;
font-weight: 400;
}
-h4{
+h4 {
font-size: 1.5em;
- line-height: normal
+ line-height: normal;
}
option {
font-weight: normal;
left: 50%;
}
.margin-right-md {
- margin-right: 15px
+ margin-right: 15px;
}
.no-border {
border: 0px;
background-color: transparent;
border-radius: 0;
}
-.breadcrumb>li+li:before {
+.breadcrumb > li + li:before {
padding: 0 5px 0 7px;
color: $color-breadcrumb;
- font-family: "ForkAwesome";
- content: "\f101";
+ font-family: 'ForkAwesome';
+ content: '\f101';
}
-.breadcrumb>li>span {
+.breadcrumb > li > span {
color: $color-breadcrumb;
}
/* Buttons */
.btn-primary .caret {
color: $color-button-caret;
}
-.btn-group>.btn>i.fa,
-button.btn.btn-label>i.fa {
+.btn-group > .btn > i.fa,
+button.btn.btn-label > i.fa {
/** Add space between icon and text */
padding-right: 5px;
}
.dropdown-menu {
min-width: 50px;
}
-.dropdown-menu>li>a {
+.dropdown-menu > li > a {
color: $color-dropdown-menu;
cursor: pointer;
}
-.dropdown-menu>li>a>i.fa {
+.dropdown-menu > li > a > i.fa {
/** Add space between icon and text */
padding-right: 5px;
}
-.dropdown-menu>.active>a {
+.dropdown-menu > .active > a {
color: $color-dropdown-active-text;
background-color: $color-dropdown-active-bg;
}
-.dataTables_wrapper .dropdown-menu>li.divider {
+.dataTables_wrapper .dropdown-menu > li.divider {
cursor: auto;
}
margin-left: -30px;
margin-right: -30px;
}
-.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9,
-.col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9,
-.col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9,
-.col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
+.col-lg-1,
+.col-lg-10,
+.col-lg-11,
+.col-lg-12,
+.col-lg-2,
+.col-lg-3,
+.col-lg-4,
+.col-lg-5,
+.col-lg-6,
+.col-lg-7,
+.col-lg-8,
+.col-lg-9,
+.col-md-1,
+.col-md-10,
+.col-md-11,
+.col-md-12,
+.col-md-2,
+.col-md-3,
+.col-md-4,
+.col-md-5,
+.col-md-6,
+.col-md-7,
+.col-md-8,
+.col-md-9,
+.col-sm-1,
+.col-sm-10,
+.col-sm-11,
+.col-sm-12,
+.col-sm-2,
+.col-sm-3,
+.col-sm-4,
+.col-sm-5,
+.col-sm-6,
+.col-sm-7,
+.col-sm-8,
+.col-sm-9,
+.col-xs-1,
+.col-xs-10,
+.col-xs-11,
+.col-xs-12,
+.col-xs-2,
+.col-xs-3,
+.col-xs-4,
+.col-xs-5,
+.col-xs-6,
+.col-xs-7,
+.col-xs-8,
+.col-xs-9 {
padding-left: 30px;
padding-right: 30px;
}
.clickable {
cursor: pointer;
}
-.has-error .has-error-btn, .has-error .has-error-btn:disabled:hover {
+.has-error .has-error-btn,
+.has-error .has-error-btn:disabled:hover {
background-color: $color-error-btn-bg;
border-color: $color-error-btn-border;
}
color: $color-required-text;
}
/* Forms */
-.form-group>.control-label>span.required {
+.form-group > .control-label > span.required {
@extend .fa;
@extend .fa-asterisk;
@extend .required;
margin-left: 5px;
}
.margin-right-sm {
- margin-right: 10px
+ margin-right: 10px;
}
.nav-tabs {
margin-bottom: 15px;