Skip to content

Commit

Permalink
Merge pull request ManageIQ#6133 from zeari/dashboard_atomic_icons
Browse files Browse the repository at this point in the history
change atomic icons to default miq atomic icons
  • Loading branch information
martinpovolny committed Jan 18, 2016
2 parents db37bdb + 79f848d commit feb8ff4
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,14 @@ angular.module('containerDashboard', ['ui.bootstrap', 'patternfly', 'patternfly.
var providers = data.providers;
if (providers) {
if (id) {
$scope.providerTypeIconClass = data.providers[0].iconClass;

if ($scope.providerTypeIconClass == "pficon pficon-atomic") {
$scope.isAtomic=true;
$scope.providerTypeIconClass = 'pficon pficon-atomic-large'
}
$scope.providerTypeIconClass = dashboardUtilsFactory.iconClassForProvider(data.providers[0].providerType);
} else {
$scope.objectStatus.providers.count = 0;
$scope.objectStatus.providers.notifications = [];
providers.forEach(function (item) {
$scope.objectStatus.providers.count += item.count;
$scope.objectStatus.providers.notifications.push({
iconClass: item.iconClass,
iconClass: dashboardUtilsFactory.iconClassForProvider(item.providerType),
count: item.count
})
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,26 @@ angular.module('miq.util').factory('dashboardUtilsFactory', function() {
var parseDate = function(date) {
myDate = Date.parse(date);
return isNaN(myDate) ? date : myDate
}
};
var iconClassForProvider = function(provider) {
switch (provider) {
case "openshift":
case "openshift_enterprise":
iconClass = "pficon pficon-openshift";
break;
case "kubernetes":
iconClass = "pficon pficon-kubernetes";
break;
case "atomic":
iconClass = "product-vendor-atomic";
break;
case "atomic_enterprise":
iconClass = "product-vendor-atomic-enterprise";
break;
}

return iconClass;
};
return {
parseDate: parseDate,
createProvidersStatus: createProvidersStatus,
Expand All @@ -110,6 +128,7 @@ angular.module('miq.util').factory('dashboardUtilsFactory', function() {
createServicesStatus: createServicesStatus,
createImagesStatus: createImagesStatus,
createRoutesStatus: createRoutesStatus,
updateStatus: updateStatus
updateStatus: updateStatus,
iconClassForProvider: iconClassForProvider
};
});
33 changes: 10 additions & 23 deletions app/assets/stylesheets/container_providers_dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,63 +44,50 @@
line-height: 1.1;
}

/* Remove after next pf release */
.pficon-atomic:before {
max-height: 20px;
display: inline-block;
content: url(/images/icons/new/vendor-atomic_dashboard.png);
}

.atomic-large:before {
max-height: 220px;
display: inline-block;
width: auto; /* you can use % */
}


/* line 44, scss/main.scss */
.provider-card {
min-height: 140px;
padding-left: 0px;
}
/* line 47, scss/main.scss */

.provider-card .providers {
padding: 20px 0;
}
/* line 50, scss/main.scss */

.provider-card .providers a {
color: #000000;
text-decoration: none;
}
/* line 55, scss/main.scss */

.provider-card .providers a:hover {
color: #00618a;
text-decoration: underline;
}
/* line 59, scss/main.scss */

.provider-card .providers .count {
margin: 0 5px;
}
/* line 63, scss/main.scss */

.provider-card .providers .provider-icon {
font-size: 22px;
position: relative;
top: 5px;
padding-right: 5px;
opacity: .9;
}
/* line 70, scss/main.scss */

.provider-card .providers .provider-icon:hover {
opacity: 1;
}
/* line 76, scss/main.scss */

.provider-card .provider-icon-large {
font-size: 100px;
position: relative;
padding-bottom: 4px;
padding-bottom: 2px;
width: 100%;
text-align: center;
display: inline-block
}

.single-provider-containers-dashboard .card-pf.card-pf-aggregate-status-mini {
height: 62px;
}
14 changes: 4 additions & 10 deletions app/services/container_dashboard_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,9 @@ def status
end

def providers
provider_classes_to_ui_types = {
"ManageIQ::Providers::Openshift::ContainerManager" => :openshift,
"ManageIQ::Providers::OpenshiftEnterprise::ContainerManager" => :openshift,
"ManageIQ::Providers::Kubernetes::ContainerManager" => :kubernetes,
"ManageIQ::Providers::Atomic::ContainerManager" => :atomic,
"ManageIQ::Providers::AtomicEnterprise::ContainerManager" => :atomic
}
provider_classes_to_ui_types = ManageIQ::Providers::ContainerManager.subclasses.each_with_object({}) { |subclass, h|
name = subclass.name.split('::')[2]
h[subclass.name] = name.underscore.downcase.to_sym }

providers = @ems.present? ? {@ems.type => 1} : ManageIQ::Providers::ContainerManager.group(:type).count

Expand All @@ -100,9 +96,7 @@ def providers

def build_provider_status(ui_type)
{
:iconClass => "pficon pficon-#{ui_type}",
:id => ui_type,
:providerType => ui_type.capitalize,
:providerType => ui_type,
:count => 0
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/views/ems_container/_show_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<div class="row row-tile-pf" >
<div class="col-xs-6 col-sm-4 col-md-2">
<div pf-card class="col-xs-12 provider-card" show-top-border="true">
<span ng-if='!isAtomic' class="provider-icon-large {{providerTypeIconClass}}"></span>
<span ng-if='isAtomic' class="atomic-large"><img src='/images/icons/new/vendor-atomic_enterprise.png' ></span>
<span class="provider-icon-large {{providerTypeIconClass}}"></span>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-10">
Expand Down
Binary file removed public/images/icons/new/vendor-atomic_dashboard.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@
"providers": [
{
"count": 2,
"providerType": "OpenShift",
"id": "openshift",
"iconClass": "pficon pficon-openshift"
"providerType": "openShift"
},
{
"iconClass": "pficon pficon-kubernetes",
"id": "kubernetes",
"count": 1,
"providerType": "Kubernetes"
"providerType": "kubernetes"
}
],
"ems_utilization": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,11 @@
"providers": [
{
"count": 2,
"providerType": "OpenShift",
"id": "openshift",
"iconClass": "pficon pficon-openshift"
"providerType": "openshift"
},
{
"iconClass": "pficon pficon-kubernetes",
"id": "kubernetes",
"count": 1,
"providerType": "Kubernetes"
"providerType": "kubernetes"
}
],
"ems_utilization": {
Expand Down
18 changes: 6 additions & 12 deletions spec/services/container_dashboard_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@
providers_data = ContainerDashboardService.new(nil, nil).providers

# Kubernetes should not appear
expect(providers_data).to eq([{
:iconClass => "pficon pficon-openshift",
:count => 2,
:id => :openshift,
:providerType => :Openshift
},
{
:iconClass => "pficon pficon-atomic",
:count => 2,
:id => :atomic,
:providerType => :Atomic
}])
expect(providers_data).to include(
{:providerType => :openshift_enterprise, :count => 1},
{:providerType => :openshift, :count => 1},
{:providerType => :atomic, :count => 1},
{:providerType => :atomic_enterprise, :count => 1}
)
end
end

Expand Down

0 comments on commit feb8ff4

Please sign in to comment.