fix free storage info bug

This commit is contained in:
Steven Zou 2017-04-05 19:00:02 +08:00 committed by kunw
parent dfda6b4772
commit a1769ac6dc
2 changed files with 7 additions and 3 deletions

View File

@ -5,7 +5,7 @@
<div #barTwo class="esxc-gauge-circle-fill esxc-gauge-bar-two"></div>
<div class="esxc-gauge-circle-inner" [ngStyle]="{'background-color': backgroundColor}">
<div class="esxc-gauge-circle-caption">
<span class="esxc-value">{{used}}</span>
<span class="esxc-value">{{free}}</span>
</div>
</div>
</div>

View File

@ -136,6 +136,10 @@ export class GaugeComponent implements AfterViewInit {
this.determineColors();
}
get used(): number {
return this._threasHold - this._free;
}
@Input()
get threasHold(): number {
return this._threasHold;
@ -156,8 +160,8 @@ export class GaugeComponent implements AfterViewInit {
private determineColors() {
let percent: number = 0;
if (this._threasHold !== 0) {
let used:number = this._threasHold - this._free;
if(used < 0){
let used: number = this._threasHold - this._free;
if (used < 0) {
used = 0;
}
percent = (used / this._threasHold) * 100;