Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/models/upgrade.interface.ts | export interface UpgradeInfoInterface {
image: string;
registry: string;
versions: string[];
}
| 101 | 16 | 39 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/models/wizard-steps.ts | export interface WizardStepModel {
stepIndex: number;
isComplete: boolean;
}
| 81 | 15.4 | 34 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/array.pipe.spec.ts | import { ArrayPipe } from './array.pipe';
describe('ArrayPipe', () => {
const pipe = new ArrayPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms string to array', () => {
expect(pipe.transform('foo')).toStrictEqual(['foo']);
});
it('transforms array to array',... | 523 | 22.818182 | 67 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/array.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
/**
* Convert the given value to an array.
*/
@Pipe({
name: 'array'
})
export class ArrayPipe implements PipeTransform {
/**
* Convert the given value into an array. If the value is already an
* array, then nothing happens, excep... | 688 | 24.518519 | 71 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts | import { BooleanTextPipe } from './boolean-text.pipe';
describe('BooleanTextPipe', () => {
let pipe: BooleanTextPipe;
beforeEach(() => {
pipe = new BooleanTextPipe();
});
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms true', () => {
expect(pipe.transform(true)... | 835 | 21 | 63 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'booleanText'
})
export class BooleanTextPipe implements PipeTransform {
transform(
value: any,
truthyText: string = $localize`Yes`,
falsyText: string = $localize`No`
): string {
return Boolean(value) ? truthyText : falsyText;
}... | 323 | 20.6 | 55 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean.pipe.spec.ts | import { BooleanPipe } from './boolean.pipe';
describe('BooleanPipe', () => {
const pipe = new BooleanPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms to false [1/4]', () => {
expect(pipe.transform('n')).toBe(false);
});
it('transforms to false [2/4]', () =>... | 1,309 | 21.586207 | 46 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
/**
* Convert the given value to a boolean value.
*/
@Pipe({
name: 'boolean'
})
export class BooleanPipe implements PipeTransform {
transform(value: any): boolean {
let result = false;
switch (value) {
case true:
case 1:
case 'y':
... | 472 | 16.518519 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.spec.ts | import { DatePipe } from '@angular/common';
import moment from 'moment';
import { CdDatePipe } from './cd-date.pipe';
describe('CdDatePipe', () => {
const datePipe = new DatePipe('en-US');
let pipe = new CdDatePipe(datePipe);
it('create an instance', () => {
pipe = new CdDatePipe(datePipe);
expect(pip... | 604 | 23.2 | 62 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts | import { DatePipe } from '@angular/common';
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'cdDate'
})
export class CdDatePipe implements PipeTransform {
constructor(private datePipe: DatePipe) {}
transform(value: any): any {
if (value === null || value === '') {
return '';
}
... | 460 | 20.952381 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-release-name.pipe.spec.ts | import { CephReleaseNamePipe } from './ceph-release-name.pipe';
describe('CephReleaseNamePipe', () => {
const pipe = new CephReleaseNamePipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('recognizes a stable release', () => {
const value =
'ceph version 13.2.1 \
(... | 823 | 27.413793 | 67 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-release-name.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'cephReleaseName'
})
export class CephReleaseNamePipe implements PipeTransform {
transform(value: any): any {
// Expect "ceph version 13.1.0-419-g251e2515b5
// (251e2515b563856349498c6caf34e7a282f62937) nautilus (dev)"
const res... | 679 | 26.2 | 81 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-short-version.pipe.spec.ts | import { CephShortVersionPipe } from './ceph-short-version.pipe';
describe('CephShortVersionPipe', () => {
const pipe = new CephShortVersionPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms with correct version format', () => {
const value =
'ceph version 13... | 618 | 27.136364 | 66 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ceph-short-version.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'cephShortVersion'
})
export class CephShortVersionPipe implements PipeTransform {
transform(value: any): any {
// Expect "ceph version 1.2.3-g9asdasd (as98d7a0s8d7)"
const result = /ceph version\s+([^ ]+)\s+\(.+\)/.exec(value);
if (res... | 482 | 24.421053 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary-per-second.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import { FormatterService } from '../services/formatter.service';
@Pipe({
name: 'dimlessBinaryPerSecond'
})
export class DimlessBinaryPerSecondPipe implements PipeTransform {
constructor(private formatter: FormatterService) {}
transform(value: any): any {
... | 519 | 19.8 | 66 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary.pipe.spec.ts | import { FormatterService } from '../services/formatter.service';
import { DimlessBinaryPipe } from './dimless-binary.pipe';
describe('DimlessBinaryPipe', () => {
const formatterService = new FormatterService();
const pipe = new DimlessBinaryPipe(formatterService);
it('create an instance', () => {
expect(pi... | 1,489 | 25.140351 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless-binary.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import { FormatterService } from '../services/formatter.service';
@Pipe({
name: 'dimlessBinary'
})
export class DimlessBinaryPipe implements PipeTransform {
constructor(private formatter: FormatterService) {}
transform(value: any): any {
return this.form... | 483 | 18.36 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.spec.ts | import { FormatterService } from '../services/formatter.service';
import { DimlessPipe } from './dimless.pipe';
describe('DimlessPipe', () => {
const formatterService = new FormatterService();
const pipe = new DimlessPipe(formatterService);
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
... | 1,446 | 24.385965 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import { FormatterService } from '../services/formatter.service';
@Pipe({
name: 'dimless'
})
export class DimlessPipe implements PipeTransform {
constructor(private formatter: FormatterService) {}
transform(value: any): any {
return this.formatter.format... | 394 | 25.333333 | 99 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/duration.pipe.spec.ts | import { DurationPipe } from './duration.pipe';
describe('DurationPipe', () => {
const pipe = new DurationPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms seconds into a human readable duration', () => {
expect(pipe.transform(0)).toBe('');
expect(pipe.transfo... | 517 | 27.777778 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/duration.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'duration',
pure: false
})
export class DurationPipe implements PipeTransform {
/**
* Translates seconds into human readable format of seconds, minutes, hours, days, and years
* source: https://stackoverflow.com/a/34270811
*
* @param ... | 1,243 | 29.341463 | 96 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.spec.ts | import { EmptyPipe } from './empty.pipe';
describe('EmptyPipe', () => {
const pipe = new EmptyPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms with empty value', () => {
expect(pipe.transform(undefined)).toBe('-');
});
it('transforms with some value', () => ... | 404 | 20.315789 | 48 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'empty'
})
export class EmptyPipe implements PipeTransform {
transform(value: any): any {
if (_.isUndefined(value) || _.isNull(value)) {
return '-';
} else if (_.isNaN(value)) {
return 'N/A';
}
r... | 339 | 17.888889 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/encode-uri.pipe.spec.ts | import { EncodeUriPipe } from './encode-uri.pipe';
describe('EncodeUriPipe', () => {
it('create an instance', () => {
const pipe = new EncodeUriPipe();
expect(pipe).toBeTruthy();
});
it('should transforms the value', () => {
const pipe = new EncodeUriPipe();
expect(pipe.transform('rbd/name')).to... | 348 | 23.928571 | 58 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/encode-uri.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'encodeUri'
})
export class EncodeUriPipe implements PipeTransform {
transform(value: any): any {
return encodeURIComponent(value);
}
}
| 214 | 18.545455 | 53 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.spec.ts | import { FilterPipe } from './filter.pipe';
describe('FilterPipe', () => {
const pipe = new FilterPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('filter words with "foo"', () => {
const value = ['foo', 'bar', 'foobar'];
const filters = [
{
value: 'foo',
... | 1,282 | 22.327273 | 77 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(value: any, args?: any): any {
return value.filter((row: any) => {
let result = true;
args.forEach((filter: any): boolean | void => {
if (!filter.valu... | 534 | 19.576923 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.spec.ts | import { CssHelper } from '~/app/shared/classes/css-helper';
import { HealthColorPipe } from '~/app/shared/pipes/health-color.pipe';
class CssHelperStub extends CssHelper {
propertyValue(propertyName: string) {
if (propertyName === 'health-color-healthy') {
return 'fakeGreen';
}
if (propertyName ==... | 1,131 | 22.583333 | 71 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import { CssHelper } from '~/app/shared/classes/css-helper';
import { HealthColor } from '~/app/shared/enum/health-color.enum';
@Pipe({
name: 'healthColor'
})
export class HealthColorPipe implements PipeTransform {
constructor(private cssHelper: CssHelper) {}
... | 506 | 27.166667 | 67 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-icon.pipe.spec.ts | import { HealthIconPipe } from './health-icon.pipe';
describe('HealthIconPipe', () => {
const pipe = new HealthIconPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "HEALTH_OK"', () => {
expect(pipe.transform('HEALTH_OK')).toEqual('fa fa-check-circle');
});
it... | 573 | 26.333333 | 80 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-icon.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import { HealthIcon } from '../enum/health-icon.enum';
@Pipe({
name: 'healthIcon'
})
export class HealthIconPipe implements PipeTransform {
transform(value: string): string {
return Object.keys(HealthIcon).includes(value as HealthIcon) ? HealthIcon[value] :... | 331 | 24.538462 | 90 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-label.pipe.spec.ts | import { HealthLabelPipe } from './health-label.pipe';
describe('HealthLabelPipe', () => {
const pipe = new HealthLabelPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "HEALTH_OK"', () => {
expect(pipe.transform('HEALTH_OK')).toEqual('ok');
});
it('transforms... | 610 | 23.44 | 61 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-label.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import { HealthLabel } from '~/app/shared/enum/health-label.enum';
@Pipe({
name: 'healthLabel'
})
export class HealthLabelPipe implements PipeTransform {
transform(value: any): any {
return Object.keys(HealthLabel).includes(value as HealthLabel) ? HealthLab... | 344 | 25.538462 | 95 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iops.pipe.spec.ts | import { IopsPipe } from './iops.pipe';
describe('IopsPipe', () => {
it('create an instance', () => {
const pipe = new IopsPipe();
expect(pipe).toBeTruthy();
});
});
| 179 | 19 | 39 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iops.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'iops'
})
export class IopsPipe implements PipeTransform {
transform(value: any): any {
return `${value} IOPS`;
}
}
| 194 | 16.727273 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.spec.ts | import { IscsiBackstorePipe } from './iscsi-backstore.pipe';
describe('IscsiBackstorePipe', () => {
const pipe = new IscsiBackstorePipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "user:rbd"', () => {
expect(pipe.transform('user:rbd')).toBe('user:rbd (tcmu-runner... | 428 | 22.833333 | 70 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'iscsiBackstore'
})
export class IscsiBackstorePipe implements PipeTransform {
transform(value: any): any {
switch (value) {
case 'user:rbd':
return 'user:rbd (tcmu-runner)';
default:
return value;
}
}
}
| 314 | 18.6875 | 58 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/join.pipe.spec.ts | import { JoinPipe } from './join.pipe';
describe('ListPipe', () => {
const pipe = new JoinPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "[1,2,3]"', () => {
expect(pipe.transform([1, 2, 3])).toBe('1, 2, 3');
});
});
| 277 | 18.857143 | 54 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/join.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'join'
})
export class JoinPipe implements PipeTransform {
transform(value: Array<any>): string {
return value.join(', ');
}
}
| 205 | 17.727273 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.spec.ts | import { LogPriorityPipe } from './log-priority.pipe';
describe('LogPriorityPipe', () => {
const pipe = new LogPriorityPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "INF"', () => {
const value = '[INF]';
const result = 'info';
expect(pipe.transform(val... | 753 | 21.848485 | 54 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'logPriority'
})
export class LogPriorityPipe implements PipeTransform {
transform(value: any): any {
if (value === '[DBG]') {
return 'debug';
} else if (value === '[INF]') {
return 'info';
} else if (value === '[WRN]') {
... | 448 | 20.380952 | 55 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts | import { MapPipe } from './map.pipe';
describe('MapPipe', () => {
const pipe = new MapPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('map value [1]', () => {
expect(pipe.transform('foo')).toBe('foo');
});
it('map value [2]', () => {
expect(pipe.transform('foo', { ... | 628 | 23.192308 | 86 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'map'
})
export class MapPipe implements PipeTransform {
transform(value: string | number, map?: object): any {
if (!_.isPlainObject(map)) {
return value;
}
return _.get(map, value, value);
}
}
| 311 | 18.5 | 56 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/mds-summary.pipe.spec.ts | import { TestBed } from '@angular/core/testing';
import { configureTestBed } from '~/testing/unit-test-helper';
import { MdsSummaryPipe } from './mds-summary.pipe';
describe('MdsSummaryPipe', () => {
let pipe: MdsSummaryPipe;
configureTestBed({
providers: [MdsSummaryPipe]
});
beforeEach(() => {
pipe... | 1,652 | 20.467532 | 78 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/mds-summary.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'mdsSummary'
})
export class MdsSummaryPipe implements PipeTransform {
transform(value: any): any {
if (!value) {
return {
success: 0,
info: 0,
total: 0
};
}
let activeCount ... | 1,190 | 20.267857 | 54 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/mgr-summary.pipe.spec.ts | import { TestBed } from '@angular/core/testing';
import { configureTestBed } from '~/testing/unit-test-helper';
import { MgrSummaryPipe } from './mgr-summary.pipe';
describe('MgrSummaryPipe', () => {
let pipe: MgrSummaryPipe;
configureTestBed({
providers: [MgrSummaryPipe]
});
beforeEach(() => {
pipe... | 865 | 21.205128 | 62 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/mgr-summary.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'mgrSummary'
})
export class MgrSummaryPipe implements PipeTransform {
transform(value: any): any {
if (!value) {
return {
success: 0,
info: 0,
total: 0
};
}
let activeCount:... | 858 | 21.605263 | 88 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/milliseconds.pipe.spec.ts | import { MillisecondsPipe } from './milliseconds.pipe';
describe('MillisecondsPipe', () => {
it('create an instance', () => {
const pipe = new MillisecondsPipe();
expect(pipe).toBeTruthy();
});
});
| 211 | 22.555556 | 55 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/milliseconds.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'milliseconds'
})
export class MillisecondsPipe implements PipeTransform {
transform(value: any): any {
return `${value} ms`;
}
}
| 208 | 18 | 56 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts | import { NotAvailablePipe } from './not-available.pipe';
describe('NotAvailablePipe', () => {
let pipe: NotAvailablePipe;
beforeEach(() => {
pipe = new NotAvailablePipe();
});
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms not available (1)', () => {
expect(pi... | 699 | 21.580645 | 58 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'notAvailable'
})
export class NotAvailablePipe implements PipeTransform {
transform(value: any, text?: string): any {
if (value === '') {
return _.defaultTo(text, $localize`n/a`);
}
return value;
}
}
| 318 | 18.9375 | 56 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ordinal.pipe.spec.ts | import { OrdinalPipe } from './ordinal.pipe';
describe('OrdinalPipe', () => {
it('create an instance', () => {
const pipe = new OrdinalPipe();
expect(pipe).toBeTruthy();
});
});
| 191 | 20.333333 | 45 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/ordinal.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'ordinal'
})
export class OrdinalPipe implements PipeTransform {
transform(value: any): any {
const num = parseInt(value, 10);
if (isNaN(num)) {
return value;
}
return (
value +
(Math.floor(num / 10) === 1
... | 476 | 17.346154 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/osd-summary.pipe.spec.ts | import { TestBed } from '@angular/core/testing';
import { configureTestBed } from '~/testing/unit-test-helper';
import { OsdSummaryPipe } from './osd-summary.pipe';
describe('OsdSummaryPipe', () => {
let pipe: OsdSummaryPipe;
configureTestBed({
providers: [OsdSummaryPipe]
});
beforeEach(() => {
pipe... | 969 | 21.045455 | 70 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/osd-summary.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'osdSummary'
})
export class OsdSummaryPipe implements PipeTransform {
transform(value: any): any {
if (!value) {
return '';
}
let inCount = 0;
let upCount = 0;
let nearFullCount = 0;
let full... | 943 | 19.085106 | 54 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts | import { CommonModule, DatePipe } from '@angular/common';
import { NgModule } from '@angular/core';
import { ArrayPipe } from './array.pipe';
import { BooleanTextPipe } from './boolean-text.pipe';
import { BooleanPipe } from './boolean.pipe';
import { CdDatePipe } from './cd-date.pipe';
import { CephReleaseNamePipe } ... | 3,962 | 26.143836 | 78 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/rbd-configuration-source.pipe.spec.ts | import { RbdConfigurationSourcePipe } from './rbd-configuration-source.pipe';
describe('RbdConfigurationSourcePipePipe', () => {
let pipe: RbdConfigurationSourcePipe;
beforeEach(() => {
pipe = new RbdConfigurationSourcePipe();
});
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
i... | 658 | 27.652174 | 77 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/rbd-configuration-source.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'rbdConfigurationSource'
})
export class RbdConfigurationSourcePipe implements PipeTransform {
transform(value: any): any {
const sourceMap = {
0: 'global',
1: 'pool',
2: 'image'
};
return sourceMap[value];
}
}
| 315 | 18.75 | 66 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.spec.ts | import moment from 'moment';
import { RelativeDatePipe } from './relative-date.pipe';
describe('RelativeDatePipe', () => {
const pipe = new RelativeDatePipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms date into a human readable relative time (1)', () => {
const ... | 1,445 | 31.133333 | 73 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
import moment from 'moment';
moment.updateLocale('en', {
relativeTime: {
future: $localize`in %s`,
past: $localize`%s ago`,
s: $localize`a few seconds`,
ss: $localize`%d seconds`,
m: $localize`a minute`,
mm: $locali... | 1,588 | 26.396552 | 73 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/round.pipe.spec.ts | import { RoundPipe } from './round.pipe';
describe('RoundPipe', () => {
const pipe = new RoundPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "1500"', () => {
expect(pipe.transform(1.52, 1)).toEqual(1.5);
});
});
| 273 | 18.571429 | 49 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/round.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'round'
})
export class RoundPipe implements PipeTransform {
transform(value: any, precision: number): any {
return _.round(value, precision);
}
}
| 250 | 18.307692 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/sanitize-html.pipe.spec.ts | import { TestBed } from '@angular/core/testing';
import { DomSanitizer } from '@angular/platform-browser';
import { SanitizeHtmlPipe } from '~/app/shared/pipes/sanitize-html.pipe';
import { configureTestBed } from '~/testing/unit-test-helper';
describe('SanitizeHtmlPipe', () => {
let pipe: SanitizeHtmlPipe;
let d... | 735 | 26.259259 | 73 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/sanitize-html.pipe.ts | import { Pipe, PipeTransform, SecurityContext } from '@angular/core';
import { DomSanitizer, SafeValue } from '@angular/platform-browser';
@Pipe({
name: 'sanitizeHtml'
})
export class SanitizeHtmlPipe implements PipeTransform {
constructor(private domSanitizer: DomSanitizer) {}
transform(value: SafeValue | stri... | 422 | 29.214286 | 69 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/search-highlight.pipe.spec.ts | import { TestBed } from '@angular/core/testing';
import { configureTestBed } from '~/testing/unit-test-helper';
import { SearchHighlightPipe } from './search-highlight.pipe';
describe('SearchHighlightPipe', () => {
let pipe: SearchHighlightPipe;
configureTestBed({
providers: [SearchHighlightPipe]
});
be... | 1,247 | 28.714286 | 88 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/search-highlight.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'searchHighlight'
})
export class SearchHighlightPipe implements PipeTransform {
transform(value: string, args: string): string {
if (!args) {
return value;
}
args = this.escapeRegExp(args);
const regex = new RegExp(args, 'gi'... | 604 | 21.407407 | 59 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/truncate.pipe.spec.ts | import { TruncatePipe } from './truncate.pipe';
describe('TruncatePipe', () => {
const pipe = new TruncatePipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('should truncate string (1)', () => {
expect(pipe.transform('fsdfdsfs asdasd', 5, '')).toEqual('fsdfd');
});
it('sh... | 544 | 23.772727 | 79 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/truncate.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'truncate'
})
export class TruncatePipe implements PipeTransform {
transform(value: any, length: number, omission?: string): any {
if (!_.isString(value)) {
return value;
}
omission = _.defaultTo(omission,... | 384 | 21.647059 | 65 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.spec.ts | import { UpperFirstPipe } from './upper-first.pipe';
describe('UpperFirstPipe', () => {
const pipe = new UpperFirstPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
it('transforms "foo"', () => {
expect(pipe.transform('foo')).toEqual('Foo');
});
it('transforms "BAR"', () =>... | 383 | 20.333333 | 52 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/upper-first.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
import _ from 'lodash';
@Pipe({
name: 'upperFirst'
})
export class UpperFirstPipe implements PipeTransform {
transform(value: string): string {
return _.upperFirst(value);
}
}
| 241 | 17.615385 | 54 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/rxjs/operators/page-visibilty.operator.ts | import { fromEvent, Observable, partition } from 'rxjs';
import { repeatWhen, shareReplay, takeUntil } from 'rxjs/operators';
export function whenPageVisible() {
const visibilitychange$ = fromEvent(document, 'visibilitychange').pipe(
shareReplay({ refCount: true, bufferSize: 1 })
);
const [pageVisible$, pag... | 573 | 26.333333 | 73 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts | import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
i... | 7,149 | 30.359649 | 201 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts | import {
HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest
} from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import _ from 'lodash';
import { Observable, throwError as observableThrowError } from 'rxjs';
import { catchEr... | 4,488 | 32.5 | 102 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.spec.ts | import { Component, NgZone } from '@angular/core';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, Routes } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { configureTestBed } from '~/testing/... | 1,828 | 32.254545 | 94 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts | import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
CanActivate,
CanActivateChild,
Router,
RouterStateSnapshot
} from '@angular/router';
import { AuthStorageService } from './auth-storage.service';
@Injectable({
providedIn: 'root'
})
export class AuthGuardService implements CanAct... | 837 | 26.933333 | 93 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.spec.ts | import { AuthStorageService } from './auth-storage.service';
describe('AuthStorageService', () => {
let service: AuthStorageService;
const username = 'foobar';
beforeEach(() => {
service = new AuthStorageService();
});
it('should be created', () => {
expect(service).toBeTruthy();
});
it('shoul... | 1,189 | 23.791667 | 70 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.ts | import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { Permissions } from '../models/permissions';
@Injectable({
providedIn: 'root'
})
export class AuthStorageService {
isPwdDisplayedSource = new BehaviorSubject(false);
isPwdDisplayed$ = this.isPwdDisplayedSource.asObserva... | 1,645 | 26.433333 | 96 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/cd-table-server-side.service.spec.ts | import { TestBed } from '@angular/core/testing';
import { CdTableServerSideService } from './cd-table-server-side.service';
describe('CdTableServerSideService', () => {
let service: CdTableServerSideService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CdTableServerSide... | 415 | 23.470588 | 74 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/cd-table-server-side.service.ts | import { HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class CdTableServerSideService {
/* tslint:disable:no-empty */
constructor() {}
static getCount(resp: HttpResponse<any>): number {
return Number(resp.headers?.get('X-... | 342 | 21.866667 | 54 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/change-password-guard.service.spec.ts | import { Component, NgZone } from '@angular/core';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, Routes } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { configureTestBed } from '~/testing/... | 2,666 | 37.652174 | 100 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/change-password-guard.service.ts | import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
CanActivate,
CanActivateChild,
Router,
RouterStateSnapshot
} from '@angular/router';
import { AuthStorageService } from './auth-storage.service';
/**
* This service guard checks if a user must be redirected to a special
* page at... | 1,351 | 30.44186 | 98 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/crud-form-adapter.service.spec.ts | import { TestBed } from '@angular/core/testing';
import { CrudFormAdapterService } from './crud-form-adapter.service';
import { RouterTestingModule } from '@angular/router/testing';
describe('CrudFormAdapterService', () => {
let service: CrudFormAdapterService;
beforeEach(() => {
TestBed.configureTestingModu... | 509 | 24.5 | 69 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/crud-form-adapter.service.ts | import { Injectable } from '@angular/core';
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import { CrudTaskInfo, JsonFormUISchema } from '../forms/crud-form/crud-form.model';
import { setupValidators } from '../forms/crud-form/helpers';
@Injectable({
providedIn: 'root'
})
export class CrudFormAdap... | 1,645 | 37.27907 | 84 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/data-gateway.service.spec.ts | /* tslint:disable:no-unused-variable */
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { inject, TestBed } from '@angular/core/testing';
import { DataGatewayService } from './data-gateway.service';
import { RouterTestingModule } from '@angular/router/testing';
describe('Service: DataG... | 639 | 29.47619 | 82 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/data-gateway.service.ts | import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { JsonFormUISchema } from '../forms/crud-form/crud-form.model';
import { CrudFormAdapterService } from './crud-form-adapter.service'... | 3,004 | 32.021978 | 97 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.spec.ts | import { TestBed } from '@angular/core/testing';
import moment from 'moment';
import { CdDevice } from '../models/devices';
import { DeviceService } from './device.service';
describe('DeviceService', () => {
let service: DeviceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = Tes... | 3,065 | 31.967742 | 87 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.ts | import { Injectable } from '@angular/core';
import moment from 'moment';
import { CdDevice } from '../models/devices';
@Injectable({
providedIn: 'root'
})
export class DeviceService {
/**
* Calculates additional data and appends them as new attributes to the given device.
*/
calculateAdditionalData(devic... | 1,730 | 28.844828 | 87 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.spec.ts | import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { Subscriber } from 'rxjs';
import { configureTestBed } from '~/testing/unit-test-helper';
import { SharedModule } from '../shared.module';
import { DocService } from './doc.service';
descr... | 2,091 | 26.526316 | 85 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/doc.service.ts | import { Injectable } from '@angular/core';
import { BehaviorSubject, Subscription } from 'rxjs';
import { filter, first, map } from 'rxjs/operators';
import { CephReleaseNamePipe } from '../pipes/ceph-release-name.pipe';
import { SummaryService } from './summary.service';
@Injectable({
providedIn: 'root'
})
expor... | 2,536 | 36.308824 | 105 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.spec.ts | import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { CssHelper } from '~/app/shared/classes/css-helper';
import { configureTestBed } from '~/testing/unit-test-helper';
import { FaviconService } from './favicon.service';
describe('FaviconServ... | 629 | 25.25 | 71 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.ts | import { DOCUMENT } from '@angular/common';
import { Inject, Injectable, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs';
import { CssHelper } from '~/app/shared/classes/css-helper';
import { HealthColor } from '~/app/shared/enum/health-color.enum';
import { SummaryService } from './summary.serv... | 2,233 | 26.925 | 79 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts | import { Component, NgZone } from '@angular/core';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ActivatedRouteSnapshot, Router, Routes } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { of as observableOf } from 'rxjs';
import { DashboardNot... | 2,369 | 31.465753 | 100 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.ts | import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, CanActivateChild } from '@angular/router';
import { map } from 'rxjs/operators';
import { DashboardNotFoundError } from '~/app/core/error/error';
import { FeatureTogglesMap, FeatureTogglesService } from './feature-toggles.servic... | 941 | 29.387097 | 88 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles.service.spec.ts | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { discardPeriodicTasks, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { configureTestBed } from '~/testing/unit-test-helper';
import { FeatureTogglesService } from './feature-toggles.service';
descr... | 1,507 | 26.418182 | 98 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles.service.ts | import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { TimerService } from './timer.service';
export class FeatureTogglesMap {
rbd = true;
mirroring = true;
iscsi = true;
cephfs = true;
rgw = true;
nfs = true;
dashboard... | 969 | 23.871795 | 77 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.spec.ts | import { configureTestBed } from '~/testing/unit-test-helper';
import { DimlessBinaryPipe } from '../pipes/dimless-binary.pipe';
import { DimlessPipe } from '../pipes/dimless.pipe';
import { FormatterService } from './formatter.service';
describe('FormatterService', () => {
let service: FormatterService;
let dimle... | 4,756 | 41.097345 | 98 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts | import { Injectable } from '@angular/core';
import _ from 'lodash';
@Injectable({
providedIn: 'root'
})
export class FormatterService {
format_number(n: any, divisor: number, units: string[], decimals: number = 1): string {
if (_.isString(n)) {
n = Number(n);
}
if (!_.isNumber(n)) {
return... | 3,695 | 28.806452 | 100 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts | import { ErrorHandler, Injectable, Injector } from '@angular/core';
import { Router } from '@angular/router';
import { DashboardError } from '~/app/core/error/error';
import { LoggingService } from '../api/logging.service';
@Injectable()
export class JsErrorHandler implements ErrorHandler {
constructor(private inje... | 1,014 | 28.852941 | 68 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.spec.ts | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { configureTestBed } from '~/testing/unit-test-helper';
import { LanguageService } from './language.service';
describe('LanguageService', () => {
let service: Langua... | 919 | 25.285714 | 94 | ts |
null | ceph-main/src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.ts | import { HttpClient } from '@angular/common/http';
import { Inject, Injectable, LOCALE_ID } from '@angular/core';
import { environment } from '~/environments/environment';
@Injectable({
providedIn: 'root'
})
export class LanguageService {
constructor(private http: HttpClient, @Inject(LOCALE_ID) protected localeId... | 568 | 22.708333 | 89 | ts |