From 2b31774c52243097bb336df0fd075a56cf14dea2 Mon Sep 17 00:00:00 2001 From: balamurugang Date: Tue, 2 Feb 2016 12:16:19 +0530 Subject: [PATCH] Port page Issue Fat flow schema change is done(was expecting an empty array). Ordering/Formatting UX of Mirroring in port is done The port getting created was not there in the list. because the 2nd call was not getting sent as expected. - Fixed it. Closes-Bug: #1539950 If we refresh the port page and open the edit popup the SG was getting vanished - Fixed it Closes-Bug: #1539639 Routing policy page was not showing the collection in the popup. - Fixed it. Change-Id: Ibe31455a6a9f7b81e31c7291df98f221b81269ba --- .../port/ui/js/models/fatFlowModel.js | 3 +- .../networking/port/ui/js/models/portModel.js | 1 + .../port/ui/js/views/portEditView.js | 138 +++++++++--------- .../port/ui/js/views/portFormatters.js | 18 +-- .../port/ui/js/views/portGridView.js | 13 +- .../port/ui/js/views/portListView.js | 2 +- .../ui/js/views/routingPolicyEditView.js | 2 +- 7 files changed, 88 insertions(+), 89 deletions(-) diff --git a/webroot/config/networking/port/ui/js/models/fatFlowModel.js b/webroot/config/networking/port/ui/js/models/fatFlowModel.js index 08acb23bf..4c27678e1 100644 --- a/webroot/config/networking/port/ui/js/models/fatFlowModel.js +++ b/webroot/config/networking/port/ui/js/models/fatFlowModel.js @@ -35,7 +35,8 @@ define([ }, 'port': function(value, attr, finalObj) { if(finalObj.protocol != "icmp") { - if(value.trim() == "") { + value = String(value).trim(); + if(value == "") { return "Enter valid port between 1 to 65535 for Fat Flow Record"; } if (!isNumber(value)) { diff --git a/webroot/config/networking/port/ui/js/models/portModel.js b/webroot/config/networking/port/ui/js/models/portModel.js index 4c114dd3c..dc0649b39 100644 --- a/webroot/config/networking/port/ui/js/models/portModel.js +++ b/webroot/config/networking/port/ui/js/models/portModel.js @@ -833,6 +833,7 @@ define([ var fatFlowCollection = newPortData["fatFlowCollection"].toJSON(); newPortData.virtual_machine_interface_fat_flow_protocols = {}; + newPortData.virtual_machine_interface_fat_flow_protocols.fat_flow_protocol = []; if (fatFlowCollection && fatFlowCollection.length > 0) { var fatFlowLocal = []; for(i = 0 ; i< fatFlowCollection.length ; i++){ diff --git a/webroot/config/networking/port/ui/js/views/portEditView.js b/webroot/config/networking/port/ui/js/views/portEditView.js index 7315f9817..1436d93f7 100644 --- a/webroot/config/networking/port/ui/js/views/portEditView.js +++ b/webroot/config/networking/port/ui/js/views/portEditView.js @@ -676,7 +676,65 @@ define([ }] } }] - },{ + }, + this.deviceOwner(isDisable, selectedProjectVal) + , { + columns: [{ + elementId: 'is_sub_interface', + name: "Sub Interface", + view: "FormCheckboxView", + viewConfig: { + path: 'is_sub_interface', + label: "Sub Interface", + dataBindValue: 'is_sub_interface', + class: "span6" + } + }] + }, { + columns: [{ + elementId: 'sub_interface_vlan_tag', + name: "VLAN", + view: "FormInputView", + viewConfig: { + visible: "is_sub_interface", + placeholder: 'Specify VLAN', + path: 'virtual_machine_interface_properties.sub_interface_vlan_tag', + dataBindValue: 'virtual_machine_interface_properties().sub_interface_vlan_tag', + class: "span6", + label: 'VLAN' + } + }] + }, { + columns: [{ + elementId: 'subInterfaceVMIValue', + name: "Primary Interface", + view: "FormDropdownView", + viewConfig: { + path: 'subInterfaceVMIValue', + visible: "is_sub_interface", + placeholder: 'Primary Interface', + disabled: "disable_sub_interface()", + label: "Primary Interface", + dataBindValue: 'subInterfaceVMIValue', + elementConfig:{ + dataTextField: "text", + dataValueField: "value", + //defaultValueId : 0, + dataSource : { + type: 'remote', + url:"/api/tenants/config/get-virtual-machines-ips?uuid=" + +selectedProjectVal, + parse: function(result) { + return portFormatter.subInterfaceFormatter( + result, + isDisable, + self); + } + } + } + } + }] + }, { columns: [{ elementId: 'portBindingCollection', view: 'FormEditableGridView', @@ -741,72 +799,14 @@ define([ }] } }] - }, - this.deviceOwner(isDisable, selectedProjectVal) - , { - columns: [{ - elementId: 'is_sub_interface', - name: "Sub Interface", - view: "FormCheckboxView", - viewConfig: { - path: 'is_sub_interface', - label: "Sub Interface", - dataBindValue: 'is_sub_interface', - class: "span6" - } - }] - }, { - columns: [{ - elementId: 'sub_interface_vlan_tag', - name: "VLAN", - view: "FormInputView", - viewConfig: { - visible: "is_sub_interface", - placeholder: 'Specify VLAN', - path: 'virtual_machine_interface_properties.sub_interface_vlan_tag', - dataBindValue: 'virtual_machine_interface_properties().sub_interface_vlan_tag', - class: "span6", - label: 'VLAN' - } - }] }, { - columns: [{ - elementId: 'subInterfaceVMIValue', - name: "Primary Interface", - view: "FormDropdownView", - viewConfig: { - path: 'subInterfaceVMIValue', - visible: "is_sub_interface", - placeholder: 'Primary Interface', - disabled: "disable_sub_interface()", - label: "Primary Interface", - dataBindValue: 'subInterfaceVMIValue', - elementConfig:{ - dataTextField: "text", - dataValueField: "value", - //defaultValueId : 0, - dataSource : { - type: 'remote', - url:"/api/tenants/config/get-virtual-machines-ips?uuid=" - +selectedProjectVal, - parse: function(result) { - return portFormatter.subInterfaceFormatter( - result, - isDisable, - self); - } - } - } - } - }] - } , { columns: [{ elementId: 'is_mirror', - name: "Mirror To", + name: "Enable Port Mirroring", view: "FormCheckboxView", viewConfig: { path: 'is_mirror', - label: "Mirror To", + label: "Enable Port Mirroring", dataBindValue: 'is_mirror', class: "span6" } @@ -818,7 +818,7 @@ define([ viewConfig : [{ visible : 'is_mirror', elementId: 'mirror', - title: 'Mirror To', + title: 'Port Mirroring', view: "SectionView", viewConfig : { rows : [{ @@ -845,13 +845,13 @@ define([ }, { columns: [{ elementId: 'mirrorToAnalyzerName', - name: "Analyzer", + name: "Analyzer Name", view: "FormInputView", viewConfig: { path: 'mirrorToAnalyzerName', dataBindValue: 'mirrorToAnalyzerName', - placeholder: 'Analyzer', - label: 'Analyzer', + placeholder: 'Analyzer Name', + label: 'Analyzer Name', } }] }, { @@ -860,25 +860,25 @@ define([ name: "Analyzer IP Address", view: "FormInputView", viewConfig: { + class: "span6", path: 'mirrorToAnalyzerIpAddress', placeholder: 'xxx.xxx.xxx.xxx', dataBindValue: 'mirrorToAnalyzerIpAddress', label: 'Analyzer IP Address' } - }] - }, { - columns: [{ + }, { elementId: 'mirrorToUdpPort', name: "UDP Port", view: "FormInputView", viewConfig: { + class: "span6", path: 'mirrorToUdpPort', placeholder: '1 to 65535', dataBindValue: 'mirrorToUdpPort', label: 'UDP Port' } }] - }, { + },{ columns: [{ elementId: 'mirrorToRoutingInstance', name: "Routing Instance", diff --git a/webroot/config/networking/port/ui/js/views/portFormatters.js b/webroot/config/networking/port/ui/js/views/portFormatters.js index 185e1537d..c67ede5fd 100644 --- a/webroot/config/networking/port/ui/js/views/portFormatters.js +++ b/webroot/config/networking/port/ui/js/views/portFormatters.js @@ -359,10 +359,10 @@ define([ mirror += this.addTableRow(["Analyzer Name", " : ", temp]); temp = getValueByJsonPath(mirrorObj, "analyzer_ip_address", "-"); - mirror += this.addTableRow(["Analyzer IP Address", " : ", temp]); + var temp1 = getValueByJsonPath(mirrorObj, "udp_port", "-"); - temp = getValueByJsonPath(mirrorObj, "udp_port", "-"); - mirror += this.addTableRow(["UDP port", " : ", temp]); + mirror += this.addTableRow(["Analyzer IP Address", " : ", + temp + ", UDP port : " + temp1]); temp = getValueByJsonPath(mirrorObj, "routing_instance", "-"); if (temp != "") { @@ -507,11 +507,10 @@ define([ /* Create / Edit Security Group drop down data formatter */ - this.sgDDFormatter = function(response, edit, portModel) { + this.sgDDFormatter = function(response, edit, portEditView) { var sgList = []; var sg = response["security-groups"]; var responseLen = sg.length; - var defaultSelectedVal = []; var sgResponseVal = ""; for(var i = 0; i < responseLen; i++) { var sgResponse = getValueByJsonPath(sg[i], 'fq_name', ''); @@ -520,18 +519,9 @@ define([ var objArr = sgResponse; var text = ""; text = ctwu.formatCurrentFQName(sgResponse) - if(text == "default") { - defaultSelectedVal.push(sgResponseVal); - } sgList.push({value: sgResponseVal, text: text}); } } - portModel.sgDefaultValue = defaultSelectedVal - if(!edit) { - //portModel.model.is_sec_grp = true;//KO stops working if we put this - //portModel.model.is_sec_grp_disabled = false; - portModel.model.securityGroupValue(defaultSelectedVal); - } return sgList; }; /* diff --git a/webroot/config/networking/port/ui/js/views/portGridView.js b/webroot/config/networking/port/ui/js/views/portGridView.js index d2c14f935..371464e54 100644 --- a/webroot/config/networking/port/ui/js/views/portGridView.js +++ b/webroot/config/networking/port/ui/js/views/portGridView.js @@ -85,6 +85,8 @@ define([ dataItem.virtual_machine_interface_refs = virtualMachineInterfaceRefs; dataItem.is_sub_interface = true; dataItem.disable_sub_interface = true; + dataItem.securityGroupValue = portFormatters.getProjectFqn()+":default"; + dataItem.is_sec_grp = true; dataItem.virtual_machine_interface_properties = {}; dataItem.virtual_machine_interface_properties.sub_interface_vlan_tag = 'addSubInterface'; @@ -282,8 +284,10 @@ define([ "title": ctwl.TITLE_ADD_PORT, "iconClass": "icon-plus", "onClick": function () { - - var portModel = new PortModel(); + var dataItem = {}; + dataItem.securityGroupValue = portFormatters.getProjectFqn()+":default"; + dataItem.is_sec_grp = true; + var portModel = new PortModel(dataItem); portEditView.model = portModel; showHideModelAttrs(portModel); portEditView.renderPortPopup({ @@ -303,7 +307,10 @@ define([ function showHideModelAttrs(portModel) { portModel.is_sec_grp_disabled = ko.computed((function() { if(this.is_sec_grp() == true) { - this.securityGroupValue(portEditView.sgDefaultValue); + if (this.securityGroupValue() == "") { + var sgDefaultVal = [portFormatters.getProjectFqn()+":default"]; + this.securityGroupValue(sgDefaultVal); + } return false; } else { this.securityGroupValue([]); diff --git a/webroot/config/networking/port/ui/js/views/portListView.js b/webroot/config/networking/port/ui/js/views/portListView.js index 017ebbb4c..1d183808c 100644 --- a/webroot/config/networking/port/ui/js/views/portListView.js +++ b/webroot/config/networking/port/ui/js/views/portListView.js @@ -68,10 +68,10 @@ define([ return; } self.appendNewData(result); - self.portGetChunkCnt = 200; cbparam.allUUID = cbparam.allUUID.slice( self.portGetChunkCnt, cbparam.allUUID.length); + self.portGetChunkCnt = 200; if(cbparam.allUUID.length > 0) { //$("#"+ctwl.PORT_GRID_ID).data("contrailGrid").showGridMessage("loading"); self.fetchPortChunk(cbparam.allUUID, cbparam.cbparam); diff --git a/webroot/config/networking/routingpolicy/ui/js/views/routingPolicyEditView.js b/webroot/config/networking/routingpolicy/ui/js/views/routingPolicyEditView.js index bcb480cf3..caca7259f 100644 --- a/webroot/config/networking/routingpolicy/ui/js/views/routingPolicyEditView.js +++ b/webroot/config/networking/routingpolicy/ui/js/views/routingPolicyEditView.js @@ -165,7 +165,7 @@ define([ label:"Terms", path: "termCollection", validation: 'termValidation', - templateId: cowc.TMPL_COLLECTION_VIEW, + templateId: cowc.TMPL_EDITABLE_GRID_VIEW, collection: "termCollection", columns: [{ elementId: 'fromValue',