From e160415d8739a35565fb618846f83d09dd9def13 Mon Sep 17 00:00:00 2001 From: Naga Kiran Date: Tue, 9 Jun 2015 14:47:32 +0530 Subject: [PATCH] Closes-Bug: #1463324 Here, vRotuer data source is updated sequentially, like in 1st call, all the basic details are fetched and in the second call generators information is fetched. As the scatter chart doesn't need information from generators to render, earlier a check was added not to render scatterchart while updating datasource with just generators information, which is blocking updating scatterchart with local cache that has generators information Commented this check Change-Id: Ifdf62acca34ba7b1091d9eeed88594fe97426e65 --- .../ui/js/monitor_infra_vrouter_summary.js | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/webroot/monitor/infra/vrouter/ui/js/monitor_infra_vrouter_summary.js b/webroot/monitor/infra/vrouter/ui/js/monitor_infra_vrouter_summary.js index f85ae59a9..ad7298cee 100644 --- a/webroot/monitor/infra/vrouter/ui/js/monitor_infra_vrouter_summary.js +++ b/webroot/monitor/infra/vrouter/ui/js/monitor_infra_vrouter_summary.js @@ -6,6 +6,7 @@ * vRouters Summary Page */ monitorInfraComputeSummaryClass = (function() { + var crossFilterInitialized = false; var computeNodesGrid,vRoutersData = []; var vRouterDataWithStatusInfo = []; var filteredNodeNames = []; @@ -43,14 +44,16 @@ monitorInfraComputeSummaryClass = (function() { filteredNodeNames.push(obj['name']); }); computeNodesGrid = $('#divcomputesgrid').data('contrailGrid'); - computeNodesGrid._dataView.setFilterArgs({ - filteredNodeNames:filteredNodeNames - }); - computeNodesGrid._dataView.setFilter(function(item,args) { - if($.inArray(item['name'],args['filteredNodeNames']) > -1) - return true; - return false; - }); + if(computeNodesGrid != null && computeNodesGrid._dataView != null) { + computeNodesGrid._dataView.setFilterArgs({ + filteredNodeNames:filteredNodeNames + }); + computeNodesGrid._dataView.setFilter(function(item,args) { + if($.inArray(item['name'],args['filteredNodeNames']) > -1) + return true; + return false; + }); + } //update the header var totalCnt = vRoutersDataSource.getItems().length; @@ -62,7 +65,7 @@ monitorInfraComputeSummaryClass = (function() { var vRouterData = result['data']; var source = result['cfg']['source']; //Do not update crossfilters if the update request also came from crossfilter or because of a generator update - if(source == 'crossfilter' || source == 'generator'){ + if(source == 'crossfilter') { return; } $('.chart > svg').remove(); @@ -151,10 +154,12 @@ monitorInfraComputeSummaryClass = (function() { function updatevRouterSummaryCharts(result){ var filteredNodes = result['data']; var source = result['cfg']['source']; - //if the callback is because of an update to generator then dont update the charts - if(source == 'generator'){ - return; - } + //If the callback is because of an update to generator then dont update the charts + //Putting this check is not updating the charts on coming to this page and local cache is already available with + //generators information + // if(source == 'generator'){ + // return; + // } updateChartsForSummary(filteredNodes,'compute'); } @@ -198,7 +203,8 @@ monitorInfraComputeSummaryClass = (function() { if(filteredNodes[0] != null && filteredNodes[0]['isGeneratorRetrieved'] == true){ source = 'generator'; } - if(source != 'generator'){ + if(crossFilterInitialized == false) { + crossFilterInitialized = true; manageCrossFilters.updateCrossFilter('vRoutersCF',filteredNodes); //Add current crossfilters dimensions again as they will be lost on crossfilter reset manageCrossFilters.addDimension('vRoutersCF','intfCnt');