From 94aa29e9f295b75e1240621efdab72e630a3c071 Mon Sep 17 00:00:00 2001 From: balamurugang Date: Fri, 5 Feb 2016 16:49:48 +0530 Subject: [PATCH] Port page minor fix 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 --- .../networking/port/ui/js/models/portModel.js | 14 ++++++++++++-- .../port/ui/js/views/portFormatters.js | 17 ++++++++++------- .../networking/port/ui/js/views/portGridView.js | 15 +++++++++++++++ webroot/menu.xml | 5 ++--- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/webroot/config/networking/port/ui/js/models/portModel.js b/webroot/config/networking/port/ui/js/models/portModel.js index 758c5945a..d8cbd265f 100644 --- a/webroot/config/networking/port/ui/js/models/portModel.js +++ b/webroot/config/networking/port/ui/js/models/portModel.js @@ -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; } @@ -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) { diff --git a/webroot/config/networking/port/ui/js/views/portFormatters.js b/webroot/config/networking/port/ui/js/views/portFormatters.js index 502598b83..02a86fd24 100644 --- a/webroot/config/networking/port/ui/js/views/portFormatters.js +++ b/webroot/config/networking/port/ui/js/views/portFormatters.js @@ -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]); } @@ -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 != "") { diff --git a/webroot/config/networking/port/ui/js/views/portGridView.js b/webroot/config/networking/port/ui/js/views/portGridView.js index 371464e54..d95dbdc51 100644 --- a/webroot/config/networking/port/ui/js/views/portGridView.js +++ b/webroot/config/networking/port/ui/js/views/portGridView.js @@ -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 + ')', @@ -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 + ')', @@ -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", @@ -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); }; diff --git a/webroot/menu.xml b/webroot/menu.xml index 89f5abbea..60c330382 100644 --- a/webroot/menu.xml +++ b/webroot/menu.xml @@ -629,7 +629,7 @@ and need to add the iconClass tag wherever we need to show some icons Floating IPs, Floating IP, FIP - + config_net_rpolicies @@ -642,7 +642,7 @@ and need to add the iconClass tag wherever we need to show some icons renderRoutingPolicy - Routing Policy + Routing Policies @@ -1127,4 +1127,3 @@ and need to add the iconClass tag wherever we need to show some icons -