Skip to content

Commit 5acbaeb

Browse files
author
Jessica Wang
committed
CLOUDSTACK-4111: UI > IP Addresses page > Associate New IP dialog - show/hide cross zone dropdown upon new property "portableipserviceenabled" in listRegions API response.
1 parent d1b4a8d commit 5acbaeb

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

‎ui/scripts/network.js‎

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,21 +1994,30 @@
19941994
return true; //VPC section, show Acquire IP button
19951995
}
19961996
},
1997-
messages: {
1998-
/*
1999-
confirm: function(args) {
2000-
if(args.context.vpc)
2001-
return 'message.acquire.new.ip.vpc';
2002-
else
2003-
return 'message.acquire.new.ip';
2004-
},
2005-
*/
1997+
messages: {
20061998
notification: function(args) {
20071999
return 'label.acquire.new.ip';
20082000
}
20092001
},
20102002
createForm: {
20112003
title: 'label.acquire.new.ip',
2004+
desc: 'Please confirm that you want to acquire new IP',
2005+
preFilter: function(args) {
2006+
$.ajax({
2007+
url: createURL('listRegions'),
2008+
success: function(json) {
2009+
var items = json.listregionsresponse.region;
2010+
if(items != null) {
2011+
var region = items[0];
2012+
if(region.portableipserviceenabled == true) {
2013+
args.$form.find('.form-item[rel=isportable]').css('display', 'inline-block');
2014+
} else {
2015+
args.$form.find('.form-item[rel=isportable]').hide();
2016+
}
2017+
}
2018+
}
2019+
});
2020+
},
20122021
fields: {
20132022
isportable: {
20142023
label: 'label.cross.zones',
@@ -2025,14 +2034,19 @@
20252034
args.response.success({
20262035
data: items
20272036
});
2028-
}
2037+
},
2038+
isHidden: true
20292039
}
20302040
}
20312041
},
20322042
action: function(args) {
2033-
var dataObj = {
2034-
isportable: args.data.isportable
2035-
};
2043+
var dataObj = {};
2044+
if (args.$form.find('.form-item[rel=isportable]').css("display") != "none") {
2045+
$.extend(dataObj, {
2046+
isportable: args.data.isportable
2047+
});
2048+
}
2049+
20362050
if ('vpc' in args.context) { //from VPC section
20372051
$.extend(dataObj, {
20382052
vpcid: args.context.vpc[0].id

0 commit comments

Comments
 (0)