Skip to content

Commit

Permalink
Fixed titles and labels for Hosts & Clusters Openstack Providers
Browse files Browse the repository at this point in the history
- Changed to show Nodes/Deployment Roles as titles for Hosts/Clusters for Openstack Dashboards charts where appropriate on screen.
- Removed Datastores count chart for Openstack Provider.

https://bugzilla.redhat.com/show_bug.cgi?id=1430241
  • Loading branch information
h-kataria committed Jun 16, 2017
1 parent bcf147f commit 75032b5
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,15 @@
$scope.clusterCpuUsage = infraChartsMixin.processHeatmapData($scope.clusterCpuUsage, data.heatmaps.clusterCpuUsage);
$scope.clusterCpuUsage.loadingDone = true;

$scope.clusterChartTitle = data.heatmaps.title;
$scope.clusterMemoryUsage =
infraChartsMixin.processHeatmapData($scope.clusterMemoryUsage, data.heatmaps.clusterMemoryUsage);
$scope.clusterMemoryUsage.loadingDone = true;

// Recent Hosts
$scope.recentHostsConfig = infraChartsMixin.chartConfig.recentHostsConfig;
$scope.recentHostsConfig.headTitle = data.recentHosts.title
$scope.recentHostsConfig.label = data.recentHosts.label

// recent Hosts chart
$scope.recentHostsData = infraChartsMixin.processRecentHostsData(data.recentHosts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ angular.module('miq.util').factory('infraDashboardUtilsFactory', function() {
};
var createClustersStatus = function() {
return {
title: __("Clusters"),
iconClass: " pficon pficon-cluster",
count: 0,
notification: {}
};
};
var createHostsStatus = function() {
return {
title: __("Hosts"),
iconClass: "pficon pficon-screen",
count: 0,
notification: {}
Expand Down Expand Up @@ -51,6 +49,9 @@ angular.module('miq.util').factory('infraDashboardUtilsFactory', function() {
statusObject.notification = {};
if (data) {
statusObject.count = data.count;
if (data.title)
statusObject.title = data.title;

if (data.errorCount > 0) {
statusObject.notification = {
iconClass: "pficon pficon-error-circle-o",
Expand Down
30 changes: 21 additions & 9 deletions app/services/ems_infra_dashboard_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,21 @@ def all_data
end

def status
{
status_hsh = {
:ems_clusters => {
:title => is_opensatck? ? _('Deplyoment Roles') : _('Cluster'),
:count => @ems.present? ? @ems.ems_clusters.count : EmsCluster.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:ems_cluster)
},
:hosts => {
:title => is_opensatck? ? _('Nodes') : _('Hosts'),
:count => @ems.present? ? @ems.hosts.count : Host.where.not(:ext_management_system => nil).count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:host)
},
:datastores => {
:count => @ems.present? ? @ems.storages.count : Storage.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:storage)
},
:vms => {
:count => @ems.present? ? @ems.vms.count : VmInfra.where.not(:ext_management_system => nil).count,
:errorCount => 0,
Expand All @@ -54,6 +50,15 @@ def status
:href => get_url_to_entity(:miq_template)
}
}

status_hsh[:datastores] = {
:count => @ems.present? ? @ems.storages.count : Storage.count,
:errorCount => 0,
:warningCount => 0,
:href => get_url_to_entity(:storage)
} unless is_opensatck?

status_hsh
end

def providers
Expand Down Expand Up @@ -124,7 +129,8 @@ def heatmaps

{
:clusterCpuUsage => cluster_cpu_usage.presence,
:clusterMemoryUsage => cluster_memory_usage.presence
:clusterMemoryUsage => cluster_memory_usage.presence,
:title => is_opensatck? ? _('Deplyoment Roles Utilization') : _('Cluster Utilization')
}
end

Expand All @@ -140,7 +146,9 @@ def recentHosts

{
:xData => all_hosts.keys,
:yData => all_hosts.values.map
:yData => all_hosts.values.map,
:title => is_opensatck? ? _('Recent Nodes') : _('Recent Hosts'),
:label => is_opensatck? ? _('Nodes') : _('Hosts'),
}
end

Expand Down Expand Up @@ -205,4 +213,8 @@ def daily_provider_metrics
.where(:resource => (@ems || ManageIQ::Providers::InfraManager.all))
.where('timestamp > ?', 30000.days.ago.utc).order('timestamp')
end

def is_opensatck?
@ems.kind_of?(ManageIQ::Providers::Openstack::InfraManager)
end
end
15 changes: 8 additions & 7 deletions app/views/ems_infra/_show_dashboard.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
"show-top-border" => "true",
:status => "objectStatus.hosts",
:url => "navigation"}
.col-xs-6.col-sm-6.col-md-3
%div{:layout => "mini",
"pf-aggregate-status-card" => "",
"show-top-border" => "true",
:status => "objectStatus.datastores",
:url => "navigation"}
- unless @ems.kind_of?(ManageIQ::Providers::Openstack::InfraManager)
.col-xs-6.col-sm-6.col-md-3
%div{:layout => "mini",
"pf-aggregate-status-card" => "",
"show-top-border" => "true",
:status => "objectStatus.datastores",
:url => "navigation"}
.col-xs-6.col-sm-6.col-md-3
%div{:layout => "mini",
"pf-aggregate-status-card" => "",
Expand Down Expand Up @@ -75,7 +76,7 @@
:heatmaps => "heatmaps",
"heatmaps-card" => "",
:hidetopborder => "true",
:title => _("Cluster Utilization")}
"title" => "{{clusterChartTitle}}"}
.row.row-tile-pf.row-tile-pf-last
.col-xs-12.col-sm-6.col-md-6
%div{"head-title" => "{{recentHostsConfig.headTitle}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
"clusterCpuUsage": null,
"clusterMemoryUsage": null
},
"recentHosts": {
"title": "Recent Hosts",
"label": "hosts",
"xData": [
"2015-11-26"
],
"yData": [
3
]
},
"providers": [
{
"count": 1,
Expand Down
10 changes: 10 additions & 0 deletions spec/javascripts/fixtures/json/ems_infra_dashboard_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
}
]
},
"recentHosts": {
"title": "Recent Hosts",
"label": "hosts",
"xData": [
"2015-11-26"
],
"yData": [
3
]
},
"providers": [
{
"count": 1,
Expand Down

0 comments on commit 75032b5

Please sign in to comment.