From 94d5d3de50cd8d8e9de9703e5874d41a46466109 Mon Sep 17 00:00:00 2001 From: Pranav Saxena Date: Wed, 24 Apr 2013 12:40:38 +0530 Subject: [PATCH] CLOUDSTACK-2166:UI Support for remove Vlan for the non-contiguous vlan support --- ui/css/cloudstack3.css | 11 ++++++++++ ui/scripts/system.js | 46 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 1d5d72b48d2..1140d912058 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -11853,6 +11853,17 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it background-position: -37px -62px; } +.removeVlanRange .icon { + + background-position: 1px -92px; +} + +.removeVlanRange:hover .icon{ + + background-position: 1px -92px; +} + + .resize .icon, .updateResourceCount .icon { background-position: -167px -66px; diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 20580650a9e..4f5925c39d2 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1036,8 +1036,50 @@ notification:{poll:pollAsyncJobResult} - } + }, + removeVlanRange:{ + label:'Remove VLAN Range', + messages: { + confirm: function(args) { + return 'Are you sure you want to remove an existing VLAN Range from this guest network?'; + }, + notification: function(args) { + return 'VLAN Range removed'; + } + }, + + createForm:{ + title:'Remove VLAN Range', + fields:{ + startvlan: {label:'Vlan Start', validation:{required:true}}, + endvlan:{label:'Vlan End', validation:{required:true}} + } + + }, + + action:function(args){ + + var array1=[]; + if(args.data.startvlan != "" && args.data.endvlan != ""){ + array1.push("&removevlan=" + args.data.startvlan + "-" + args.data.endvlan); + } + $.ajax({ + url: createURL("updatePhysicalNetwork&id=" + selectedPhysicalNetworkObj.id + array1.join("")), + dataType: "json", + success: function(json) { + var jobId = json.updatephysicalnetworkresponse.jobid; + var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); + updateTrafficLabels(trafficType, args.data, function() { + args.response.success({ _custom: { jobId: jobId }}); + }); + } + }); + + }, + notification:{poll:pollAsyncJobResult} + + } }, @@ -1120,7 +1162,7 @@ args.response.success({ actionFilter: function() { - var allowedActions = ['edit' , 'addVlanRange']; + var allowedActions = ['edit' , 'addVlanRange','removeVlanRange']; return allowedActions; }, data: selectedPhysicalNetworkObj