You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/04/09 15:20:57 UTC

[20/50] [abbrv] git commit: updated refs/heads/marvin_refactor to 2a99064

CLOUDSTACK-452: cloudstack UI - Infrastructure menu - zone detail - guest network - add guest network - validation - Either IPv4 fields or IPv6 fields need to be filled when adding a guest network.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/48cd9cc7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/48cd9cc7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/48cd9cc7

Branch: refs/heads/marvin_refactor
Commit: 48cd9cc77ee688abe7f809af9a5b992a5e3a1af4
Parents: 70566dd
Author: Jessica Wang <je...@citrix.com>
Authored: Tue Mar 26 16:35:10 2013 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun Mar 31 22:05:19 2013 +0530

----------------------------------------------------------------------
 ui/scripts/system.js |  400 ++-------------------------------------------
 1 files changed, 14 insertions(+), 386 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48cd9cc7/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 9d6c476..31aef8f 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -1350,7 +1350,7 @@
 															  var $form = $(this).closest("form");
 																var selectedNetworkOfferingId = $(this).val();
 																$(networkOfferingObjs).each(function(){
-																  if(this.id == selectedNetworkOfferingId) {																		
+																  if(this.id == selectedNetworkOfferingId) {
 																		if(this.specifyvlan == false) {
 																		  $form.find('.form-item[rel=vlanId]').hide();
 																			cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=vlanId]'));	//make vlanId optional 	 	
@@ -1376,11 +1376,11 @@
                             docID: 'helpGuestNetworkZoneNetmask'
                           },
                           startipv4: { 
-							label: 'IPv4 Start IP', 							
+							label: 'IPv4 Start IP',
                             docID: 'helpGuestNetworkZoneStartIP'
 						  },
                           endipv4: { 
-							label: 'IPv4 End IP', 							
+							label: 'IPv4 End IP',
                             docID: 'helpGuestNetworkZoneEndIP'
 						  },
 						//IPv4 (end)
@@ -1394,11 +1394,11 @@
                             label: 'IPv6 CIDR'
                           },
                           startipv6: { 
-							label: 'IPv6 Start IP', 							
+							label: 'IPv6 Start IP',
                             docID: 'helpGuestNetworkZoneStartIP'
 						  },
                           endipv6: { 
-							label: 'IPv6 End IP', 							
+							label: 'IPv6 End IP',
                             docID: 'helpGuestNetworkZoneEndIP'
 						  },
 						//IPv6 (end)
@@ -1410,17 +1410,17 @@
                         }
                       },
 
-                      action: function(args) { //Add guest network in advanced zone											  
+                      action: function(args) { //Add guest network in advanced zone
 												if (
 													((args.data.ip4gateway.length == 0) && (args.data.ip4Netmask.length == 0) && (args.data.startipv4.length == 0) && (args.data.endipv4.length == 0))
-													&& 
+													&&
 													((args.data.ip6gateway.length == 0) && (args.data.ip6cidr.length == 0) && (args.data.startipv6.length == 0) && (args.data.endipv6.length == 0))
 												)
 												{
 												  args.response.error("Either IPv4 fields or IPv6 fields need to be filled when adding a guest network");
 													return;
 												}
-											
+
                         var $form = args.$form;
 
 												var array1 = [];
@@ -1481,13 +1481,13 @@
 												
 												//IPv6 (begin)
 											    if(args.data.ip6gateway != null && args.data.ip6gateway.length > 0)
-												  array1.push("&ip6gateway=" + args.data.ip6gateway);
+												  array1.push("&gateway=" + args.data.ip6gateway);
 												if(args.data.ip6cidr != null && args.data.ip6cidr.length > 0)
-												  array1.push("&ip6cidr=" + args.data.ip6cidr);
+												  array1.push("&netmask=" + args.data.ip6cidr);
 												if(($form.find('.form-item[rel=startipv6]').css("display") != "none") && (args.data.startipv6 != null && args.data.startipv6.length > 0))
-												  array1.push("&startipv6=" + args.data.startipv6);
+												  array1.push("&startip=" + args.data.startipv6);
 												if(($form.find('.form-item[rel=endipv6]').css("display") != "none") && (args.data.endipv6 != null && args.data.endipv6.length > 0))
-												  array1.push("&endipv6=" + args.data.endipv6);
+												  array1.push("&endip=" + args.data.endipv6);
 												//IPv6 (end)
 												
 												if(args.data.networkdomain != null && args.data.networkdomain.length > 0)
@@ -4109,199 +4109,6 @@
                 notification: { poll: pollAsyncJobResult }
               }
             }
