From cad12f2d22dc692ecfe77bbee8270e949e776f56 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Thu, 13 Sep 2018 13:09:25 -0400 Subject: [PATCH] Fixed some inconsistencies on provider dashboards. - Red crosses were added as part of https://github.com/ManageIQ/manageiq-ui-classic/pull/4453 that caused them to show up on all aggregate status cards on all provider dashboards, fixed the condition and removed setting of redundant notification hash for providers when it is not needed. - Show status icon under Alerts in aggregate card if Alerts are configured for a container provider, otherwise show "No data available" empty pf card. - On Containers Overview dashboard, Fixed to not show provider icon in Provider status aggregate card, it should only show count of providers with a link to list view to Container Providers show list. - Added a title on Container Overview dashboard screen, since that's the only screen on that subtab there are no breadcrumbs on the screen. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1626199 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1626427 --- .../aggregate_status_card_controller.js | 5 +---- app/controllers/container_dashboard_controller.rb | 1 + app/services/container_dashboard_service.rb | 4 +++- app/services/ems_dashboard_service.rb | 4 ---- app/views/container_dashboard/show.html.haml | 2 ++ app/views/static/pf_charts/aggregate-status-card.html.haml | 3 ++- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/controllers/ems_container_dashboard/aggregate_status_card_controller.js b/app/assets/javascripts/controllers/ems_container_dashboard/aggregate_status_card_controller.js index be6e2407770d..f87855b072e9 100644 --- a/app/assets/javascripts/controllers/ems_container_dashboard/aggregate_status_card_controller.js +++ b/app/assets/javascripts/controllers/ems_container_dashboard/aggregate_status_card_controller.js @@ -67,6 +67,7 @@ angular.module( 'patternfly.card' ).controller('aggregateStatusCardContainerCont "iconClass": data.alerts.notifications[0].iconClass, "href": data.alerts.href, "count": data.alerts.notifications[0].count, + "dataAvailable": data.alerts.dataAvailable, }, ], }; @@ -80,10 +81,6 @@ angular.module( 'patternfly.card' ).controller('aggregateStatusCardContainerCont "title": attrHsh[attributes[i]], "count": dataStatus.count, "href": dataStatus.href, - "notification": { - "iconClass": "pficon pficon-error-circle-o", - "count": 0, - }, }); } vm.loadingDone = true; diff --git a/app/controllers/container_dashboard_controller.rb b/app/controllers/container_dashboard_controller.rb index 8638f5f5ff67..bb27a4a4209c 100644 --- a/app/controllers/container_dashboard_controller.rb +++ b/app/controllers/container_dashboard_controller.rb @@ -13,6 +13,7 @@ def show if params[:id].nil? @breadcrumbs.clear end + @title = title end def index diff --git a/app/services/container_dashboard_service.rb b/app/services/container_dashboard_service.rb index 801f3cb1c7d7..6dff59e4acc6 100644 --- a/app/services/container_dashboard_service.rb +++ b/app/services/container_dashboard_service.rb @@ -142,6 +142,8 @@ def alerts warnings_struct = warnings > 0 ? {:iconClass => "pficon pficon-warning-triangle-o", :count => warnings} : nil notifications = if (errors + warnings) > 0 [errors_struct, warnings_struct].compact + elsif alerts_status == [nil, nil] + [{}] else [{:iconClass => "pficon-large pficon-ok"}] end @@ -166,7 +168,7 @@ def build_provider_status(provider_type) { :count => 0, :typeName => _(provider_type.to_s), - :iconImage => icons[provider_type][:icon], + :iconImage => @ems.present? ? icons[provider_type][:icon] : nil, :statusIcon => provider_status_icon } end diff --git a/app/services/ems_dashboard_service.rb b/app/services/ems_dashboard_service.rb index 9c4ebb417f03..2295059caec3 100644 --- a/app/services/ems_dashboard_service.rb +++ b/app/services/ems_dashboard_service.rb @@ -68,10 +68,6 @@ def format_data(ems_type, attributes, attr_icon, attr_url, attr_hsh) :title => attr_hsh[attr], :count => @ems.send(attr).count, :href => get_url(ems_type, @ems_id, attr_url[attr]), - :notification => { - :iconClass => 'pficon pficon-error-circle-o', - :count => 0, - }, ) end attr_data diff --git a/app/views/container_dashboard/show.html.haml b/app/views/container_dashboard/show.html.haml index 4457ab385c77..c0ccf013ac9e 100644 --- a/app/views/container_dashboard/show.html.haml +++ b/app/views/container_dashboard/show.html.haml @@ -1 +1,3 @@ +%h1 + = @title = render :partial => "ems_container/show_dashboard" diff --git a/app/views/static/pf_charts/aggregate-status-card.html.haml b/app/views/static/pf_charts/aggregate-status-card.html.haml index 341f2974fdfb..312e3efc4b69 100644 --- a/app/views/static/pf_charts/aggregate-status-card.html.haml +++ b/app/views/static/pf_charts/aggregate-status-card.html.haml @@ -29,6 +29,7 @@ %image{"ng-if" => "notification.iconImage", "ng-src" => "{{notification.iconImage}}", :alt => "", :class => "card-pf-icon-image"} %span{:class => "{{notification.iconClass}}"} {{ notification.count }} + %pf-empty-chart{'ng-if' => "$ctrl.status.notifications[0].dataAvailable === false"} %div{"ng-if" => "$ctrl.isMiniLayout", :class => "card-pf card-pf-aggregate-status card-pf-aggregate-status-mini", "ng-class" => "{'card-pf-accented': $ctrl.shouldShowTopBorder}"} %h2{:class => "card-pf-title"} @@ -47,7 +48,7 @@ %div{:class => "card-pf-body"} %p{"ng-if" => "$ctrl.status.notification.iconImage || $ctrl.status.notification.iconClass || $ctrl.status.notification.count", :class => "card-pf-aggregate-status-notifications"} %span{:class => "card-pf-aggregate-status-notification", :title => "{{$ctrl.status.notification.tooltip}}" } - %a{"ng-if" => "$ctrl.status.notification.href", :href => "{{$ctrl$ctrl.status.notification.href}}"} + %a{"ng-if" => "$ctrl.status.notification.href && !$ctrl.status.notification.count", :href => "{{$ctrl$ctrl.status.notification.href}}"} %image{"ng-if" => "$ctrl.status.notification.iconImage", "ng-src" => "{{$ctrl.status.notification.iconImage}}", :alt => "", :class => "card-pf-icon-image"} %span{"ng-if" => "$ctrl.status.notification.iconClass", :class => "{{$ctrl.status.notification.iconClass}}"} %span{"ng-if" => "$ctrl.status.notification.count"}