diff --git a/ui/scripts/system.js b/ui/scripts/system.js index bf726b7dbc0..77285aa090f 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1063,7 +1063,7 @@ if(physicalNetworkObjs.length > 1) { //multiple physical networks var guestTrafficTypeTotal = 0; for(var i = 0; i < physicalNetworkObjs.length; i++) { - if(guestTrafficTypeTotal > 1) + if(guestTrafficTypeTotal > 1) //as long as guestTrafficTypeTotal > 1, break for loop, don't need to continue to count. It doesn't matter whether guestTrafficTypeTotal is 2 or 3 or 4 or 5 or more. We only care whether guestTrafficTypeTotal is greater than 1. break; $.ajax({ url: createURL("listTrafficTypes&physicalnetworkid=" + physicalNetworkObjs[i].id), diff --git a/ui/scripts/ui-custom/zoneChart.js b/ui/scripts/ui-custom/zoneChart.js index c6c331f30a6..70e0da1f3c9 100644 --- a/ui/scripts/ui-custom/zoneChart.js +++ b/ui/scripts/ui-custom/zoneChart.js @@ -216,6 +216,7 @@ 'providers': { label: 'Network Service Providers', ignoreChart: true, + dependsOn: 'guest', configure: { action: actions.providerListView(targetContext) } @@ -227,8 +228,18 @@ }); // Make traffic type elems - $.each(trafficTypes, function(id, trafficType) { - if ($.inArray(id, validTrafficTypes) == -1 && !trafficType.ignoreChart) return true; + $.each(trafficTypes, function(id, trafficType) { + if ($.inArray(id, validTrafficTypes) == -1) { //if it is not a valid traffic type + if(trafficType.dependsOn != null && trafficType.dependsOn.length > 0) { //if it has dependsOn + if($.inArray(trafficType.dependsOn, validTrafficTypes) == -1) { //if its dependsOn is not a valid traffic type, either + return true; //skip this item + } + //else, if its dependsOn is a valid traffic type, continue to Make list item (e.g. providers.dependsOn is 'guest') + } + else { + return true; //if it doesn't have dependsOn, skip this item + } + } // Make list item var $li = $('
  • ').addClass(id); @@ -244,7 +255,8 @@ $li.appendTo($trafficTypes); // Make chart - if (trafficType.ignoreChart) return true; + if (trafficType.ignoreChart) + return true; var $targetChartItem = $('
    ').addClass('network-chart-item').addClass(id); $targetChartItem.appendTo($networkChart);