Skip to content

Commit

Permalink
Closes-bug: #1552959 - Allow network static routes to be tagged with …
Browse files Browse the repository at this point in the history
…communities

Change-Id: I05c1689c2f57cb613d96f434624e7af2247b0592
  • Loading branch information
sbavanasi committed Apr 15, 2016
1 parent ce1cb15 commit 732f12a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
29 changes: 14 additions & 15 deletions webroot/config/networking/routetable/ui/js/models/RtTableModel.js
Expand Up @@ -87,25 +87,24 @@ define([
if(type === "route-table") {
obj["next_hop"] = nextHop;
obj["next_hop_type"] = nextHopType
} else {
var commAttrs = routesCollection[i].community_attr();
var arr = commAttrs.split('\n');
var len = arr.length;
commAttrArr = [];
for (var j = 0; j < len; j++) {
var tmpArr = arr[j].split(',');
if (tmpArr.length > 0) {
var arrLen = tmpArr.length;
for (var k = 0; k < arrLen; k++) {
if (tmpArr[k].length > 0) {
commAttrArr.push(tmpArr[k].trim());
}
}
var commAttrs = routesCollection[i].community_attr();
var arr = commAttrs.split('\n');
var len = arr.length;
commAttrArr = [];
for (var j = 0; j < len; j++) {
var tmpArr = arr[j].split(',');
if (tmpArr.length > 0) {
var arrLen = tmpArr.length;
for (var k = 0; k < arrLen; k++) {
if (tmpArr[k].length > 0) {
commAttrArr.push(tmpArr[k].trim());
}
}
}
obj['community_attributes'] = {};
obj['community_attributes']['community_attribute'] = commAttrArr;
}
obj['community_attributes'] = {};
obj['community_attributes']['community_attribute'] = commAttrArr;
routesArr.push(obj);
}
return routesArr;
Expand Down
49 changes: 26 additions & 23 deletions webroot/config/networking/routetable/ui/js/views/RtTableEditView.js
Expand Up @@ -119,7 +119,7 @@ define([
name: 'Next Hop Type',
viewConfig: {
placeholder: 'Next Hop Type',
width: 200,
width: 150,
templateId: cowc.TMPL_EDITABLE_GRID_DROPDOWN_VIEW,
path: 'next_hop_type',
dataBindValue: 'next_hop_type()',
Expand All @@ -133,48 +133,51 @@ define([
}
}
};
viewConfigNextHop = {
viewConfigNextHop = {
elementId: 'next_hop',
view: 'FormInputView',
class: "",
name: 'Next Hop',
viewConfig: {
placeholder: 'Enter IP Address',
width: 200,
width: 250,
templateId: cowc.TMPL_EDITABLE_GRID_INPUT_VIEW,
path: 'next_hop',
dataBindValue: 'next_hop()'
}
};

viewConfigCommunityAttr = {
elementId: 'community_attr',
view: 'FormMultiselectView',
class: "",
name: 'Communities',
viewConfig: {
width: 400,
templateId: cowc.TMPL_EDITABLE_GRID_MULTISELECT_VIEW,
path: 'community_attr',
dataBindValue: 'community_attr()',
elementConfig: {
placeholder: 'Select or Enter Communities',
dataTextField: "text",
dataValueField: "id",
data : ctwc.DEFAULT_COMMUNITIES,
tags: true
}
}
};
viewConfigCommunityAttr = function(width) {
return {
elementId: 'community_attr',
view: 'FormMultiselectView',
class: "",
name: 'Communities',
viewConfig: {
width: width,
templateId: cowc.TMPL_EDITABLE_GRID_MULTISELECT_VIEW,
path: 'community_attr',
dataBindValue: 'community_attr()',
elementConfig: {
placeholder: 'Select or Enter Communities',
dataTextField: "text",
dataValueField: "id",
data : ctwc.DEFAULT_COMMUNITIES,
tags: true
}
}
};
};

function getRouteTableColViewConfigs() {
var columns = [];
columns.push(viewConfigPrefix);
if(rtTableType === "route-table") {
columns.push(viewConfigNextHopType);
columns.push(viewConfigNextHop);
columns.push(viewConfigCommunityAttr(200));
} else {
columns.push(viewConfigCommunityAttr);
columns.push(viewConfigCommunityAttr(400));
}
return columns;
}
Expand Down

0 comments on commit 732f12a

Please sign in to comment.