Skip to content

Commit

Permalink
Merge "Closes-Bug: #1608425 - Reverting the grouping done based on AC…
Browse files Browse the repository at this point in the history
…Ls in the flows tab. Will list the ACLs in a column in the grid. Preventing a call being issued if the last record is reached. Added lazyLoading:false so that the grid messages are displayed when no records."
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Aug 5, 2016
2 parents b38d278 + f83f921 commit 34e43c9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
Expand Up @@ -1726,22 +1726,14 @@ define(
var origResponse = response;
var isFromACLFlows = false;
var ret = [];
var lastFlowReq = false;
response = jsonPath(origResponse,"$..SandeshFlowData")[0];
if (response == null){
isFromACLFlows = true;
response = jsonPath(origResponse,"$..FlowSandeshData")[0];
}
var flowKey = jsonPath(origResponse,"$..flow_key")[0];
var iterationKey = jsonPath(origResponse,"$..iteration_key")[0];
// var retArr = [];
/* for (var i = 0; i < response.length; i++) {
var currACL = response[i];
for (var j = 0; j < currACL['flowData'].length; j++) {
var currFlow = currACL['flowData'][j];
var aclUuid = currACL['acl_uuid'];
retArr.push($.extend(currFlow, {acl_uuid:aclUuid}));
}
}*/
if( response != null ){
if(!(response instanceof Array)){
response = [response];
Expand Down Expand Up @@ -1793,23 +1785,23 @@ define(
if(flowKey != null && !$.isEmptyObject(flowKey)){
//Had to add this hack because sometimes we get into to
//this parse function twice leading this to be added twice to the stack
if(flowKey != "0:0:0:0:0.0.0.0:0.0.0.0" &&
if(flowKey != "0-0-0-0-0-0.0.0.0-0.0.0.0" &&
flowKeyStack[flowKeyStack.length - 1] != flowKey)
flowKeyStack.push(flowKey);
}
if((flowKey == null) || (flowKey == "0:0:0:0:0.0.0.0:0.0.0.0")) {
if((flowKey == null) || (flowKey == "0-0-0-0-0-0.0.0.0-0.0.0.0")) {
lastFlowReq = true;
}
//Push the aclIterKey to the stack for Next use
if(iterationKey != null && !$.isEmptyObject(iterationKey)){
//Had to add this hack because sometimes we get into to
//this parse function twice leading this to be added twice to the stack
if(iterationKey.indexOf('0:0:0:0:0.0.0.0:0.0.0.0') == -1 &&
if(iterationKey.indexOf('0-0-0-0-0-0.0.0.0-0.0.0.0') == -1 &&
aclIterKeyStack[aclIterKeyStack.length - 1] != iterationKey)
aclIterKeyStack.push(iterationKey);
}
//$('#flowCnt').text(response.flowData.length);
return ret;
return {data:ret,lastFlowReq:lastFlowReq};
}

self.mergeACLAndSGData = function(sgData,aclListModel) {
Expand Down
Expand Up @@ -12,6 +12,7 @@ define([
], function (_, Knockback, ContrailView, ContrailListModel, VRouterFlowsFormModel) {

var VRouterFlowsFormView = ContrailView.extend({
lastFlowReq : false,
render: function (options) {
var self = this, viewConfig = self.attributes.viewConfig,
hostname = viewConfig['hostname'],
Expand Down Expand Up @@ -93,7 +94,7 @@ define([
ajaxConfig : remoteConfig,
dataParser : function(response) {
var retData = monitorInfraParsers.parseVRouterFlowsData(response);
return retData;
return retData['data'];
}
},
cacheConfig : {
Expand All @@ -108,6 +109,7 @@ define([
function onSelectAcl(acluuid) {
var flowGrid = $('#' + ctwl.VROUTER_FLOWS_GRID_ID).data('contrailGrid');
var newAjaxConfig = "";
self.lastFlowReq = false;
flowKeyStack = [];
aclIterKeyStack = [];
if (acluuid != 'All') {
Expand All @@ -129,8 +131,9 @@ define([
// reloadGrid(flowGrid);
$.ajax(newAjaxConfig).done(function(response) {
var retData = monitorInfraParsers.parseVRouterFlowsData(response,acluuid);
self.lastFlowReq = retData.lastFlowReq;
if(flowGrid._dataView != null)
flowGrid._dataView.setData(retData);
flowGrid._dataView.setData(retData['data']);
flowGrid.refreshView();
});
}
Expand All @@ -139,6 +142,9 @@ define([
var flowGrid = $('#' + ctwl.VROUTER_FLOWS_GRID_ID).data('contrailGrid');
var acluuid = self.model.acl_uuid();
var newAjaxConfig = "";
if(self.lastFlowReq) {
return;
}
isAllPrevFirstTimeClicked = true;
isAclPrevFirstTimeClicked = true;
if(acluuid == 'All' && flowKeyStack.length > 0 &&
Expand Down Expand Up @@ -172,8 +178,9 @@ define([
// reloadGrid(flowGrid);
$.ajax(newAjaxConfig).done(function(response) {
var retData = monitorInfraParsers.parseVRouterFlowsData(response,acluuid);
self.lastFlowReq = retData['lastFlowReq'];
if(flowGrid._dataView != null)
flowGrid._dataView.setData(retData);
flowGrid._dataView.setData(retData['data']);
flowGrid.refreshView();
});
}
Expand Down Expand Up @@ -230,9 +237,10 @@ define([
// flowGrid.setRemoteAjaxConfig(newAjaxConfig);
// reloadGrid(flowGrid);
$.ajax(newAjaxConfig).done(function(response) {
var retData = monitorInfraParsers.parseVRouterFlowsData(response);
var retData = monitorInfraParsers.parseVRouterFlowsData(response,acluuid);
self.lastFlowReq = retData.lastFlowReq;
if(flowGrid._dataView != null)
flowGrid._dataView.setData(retData,acluuid);
flowGrid._dataView.setData(retData['data'],acluuid);
flowGrid.refreshView();
});
}
Expand Down
Expand Up @@ -12,15 +12,7 @@ define([
render: function () {
var self = this, viewConfig = self.attributes.viewConfig;

self.renderView4Config(self.$el, self.model, self.getViewConfig(),
null,null,null,
function(){
cowu.addGridGrouping ('vrouter_flows-results',{
groupingField :"acl_uuid",
groupHeadingPrefix : 'ACL UUID: ',
rowCountSuffix : ['Flow','Flows']
});
});
self.renderView4Config(self.$el, self.model, self.getViewConfig());
},

getViewConfig: function () {
Expand Down Expand Up @@ -85,7 +77,7 @@ define([
searchFn: function(data) {
return getAclSgUuuidString(data,true);
},
hide:true,
// hide:true,
minWidth:280
},
{
Expand Down Expand Up @@ -201,6 +193,7 @@ define([
checkboxSelectable: false,
// fixedRowHeight: 30,
sortable: false,
lazyLoading:false,
detail: ctwu.getDetailTemplateConfigToDisplayRawJSON()
},
dataSource: {
Expand Down

0 comments on commit 34e43c9

Please sign in to comment.