-          },
-          // BigSwitch Vns provider detail view
-          bigswitchVns: {
-            type: 'detailView',
-            id: 'bigswitchVnsProvider',
-            label: 'label.bigswitchVns',
-            viewAll: { label: 'label.devices', path: '_zone.bigswitchVnsDevices' },
-            tabs: {
-              details: {
-                title: 'label.details',
-                fields: [
-                  {
-                    name: { label: 'label.name' }
-                  },
-                  {
-                    state: { label: 'label.state' }
-                  }
-                ],
-                dataProvider: function(args) {
-                  refreshNspData("BigSwitchVns");
-                  var providerObj;
-                  $(nspHardcodingArray).each(function(){
-                    if(this.id == "bigswitchVns") {
-                      providerObj = this;
-                      return false;
-                    }
-                  });
-                  args.response.success({
-                    data: providerObj,
-                    actionFilter: networkProviderActionFilter('bigswitchVns')
-                  });
-                }
-              }
-            },
-            actions: {
-              add: {
-                label: 'label.add.BigSwitchVns.device',
-                createForm: {
-                  title: 'label.add.BigSwitchVns.device',
-                  preFilter: function(args) {  },
-                  fields: {
-                    host: {
-                      label: 'label.ip.address'
-                    },
-                    numretries: {
-                      label: 'label.numretries',
-                      defaultValue: '2'
-                    },
-                  }
-                },
-                action: function(args) {
-                  if(nspMap["bigswitchVns"] == null) {
-                    $.ajax({
-                      url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
-                      dataType: "json",
-                      async: true,
-                      success: function(json) {
-                        var jobId = json.addnetworkserviceproviderresponse.jobid;
-                        var addBigSwitchVnsProviderIntervalID = setInterval(function() {
-                          $.ajax({
-                            url: createURL("queryAsyncJobResult&jobId="+jobId),
-                            dataType: "json",
-                            success: function(json) {
-                              var result = json.queryasyncjobresultresponse;
-                              if (result.jobstatus == 0) {
-                                return; //Job has not completed
-                              }
-                              else {
-                                clearInterval(addBigSwitchVnsProviderIntervalID);
-                                if (result.jobstatus == 1) {
-                                  nspMap["bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
-                                  addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
-                                }
-                                else if (result.jobstatus == 2) {
-                                  alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext));
-                                }
-                              }
-                            },
-                            error: function(XMLHttpResponse) {
-                              var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-                              alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg);
-                            }
-                          });
-                        }, 3000);
-                      }
-                    });
-                  }
-                  else {
-                    addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
-                  }
-                },
-                messages: {
-                  notification: function(args) {
-                    return 'label.add.BigSwitchVns.device';
-                  }
-                },
-                notification: {
-                  poll: pollAsyncJobResult
-                }
-              },
-              enable: {
-                label: 'label.enable.provider',
-                action: function(args) {
-                  $.ajax({
-                    url: createURL("updateNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id + "&state=Enabled"),
-                    dataType: "json",
-                    success: function(json) {
-                      var jid = json.updatenetworkserviceproviderresponse.jobid;
-                      args.response.success(
-                        {_custom:
-                          {
-                            jobId: jid,
-                            getUpdatedItem: function(json) {
-                              $(window).trigger('cloudStack.fullRefresh');
-                            }
-                          }
-                        }
-                      );
-                    }
-                  });
-                },
-                messages: {
-                  confirm: function(args) {
-                    return 'message.confirm.enable.provider';
-                  },
-                  notification: function() {
-                    return 'label.enable.provider';
-                  }
-                },
-                notification: { poll: pollAsyncJobResult }
-              },
-              disable: {
-                label: 'label.disable.provider',
-                action: function(args) {
-                  $.ajax({
-                    url: createURL("updateNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id + "&state=Disabled"),
-                    dataType: "json",
-                    success: function(json) {
-                      var jid = json.updatenetworkserviceproviderresponse.jobid;
-                      args.response.success(
-                        {_custom:
-                          {
-                            jobId: jid,
-                            getUpdatedItem: function(json) {
-                              $(window).trigger('cloudStack.fullRefresh');
-                            }
-                          }
-                        }
-                      );
-                    }
-                  });
-                },
-                messages: {
-                  confirm: function(args) {
-                    return 'message.confirm.disable.provider';
-                  },
-                  notification: function() {
-                    return 'label.disable.provider';
-                  }
-                },
-                notification: { poll: pollAsyncJobResult }
-              },
-              destroy: {
-                label: 'label.shutdown.provider',
-                action: function(args) {
-                  $.ajax({
-                    url: createURL("deleteNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id),
-                    dataType: "json",
-                    success: function(json) {
-                      var jid = json.deletenetworkserviceproviderresponse.jobid;
-                      args.response.success(
-                        {_custom:
-                         {
-                           jobId: jid
-                         }
-                        }
-                      );
-
-                      $(window).trigger('cloudStack.fullRefresh');
-                    }
-                  });
-                },
-                messages: {
-                  confirm: function(args) {
-                    return 'message.confirm.shutdown.provider';
-                  },
-                  notification: function(args) {
-                    return 'label.shutdown.provider';
-                  }
-                },
-                notification: { poll: pollAsyncJobResult }
-              }
-            }
           }          
         }
       }
