mirror of https://github.com/apache/cloudstack.git
Fixed 2.2 Dashboard
- changed "totalCapacity" to "totalcapacity" in listCapacity response - Fixed percentUsed calculation to actually calculate the percentage used of each capacity resource
This commit is contained in:
parent
e6f7a480ae
commit
19102c023d
|
|
@ -44,7 +44,7 @@ import com.cloud.storage.StoragePoolVO;
|
|||
public class ListCapacityCmd extends BaseListCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(ListCapacityCmd.class.getName());
|
||||
private static final DecimalFormat s_percentFormat = new DecimalFormat("####.##");
|
||||
private static final DecimalFormat s_percentFormat = new DecimalFormat("##.##");
|
||||
|
||||
private static final String s_name = "listcapacityresponse";
|
||||
|
||||
|
|
@ -120,12 +120,15 @@ public class ListCapacityCmd extends BaseListCmd {
|
|||
capacityResponse.setPodId(summedCapacity.getPodId());
|
||||
if (summedCapacity.getPodId() > 0) {
|
||||
capacityResponse.setPodName(ApiDBUtils.findPodById(summedCapacity.getPodId()).getName());
|
||||
} else {
|
||||
capacityResponse.setPodName("All");
|
||||
}
|
||||
}
|
||||
capacityResponse.setZoneId(summedCapacity.getDataCenterId());
|
||||
capacityResponse.setZoneName(ApiDBUtils.findZoneById(summedCapacity.getDataCenterId()).getName());
|
||||
if (summedCapacity.getTotalCapacity() != 0) {
|
||||
capacityResponse.setPercentUsed(s_percentFormat.format(summedCapacity.getUsedCapacity() / summedCapacity.getTotalCapacity()));
|
||||
float computed = ((float)summedCapacity.getUsedCapacity() / (float)summedCapacity.getTotalCapacity() * 100f);
|
||||
capacityResponse.setPercentUsed(s_percentFormat.format((float)summedCapacity.getUsedCapacity() / (float)summedCapacity.getTotalCapacity() * 100f));
|
||||
} else {
|
||||
capacityResponse.setPercentUsed(s_percentFormat.format(0L));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class CapacityResponse extends BaseResponse {
|
|||
@SerializedName("capacityused") @Param(description="the capacity currently in use")
|
||||
private Long capacityUsed;
|
||||
|
||||
@SerializedName("capacityTotal") @Param(description="the total capacity available")
|
||||
@SerializedName("capacitytotal") @Param(description="the total capacity available")
|
||||
private Long capacityTotal;
|
||||
|
||||
@SerializedName("percentused") @Param(description="the percentage of capacity currently in use")
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox low" id="bar_chart" style="width: 18%;">
|
||||
<div class="db_barbox low" id="bar_chart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox low" id="bar_chart" style="width: 20%;">
|
||||
<div class="db_barbox low" id="bar_chart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox mid" id="bar_chart" style="width: 66%;">
|
||||
<div class="db_barbox mid" id="bar_chart" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox high" id="bar_chart" style="width: 83%;">
|
||||
<div class="db_barbox high" id="bar_chart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox low" id="bar_chart" style="width: 15%;">
|
||||
<div class="db_barbox low" id="bar_chart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox low" id="bar_chart" style="width: 40%;">
|
||||
<div class="db_barbox low" id="bar_chart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 58%; border: none;">
|
||||
<div class="db_barbox low" id="bar_chart" style="width: 20%;">
|
||||
<div class="db_barbox low" id="bar_chart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbrow_cell" style="width: 12%; border: none;">
|
||||
|
|
|
|||
Loading…
Reference in New Issue