Skip to content

Commit

Permalink
Adds disk usage
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenBW committed Sep 13, 2017
1 parent 10b77b0 commit 2478c8b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
26 changes: 17 additions & 9 deletions client/app/services/resource-details/resource-details.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ function ComponentController ($state, $stateParams, VmsService, ServicesState, s
'href': '#'
}
]
},
title2: 'Memory',
units2: 'GB',
data2: {
'used': '25',
'total': '100'
},
layoutInline: {
'type': 'inline'
}
})
resolveData()
Expand Down Expand Up @@ -193,6 +184,23 @@ function ComponentController ($state, $stateParams, VmsService, ServicesState, s
const usedMemory = UsageGraphsService.convertBytestoGb(vm.vmDetails.max_mem_usage_absolute_average_avg_over_time_period)
const usedCPU = vm.vmDetails.cpu_usagemhz_rate_average_avg_over_time_period
const totalCPU = (angular.isDefined(vm.vmDetails.hardware.aggregate_cpu_speed) ? vm.vmDetails.hardware.aggregate_cpu_speed : 0)
vm.diskUsage = response.disks.map((item) => {
const totalSize = item.allocated_space || response.allocated_disk_storage
const used = item.size || 0
return Object.assign(
{
data: {
'used': UsageGraphsService.convertBytestoGb(used),
'total': UsageGraphsService.convertBytestoGb(totalSize)
},
units: 'GB',
layout: {
'type': 'inline'
}
},
item)
}
)

hasUsageGraphs()

Expand Down
9 changes: 6 additions & 3 deletions client/app/services/resource-details/resource-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ <h2 translate>Timeline</h2>
<div class="col-md-12">
<div class="card-pf">
<h2 translate><i class="pficon-storage-domain"></i>Disk Usage</h2>
<pf-utilization-bar-chart chart-data="vm.data2" chart-title="vm.title2" layout="vm.layoutInline"
units="vm.units2" threshold-error="85"
threshold-warning="60"></pf-utilization-bar-chart>
<pf-utilization-bar-chart
ng-repeat="item in vm.diskUsage"
chart-data="item.data"
chart-title="item.device_name" layout="item.layout"
units="item.units" threshold-error="85"
threshold-warning="60"></pf-utilization-bar-chart>
</div>
</div>
</div>
Expand Down

0 comments on commit 2478c8b

Please sign in to comment.