You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2012/11/29 01:01:18 UTC
[27/50] [abbrv] git commit: CLOUDSTACK-538: cloudstack UI - IP
Addresses page - Acquire New IP button - If it's under a Basic zone,
check whether its network offering is EIP ELB. If yes, show the button. If no,
hide the button.
CLOUDSTACK-538: cloudstack UI - IP Addresses page - Acquire New IP button - If it's under a Basic zone, check whether its network offering is EIP ELB. If yes, show the button. If no, hide the button.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7f40eef9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7f40eef9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7f40eef9
Branch: refs/heads/api_refactoring
Commit: 7f40eef9200cd6b799db7059b203f150500778e2
Parents: 17b11d7
Author: Jessica Wang <je...@citrix.com>
Authored: Mon Nov 26 13:51:02 2012 -0800
Committer: Jessica Wang <je...@citrix.com>
Committed: Mon Nov 26 13:52:19 2012 -0800
----------------------------------------------------------------------
ui/scripts/network.js | 81 +++++++++++++++++++++++++++++++++++---------
1 files changed, 65 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f40eef9/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 5458de1..e3bc110 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1272,26 +1272,76 @@
actions: {
add: {
label: 'label.acquire.new.ip',
- addRow: 'true',
- preFilter: function(args) {
- if('networks' in args.context) { //from Guest Network section
- if(args.context.networks[0].vpcid == null) { //if it's a non-VPC network, show Acquire IP button
+ addRow: 'true',
+ preFilter: function(args) {
+ var zoneObj;
+ $.ajax({
+ url: createURL('listZones'),
+ data: {
+ id: args.context.networks[0].zoneid
+ },
+ async: false,
+ success: function(json) {
+ zoneObj = json.listzonesresponse.zone[0];
+ }
+ });
+
+ if(zoneObj.networktype == 'Basic') {
+ var havingEIP = false, havingELB = false;
+ $.ajax({
+ url: createURL('listNetworkOfferings'),
+ data: {
+ id: args.context.networks[0].networkofferingid
+ },
+ async: false,
+ success: function(json) {
+ $(json.listnetworkofferingsresponse.networkoffering[0].service).each(function(){
+ var thisService = this;
+ if(thisService.name == "StaticNat") {
+ $(thisService.capability).each(function(){
+ if(this.name == "ElasticIp" && this.value == "true") {
+ havingEIP = true;
+ return false; //break $.each() loop
+ }
+ });
+ }
+ else if(thisService.name == "Lb") {
+ $(thisService.capability).each(function(){
+ if(this.name == "ElasticLb" && this.value == "true") {
+ havingELB = true;
+ return false; //break $.each() loop
+ }
+ });
+ }
+ });
+ }
+ });
+ if(havingEIP != true || havingELB != true) { //not EIP-ELB
+ return false; //acquire new IP is not allowed in non-EIP-ELB basic zone
+ }
+ }
+
+ //*** from Guest Network section ***
+ if('networks' in args.context) {
+ if(args.context.networks[0].vpcid == null){ //Guest Network section > non-VPC network, show Acquire IP button
return true;
+ }
+ else { //Guest Network section > VPC network, hide Acquire IP button
+ return false;
}
- else //if it's a VPC network, hide Acquire IP button
- return false;
- }
- else { //from VPC section
- return true; //show Acquire IP button
- }
- },
- messages: {
+ }
+ //*** from VPC section ***
+ else { //'vpc' in args.context
+ return true; //VPC section, show Acquire IP button
+ }
+ },
+ messages: {
confirm: function(args) {
if(args.context.vpc)
- return 'Please confirm that you would like to acquire a new IP for this VPC';
+ return 'message.acquire.new.ip.vpc';
else
- return 'message.acquire.new.ip';
- },
+ return 'message.acquire.new.ip';
+ },
notification: function(args) {
return 'label.acquire.new.ip';
}
@@ -2743,7 +2793,6 @@
},
async: false,
success: function(json) {
- //debugger;
if(json.listautoscalevmgroupsresponse.autoscalevmgroup != null && json.listautoscalevmgroupsresponse.autoscalevmgroup.length > 0) { //from 'autoScale' button
item._hideFields = ['add-vm'];
}