From 5c6017e2ec847ce4d3ca9cfc9728fe043186eb72 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 5 Jun 2013 13:49:44 -0700 Subject: [PATCH] CLOUDSTACK-2844: VPC UI: Disable LB links if not supported on tier --- ui/modules/vpc/vpc.css | 11 +++++++++++ ui/modules/vpc/vpc.js | 8 ++++++++ ui/scripts/vpc.js | 28 ++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ui/modules/vpc/vpc.css b/ui/modules/vpc/vpc.css index db57d94c5d6..0ff99db3d59 100644 --- a/ui/modules/vpc/vpc.css +++ b/ui/modules/vpc/vpc.css @@ -154,6 +154,15 @@ cursor: pointer; } +.vpc-network-chart .tier-item .content .dashboard-item.disabled { + /*+opacity:50%;*/ + filter: alpha(opacity=50); + -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); + -moz-opacity: 0.5; + opacity: 0.5; + cursor: not-allowed; +} + .vpc-network-chart .tier-item .content .dashboard-item:hover { background-color: #DBEDFE; /*+box-shadow:inset 0px 1px 2px #000000;*/ @@ -271,6 +280,8 @@ float: left; /*+placement:shift 10px 176px;*/ position: relative; + left: 10px; + top: 176px; left: 0px; top: 237px; } diff --git a/ui/modules/vpc/vpc.js b/ui/modules/vpc/vpc.js index 5e87dbb4fb6..981d612b520 100644 --- a/ui/modules/vpc/vpc.js +++ b/ui/modules/vpc/vpc.js @@ -231,7 +231,15 @@ $dashboardItem.append($total, $name); $dashboardItem.appendTo($dashboard); + if (dashboardItem._disabled) { + $dashboardItem.addClass('disabled'); + } + $dashboardItem.click(function() { + if ($dashboardItem.is('.disabled')) { + return false; + } + var section = cloudStack.vpc.sections[id]; var $section = $('
'); var $loading = $('
').addClass('loading-overlay'); diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index 7ebc3f31065..9d7b0584cc4 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -3482,17 +3482,41 @@ } ).length ? tier._highlighted = true : tier._highlighted = false; + // Get LB capabilities + var lbSchemes = $.grep( + $.grep( + tier.service, + function(service) { + return service.name == 'Lb'; + } + )[0].capability, + function(capability) { + return capability.name == 'LbSchemes'; + } + ); + + var hasLbScheme = function(schemeVal) { + return $.grep( + lbSchemes, + function(scheme) { + return scheme.value == schemeVal; + } + ).length ? true : false; + }; + return $.extend(tier, { _dashboardItems: [ { id: 'internalLoadBalancers', name: 'Internal LB', - total: internalLoadBalancers.count + total: internalLoadBalancers.count, + _disabled: !hasLbScheme('Internal') }, { id: 'publicLbIps', name: 'Public LB IP', - total: publicLbIps.count + total: publicLbIps.count, + _disabled: !hasLbScheme('Public') }, { id: 'tierStaticNATs',