[go: nahoru, domu]

Skip to content

Commit

Permalink
Merge pull request goharbor#1927 from steven-zou/master
Browse files Browse the repository at this point in the history
Fix issue 1915
  • Loading branch information
Daniel Jiang committed Apr 5, 2017
2 parents b7a196f + b361e63 commit 69ebc92
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ui_ng/angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"../node_modules/clarity-icons/clarity-icons.min.js",
"../node_modules/web-animations-js/web-animations.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
Expand Down
20 changes: 14 additions & 6 deletions src/ui_ng/src/app/shared/gauge/gauge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class GaugeComponent implements AfterViewInit {
private _colorTwo: string;
private _size: string = "small"; //Support small, medium, large
private _title: string = "UNKNOWN"; //Lang key
private _used: number = 0;
private _free: number = 0;
private _threasHold: number = 0;

/**
Expand Down Expand Up @@ -127,15 +127,19 @@ export class GaugeComponent implements AfterViewInit {
}

@Input()
get used(): number {
return this._used;
get free(): number {
return this._free;
}

set used(u: number) {
this._used = u;
set free(u: number) {
this._free = u;
this.determineColors();
}

get used(): number {
return this._threasHold - this._free;
}

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

while (percent > 100) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</div>
<div class="statistic-item-divider" [hidden]="!isValidSession || !isValidStorage"></div>
<div class="statistic-block" [hidden]="!isValidSession || !isValidStorage">
<esxc-gauge [used]="freeStorage" [threasHold]="totalStorage" [size]="small" [title]='"STATISTICS.STORAGE"' [animate]="true">
<esxc-gauge [free]="freeStorage" [threasHold]="totalStorage" [size]="small" [title]='"STATISTICS.STORAGE"' [animate]="true">
</esxc-gauge>
</div>
</div>
Expand Down

0 comments on commit 69ebc92

Please sign in to comment.