@@ -7107,152 +6914,6 @@
           }
         }
       },
-      bigswitchVnsDevices: {
-        id: 'bigswitchVnsDevices',
-        title: 'label.devices',
-        listView: {
-          id: 'bigswitchVnsDevices',
-          fields: {
-            hostname: { label: 'label.bigswitch.controller.address' },
-          },
-          actions: {
-              add: {
-                label: 'label.add.BigSwitchVns.device',
-                createForm: {
-                  title: 'label.add.BigSwitchVns.device',
-                  preFilter: function(args) {  },
-                  fields: {
-                    host: {
-                      label: 'label.ip.address'
-                    },
-                    numretries: {
-                      label: 'label.numretries',
-                      defaultValue: '2'
-                    },
-                  }
-                },
-                action: function(args) {
-                  if(nspMap["bigswitchVns"] == null) {
-                    $.ajax({
-                      url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
-                      dataType: "json",
-                      async: true,
-                      success: function(json) {
-                        var jobId = json.addnetworkserviceproviderresponse.jobid;
-                        var addBigSwitchVnsProviderIntervalID = setInterval(function() {
-                          $.ajax({
-                            url: createURL("queryAsyncJobResult&jobId="+jobId),
-                            dataType: "json",
-                            success: function(json) {
-                              var result = json.queryasyncjobresultresponse;
-                              if (result.jobstatus == 0) {
-                                return;
-                              }
-                              else {
-                                clearInterval(addBigSwitchVnsProviderIntervalID);
-                                if (result.jobstatus == 1) {
-                                  nspMap["bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
-                                  addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
-                                }
-                                else if (result.jobstatus == 2) {
-                                  alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext));
-                                }
-                              }
-                            },
-                            error: function(XMLHttpResponse) {
-                              var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-                              alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg);
-                            }
-                          });
-                        }, 3000);
-                      }
-                    });
-                  }
-                  else {
-                      addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
-                  }
-                },
-
-              messages: {
-                notification: function(args) {
-                  return 'Added new BigSwitch Vns Controller';
-                }
-              },
-              notification: {
-                poll: pollAsyncJobResult
-              }
-            }
-          },
-          dataProvider: function(args) {
-            $.ajax({
-              url: createURL("listBigSwitchVnsDevices&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
-              data: { page: args.page, pageSize: pageSize },
-              dataType: "json",
-              async: false,
-              success: function(json) {
-                var items = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice;
-                args.response.success({data: items});
-              }
-            });
-          },
-          detailView: {
-            name: 'BigSwitch Vns details',
-            actions: {
-              'remove': {
-                label: 'label.delete.BigSwitchVns',
-                messages: {
-                  confirm: function(args) {
-                    return 'message.confirm.delete.BigSwitchVns';
-                  },
-                  notification: function(args) {
-                    return 'label.delete.BigSwitchVns';
-                  }
-                },
-                action: function(args) {
-                  $.ajax({
-                    url: createURL("deleteBigSwitchVnsDevice&vnsdeviceid=" + args.context.bigswitchvnsDevices[0].vnsdeviceid),
-                    dataType: "json",
-                    async: true,
-                    success: function(json) {
-                      var jid = json.deletebigswitchvnsdeviceresponse.jobid;
-                      args.response.success(
-                        {_custom:
-                         {jobId: jid}
-                        }
-                      );
-                    }
-                  });
-                },
-                notification: {
-                  poll: pollAsyncJobResult
-                }
-              }
-            },
-            tabs: {
-              details: {
-                title: 'label.details',
-                fields: [
-                  {
-                    vnsdeviceid: { label: 'label.id' },
-                    hostname: { label: 'label.ip.address' },
-                  }
-                ],
-                dataProvider: function(args) {
-                    $.ajax({
-                        url: createURL("listBigSwitchVnsDevices&vnsdeviceid=" + args.context.bigswitchVnsDevices[0].vnsdeviceid),
-                        dataType: "json",
-                        async: true,
-                        success: function(json) {
-                            var item = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice[0];
-                            args.response.success({data: item});
-                        }
-                    });
-                }
-              }
-            }
-          }
-        }
-      },
       pods: {
         title: 'label.pods',
         listView: {
@@ -9918,8 +9579,7 @@
                   url: createURL("createStoragePool" + array1.join("")),
                   dataType: "json",
                   success: function(json) {
-                    var item = json.createstoragepoolresponse.storagepool;
-                    
+                    var item = json.createstoragepoolresponse.storagepool[0];
                     args.response.success({
 										  data: item
 										});
@@ -10736,30 +10396,6 @@
     });
   }
 
