diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts new file mode 100644 index 000000000..1be11590d --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/dimless.pipe.ts @@ -0,0 +1,14 @@ +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_number(value, 1000, ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']); + } +} |