Skip to content

Commit

Permalink
Adds smart management and diagnostics [Fixes #147640893]
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenBW committed Jun 30, 2017
1 parent 097805d commit 64ad1b3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
5 changes: 3 additions & 2 deletions client/app/services/vm-details/vm-details.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function ComponentController($stateParams, VmsService, ServicesState, sprintf, l
neverText: __('Never'),
noneText: __('None'),
availableText: __('Available'),
notAvailable: __("Not Available"),
notAvailableText: __("Not Available"),
vmDetails: {},
viewType: $stateParams.viewType || 'detailsView',
viewSelected: viewSelected,
Expand Down Expand Up @@ -91,6 +91,7 @@ function ComponentController($stateParams, VmsService, ServicesState, sprintf, l

function handleSuccess(response) {
vm.vmDetails = response;
vm.currentDate = new Date();
const allocatedStorage = UsageGraphsService.convertBytestoGb(vm.vmDetails.allocated_disk_storage); // convert bytes to gb
const usedStorage = UsageGraphsService.convertBytestoGb(vm.vmDetails.used_storage);
const totalMemory = vm.vmDetails.ram_size / 1024;
Expand All @@ -111,7 +112,7 @@ function ComponentController($stateParams, VmsService, ServicesState, sprintf, l
vm.vmDetails.driftHistory = defaultText(vm.vmDetails.drift_states);
vm.vmDetails.scanHistoryCount = defaultText(vm.vmDetails.scan_histories);
vm.vmDetails.lastComplianceStatus = (angular.isUndefined(vm.vmDetails.last_compliance_status) ? __('Never Verified') : vm.vmDetails.last_compliance_status);
vm.vmDetails.complianceHistory = (vm.vmDetails.compliances.length > 0 ? vm.availableText : vm.notAvailable);
vm.vmDetails.complianceHistory = (vm.vmDetails.compliances.length > 0 ? vm.availableText : vm.notAvailableText);
vm.vmDetails.provisionDate = angular.isDefined(vm.vmDetails.service.miq_request) ? vm.vmDetails.service.miq_request.fulfilled_on : __('Unknown');
vm.vmDetails.containerSpecsText = vm.vmDetails.vendor + ': ' + vm.vmDetails.hardware.cpu_total_cores + ' CPUs (' + vm.vmDetails.hardware.cpu_sockets
+ ' sockets x ' + vm.vmDetails.hardware.cpu_cores_per_socket + ' core), ' + vm.vmDetails.hardware.memory_mb + ' MB';
Expand Down
71 changes: 36 additions & 35 deletions client/app/services/vm-details/vm-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
{{key |translate}}
</div>
<div class="col-xs-6">
{{value | number:2 || vm.notAvailable}} {{title === 'CPU'? 'Mhz': title === 'Memory'? 'MB' :
{{value | number:2 || vm.notAvailableText}} {{title === 'CPU'? 'Mhz': title === 'Memory'? 'MB' :
title.includes('Usage')?
'%':null}}
</div>
Expand All @@ -192,6 +192,7 @@
</div>
</div>
<div class="col-xs-6">

<div ng-if="vm.permissions.vm_check_compliance" class="container-fluid vm-details-container">
<div class="row title">
<div>{{ 'Compliance'|translate }}</div>
Expand Down Expand Up @@ -233,7 +234,7 @@
<detail-reveal detail-title="Files" detail="{{ vm.vmDetails.files.length }}"></detail-reveal>
</div>

<div class="container-fluid vm-details-container">
<div class="container-fluid vm-details-container" ng-if="vm.permissions.storage_show_list">
<div class="row title">
<div>{{ 'Datastore Allocation Summary'|translate }}</div>
</div>
Expand All @@ -249,52 +250,52 @@
detail="{{ vm.vmDetails.disk_size | formatBytes}}"></detail-reveal>
</div>

<div class="container-fluid vm-details-container">
<div class="container-fluid vm-details-container" ng-if="vm.permissions.storage_show_list">
<div class="row title">
<div>{{ 'Datastore Actual Usage Summary'|translate }}</div>
</div>
<detail-reveal detail-title="Disks"
detail="{{ vm.vmDetails.disk_size | formatBytes }}"></detail-reveal>
<detail-reveal detail-title="Snapshots"
detail="{{ vm.vmDetails.derived_storage_snapshot_managed }}"></detail-reveal>
detail="{{ vm.vmDetails.derived_storage_snapshot_managed || 0 | formatBytes }}"></detail-reveal>
<detail-reveal detail-title="Total Datastore Used Space"
detail="{{ vm.vmDetails.used_disk_storage | formatBytes }}"></detail-reveal>
<detail-reveal detail-title="Unused/Overcommited Allocation"
detail="{{ vm.vmDetails.uncommitted_storage | formatBytes }}"></detail-reveal>
</div>

<!--<div class="container-fluid vm-details-container">-->
<!--<div class="row title">-->
<!--<div>{{ 'Diagnostics'|translate }}</div>-->
<!--</div>-->
<!--<detail-reveal detail-title="Running Processes "-->
<!--detail="{{ vm.vmDetails.vmsafe_enable? 'true' : 'false' }}"></detail-reveal>-->
<!--<detail-reveal detail-title="Event Logs"-->
<!--detail="{{ vm.vmDetails.vmsafe_enable? 'true' : 'false' }}"></detail-reveal>-->
<!--</div>-->
<div class="container-fluid vm-details-container">
<div class="row title">
<div>{{ 'Diagnostics'|translate }}</div>
</div>
<detail-reveal detail-title="Running Processes"
icon="fa fa-cog"
detail="{{ vm.vmDetails.operating_system.processes.length? 'From About ' + (vm.currentDate - vm.vmDetails.operating_system.processes[0].updated_on | elapsedTime) + ' Ago': vm.notAvailableText }}"></detail-reveal>
<detail-reveal detail-title="Event Logs"
detail="{{ vm.vmDetails.event_logs.length? vm.available: vm.notAvailableText }}" icon="fa fa fa-file-text-o"></detail-reveal>
</div>

<!--<div class="container-fluid vm-details-container">-->
<!--<div class="row title">-->
<!--<div>{{ 'Smart Management'|translate }}</div>-->
<!--</div>-->
<!--<div class="row detail-row" ng-repeat="(title, ranges) in vm.operatingRanges">-->
<!--<div class="col-xs-4">-->
<!--{{title.replace('_', ' ') | translate}}-->
<!--</div>-->
<!--<div class="col-xs-8">-->
<!--<div class="row sub-row" ng-repeat="(key, value) in ranges">-->
<!--<div class="col-xs-6 text-capitalize">-->
<!--{{key |translate}}-->
<!--</div>-->
<!--<div class="col-xs-6">-->
<!--{{value | number:2 || vm.notAvailable}} {{title === 'CPU'? 'Mhz': title === 'Memory'? 'MB' :-->
<!--title.includes('Usage')?-->
<!--'%':null}}-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="container-fluid vm-details-container">
<div class="row title">
<div>{{ 'Smart Management'|translate }}</div>
</div>
<div class="row">
<div class="col-xs-4">
{{'Tags' | translate}}
</div>
<div class="col-xs-8">
<div class="row detail-row" ng-repeat="item in vm.vmDetails.drift_states[0].data.tags"
ng-if="item.category_description && vm.vmDetails.drift_states[0].data.tags">
<div class="col-xs-12 text-capitalize">
<i class="fa fa-tag"></i> {{item.category_description |translate}}: {{item.entry_description|translate}}
</div>
</div>
<div ng-if="!vm.vmDetails.drift_states[0].data.tags" class="row">
{{'No Tags have been assigned'|translate}}
</div>
</div>
</div>
</div>
</div>
</div>

Expand Down
2 changes: 2 additions & 0 deletions client/app/services/vms.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export function VmsService(CollectionsApi, RBAC) {
'used_disk_storage',
'uncommitted_storage',
'ems_events',
'operating_system.processes',
'event_logs',
],
expand: [],
auto_refresh: refresh,
Expand Down

0 comments on commit 64ad1b3

Please sign in to comment.