Skip to content

Commit

Permalink
Port page minor fix
Browse files Browse the repository at this point in the history
Parent uuid in grid expand was not shown properly fixed it.

Closes-Bug: #1542260

Mirror Routing Instance where not getting set at time of edit
The default Routing instance will be set from the parent network.

Related-Bug: #1541806

In Main menu changed the text of Routing policy to Routing Policies.

Change-Id: I9c672829c8358a228e59073278823e4aef8aaf13
  • Loading branch information
balamurugang committed Feb 5, 2016
1 parent 19367c5 commit 94aa29e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
14 changes: 12 additions & 2 deletions webroot/config/networking/port/ui/js/models/portModel.js
Expand Up @@ -295,8 +295,12 @@ define([
= getValueByJsonPath(mirrorObj, "analyzer_ip_address", null);
modelConfig['mirrorToUdpPort']
= getValueByJsonPath(mirrorObj, "udp_port", null);
modelConfig['mirrorToRoutingInstance']
= getValueByJsonPath(mirrorObj, "routing_instance", null);
var routingInst = getValueByJsonPath(mirrorObj, "routing_instance", []);
if (routingInst.length > 0) {
modelConfig['mirrorToRoutingInstance'] = routingInst.join(":");
} else {
modelConfig['mirrorToRoutingInstance'] = null;
}
modelConfig['is_mirror'] = true;
}

Expand Down Expand Up @@ -570,6 +574,12 @@ define([
}
}
},
// Function to update the routing Instance when the network is changed
updateMirrorRoutingInterface(portModel, newValue) {
var vnName = newValue.split(":");
vnName = getValueByJsonPath(vnName, "2");
portModel.mirrorToRoutingInstance(newValue+":"+vnName);
},
// fixed IP collection Adding
addFixedIP: function() {
if(self.subnetDataSource.length > 0) {
Expand Down
17 changes: 10 additions & 7 deletions webroot/config/networking/port/ui/js/views/portFormatters.js
Expand Up @@ -365,9 +365,11 @@ define([
mirror += this.addTableRow(["Analyzer IP Address", " : ",
temp + ", UDP port : " + temp1]);

temp = getValueByJsonPath(mirrorObj, "routing_instance", "-");
if (temp != "") {
temp = ctwu.formatCurrentFQName(temp.split(":"));
temp = getValueByJsonPath(mirrorObj, "routing_instance", []);
if (temp.length > 0) {
temp = ctwu.formatCurrentFQName(temp);
} else {
temp = "-";
}
mirror += this.addTableRow(["Routing Instance", " : ", temp]);
}
Expand Down Expand Up @@ -446,10 +448,11 @@ define([
//Grid column expand label: Sub Interface Parent Port//
this.parentUUIDFormatter = function(d, c, v, cd, dc) {
var parentUUIDFormatter = "";
if("virtual_machine_interface_refs" in dc &&
(!("virtual_machine_interface_properties" in dc) ||
("sub_interface_vlan_tag" in
dc["virtual_machine_interface_properties"] ))){
var subInterface =
getValueByJsonPath(dc,
"virtual_machine_interface_properties;sub_interface_vlan_tag", "");
var vmiRef = getValueByJsonPath(dc, "virtual_machine_interface_refs", []);
if( vmiRef.length > 0 && subInterface != ""){
var len = dc["virtual_machine_interface_refs"].length-1;
for(var i=0;i<=len;i++){
if(parentUUIDFormatter != "") {
Expand Down
15 changes: 15 additions & 0 deletions webroot/config/networking/port/ui/js/views/portGridView.js
Expand Up @@ -60,6 +60,11 @@ define([
portEditView.model = portModel;
//portModel.editViewObj = portEditView;
showHideModelAttrs(portModel);
subscribeModelChangeEvents(portModel);
if (portModel.mirrorToRoutingInstance() == "") {
portModel.updateMirrorRoutingInterface(portModel,
portModel.virtualNetworkName());
}
portEditView.renderPortPopup({
"title": ctwl.TITLE_EDIT_PORT +
' (' + dataItem.name + ')',
Expand Down Expand Up @@ -93,6 +98,8 @@ define([
var portModel = new PortModel(dataItem);
portEditView.model = portModel;
showHideModelAttrs(portModel);
subscribeModelChangeEvents(portModel);
portModel.updateMirrorRoutingInterface(portModel, portModel.virtualNetworkName());
portEditView.renderPortPopup({
"title": ctwl.TITLE_ADD_SUBINTERFACE +
' to port (' + gridDataItem.name + ')',
Expand Down Expand Up @@ -290,6 +297,7 @@ define([
var portModel = new PortModel(dataItem);
portEditView.model = portModel;
showHideModelAttrs(portModel);
subscribeModelChangeEvents(portModel);
portEditView.renderPortPopup({
"title": ctwl.TITLE_ADD_PORT,
mode : "add",
Expand Down Expand Up @@ -526,6 +534,13 @@ define([
return({});
}
}
function subscribeModelChangeEvents(portModel) {
portModel.__kb.view_model.model().on('change:virtualNetworkName',
function(model, newValue){
portModel.updateMirrorRoutingInterface(portModel, newValue);
}
);
};
this.networkFormater = function (v, dc) {
return portFormatters.networkFormater("", "", v, "", dc);
};
Expand Down
5 changes: 2 additions & 3 deletions webroot/menu.xml
Expand Up @@ -629,7 +629,7 @@ and need to add the iconClass tag wherever we need to show some icons
<searchStrings>Floating IPs, Floating IP, FIP</searchStrings>
</item>
<item>
<label>Routing Policy</label>
<label>Routing Policies</label>
<hash>config_net_rpolicies</hash>
<resources>
<resource>
Expand All @@ -642,7 +642,7 @@ and need to add the iconClass tag wherever we need to show some icons
<function>renderRoutingPolicy</function>
</resource>
</resources>
<searchStrings>Routing Policy</searchStrings>
<searchStrings>Routing Policies</searchStrings>
</item>
<item>
<label>Route Tables</label>
Expand Down Expand Up @@ -1127,4 +1127,3 @@ and need to add the iconClass tag wherever we need to show some icons
</item>
</items>
</menu>

0 comments on commit 94aa29e

Please sign in to comment.