-  function addBigSwitchVnsDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) {
-    var array1 = [];
-    array1.push("&physicalnetworkid=" + physicalNetworkObj.id);
-    array1.push("&hostname=" + todb(args.data.host));
-
-    $.ajax({
-      url: createURL(apiCmd + array1.join("")),
-      dataType: "json",
-      success: function(json) {
-        var jid = json[apiCmdRes].jobid;
-        args.response.success(
-          {_custom:
-           {jobId: jid,
-            getUpdatedItem: function(json) {
-              var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj];
-
-              return item;
-            }
-           }
-          }
-        );
-      }
-    });
-  }
 
 	var afterCreateZonePhysicalNetworkTrafficTypes = function(args, newZoneObj, newPhysicalnetwork) {
 		$.ajax({
@@ -11345,9 +10981,6 @@
                             case "NiciraNvp":
                                 nspMap["niciraNvp"] = items[i];
                                 break;
-                                                        case "BigSwitchVns":
-                                                                nspMap["bigswitchVns"] = items[i];
-                                                                break;
 						}
 					}
 				}
@@ -11369,12 +11002,7 @@
                 id: 'niciraNvp',
                 name: 'Nicira Nvp',
                 state: nspMap.niciraNvp ? nspMap.niciraNvp.state : 'Disabled'
-            },
-                        {
-                                id: 'bigswitchVns',
-                                name: 'BigSwitch Vns',
-                                state: nspMap.bigswitchVns ? nspMap.bigswitchVns.state : 'Disabled'
-                        }
+            }
 		];
 
 		if(selectedZoneObj.networktype == "Basic") {