]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/usage-bar/usage-bar.component.ts
import 15.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / usage-bar / usage-bar.component.ts
CommitLineData
11fdf7f2
TL
1import { Component, Input, OnChanges } from '@angular/core';
2
3@Component({
4 selector: 'cd-usage-bar',
5 templateUrl: './usage-bar.component.html',
6 styleUrls: ['./usage-bar.component.scss']
7})
8export class UsageBarComponent implements OnChanges {
9 @Input()
f6b5b4d7 10 total: number;
11fdf7f2 11 @Input()
f6b5b4d7
TL
12 used: number;
13 @Input()
14 isBinary = true;
15 @Input()
16 decimals = 0;
11fdf7f2
TL
17
18 usedPercentage: number;
19 freePercentage: number;
11fdf7f2
TL
20
21 constructor() {}
22
23 ngOnChanges() {
f6b5b4d7 24 this.usedPercentage = this.total > 0 ? (this.used / this.total) * 100 : 0;
11fdf7f2 25 this.freePercentage = 100 - this.usedPercentage;
11fdf7f2
TL
26 }
27}