You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2012/07/21 00:46:32 UTC

git commit: cloudstack 3.0 UI - VPC - tier - implement "Add VM to tier" action.

Updated Branches:
  refs/heads/vpc 20db2e515 -> dc847ed83


cloudstack 3.0 UI - VPC - tier - implement "Add VM to tier" action.


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

Branch: refs/heads/vpc
Commit: dc847ed8320a707e7cadad212f31f878deb3e6a1
Parents: 20db2e5
Author: Jessica Wang <je...@citrix.com>
Authored: Fri Jul 20 15:44:45 2012 -0700
Committer: Jessica Wang <je...@citrix.com>
Committed: Fri Jul 20 15:44:45 2012 -0700

----------------------------------------------------------------------
 ui/index.jsp                           |    7 ++-
 ui/scripts/instanceWizard.js           |   63 +++++++++++++++++++--------
 ui/scripts/ui-custom/instanceWizard.js |    5 ++-
 ui/scripts/ui-custom/vpc.js            |    8 +++-
 4 files changed, 58 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dc847ed8/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index af05f4a..56afc5d 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -208,9 +208,10 @@
             <!-- Step 5: Network -->
             <div class="step network" wizard-step-id="network">
               <!-- 5a: Network description -->
-              <div class="wizard-step-conditional nothing-to-select">
-                <p><fmt:message key="message.zone.no.network.selection"/></p>
-                <p><fmt:message key="message.please.proceed"/></p>
+              <div class="wizard-step-conditional nothing-to-select">     
+								<p id="from_instance_page_1"><fmt:message key="message.zone.no.network.selection"/></p>
+								<p id="from_instance_page_2"><fmt:message key="message.please.proceed"/></p>
+								<p id="from_vpc_tier"></p>     										
               </div>
 
               <!-- 5b: Select network -->

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dc847ed8/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index 3cf6694..05a561e 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -14,6 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License. 
+
 (function($, cloudStack) {
   var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, community
   var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj; 
@@ -32,7 +33,18 @@
         async: false,
         success: function(json) {
           zoneObjs = json.listzonesresponse.zone;
-          args.response.success({ data: {zones: zoneObjs}});
+										
+					var items;
+					if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart
+					  items = $.grep(zoneObjs, function(zoneObj) {						  
+							return zoneObj.networktype == 'Advanced';
+						});
+					}
+			    else { //from Instance page 
+            items = zoneObjs;
+          }		         			
+					
+          args.response.success({ data: {zones: items}});
         }
       });
     },
@@ -237,8 +249,22 @@
         }
       }
 
-      if (selectedZoneObj.networktype == "Advanced") {  //Advanced zone. Show network list.
-        step5ContainerType = 'select-network';
+      if (selectedZoneObj.networktype == "Advanced") {  //Advanced zone. Show network list.	 
+				var $networkStep = $(".step.network:visible .nothing-to-select");		
+				if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart
+				  step5ContainerType = 'nothing-to-select'; 					
+					$networkStep.find("#from_instance_page_1").hide();		
+          $networkStep.find("#from_instance_page_2").hide();					
+					$networkStep.find("#from_vpc_tier").text("tier " + args.context.networks[0].name);					
+					$networkStep.find("#from_vpc_tier").show();					
+				}
+			  else { //from Instance page 
+          step5ContainerType = 'select-network';
+					$networkStep.find("#from_instance_page_1").show();		
+          $networkStep.find("#from_instance_page_2").show();
+					$networkStep.find("#from_vpc_tier").text("");			
+					$networkStep.find("#from_vpc_tier").hide();
+				}
       }
       else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network)
         var includingSecurityGroupService = false;
@@ -292,15 +318,18 @@
             networkObjs = json.listnetworksresponse.network ? json.listnetworksresponse.network : [];
           }
         });
-
-
-        var apiCmd = "listNetworkOfferings&guestiptype=Isolated&supportedServices=sourceNat&state=Enabled&specifyvlan=false&zoneid=" + args.currentData.zoneid ; 
-        var array1 = [];
-        var guestTrafficTypeTotal = 0;
-
+                  
         $.ajax({
-          url: createURL(apiCmd + array1.join("")), //get the network offering for isolated network with sourceNat
+          url: createURL("listNetworkOfferings"), 
           dataType: "json",
+					data: {
+						forvpc: false, 
+						zoneid: args.currentData.zoneid,
+						guestiptype: 'Isolated',
+						supportedServices: 'SourceNat',
+						specifyvlan: false,
+						state: 'Enabled'
+					},
           async: false,
           success: function(json) {
             networkOfferingObjs  = json.listnetworkofferingsresponse.networkoffering;
@@ -373,14 +402,6 @@
     }
     ],
     action: function(args) {
-/*
-var isValid = true;
-isValid &= validateString("Name", $thisPopup.find("#wizard_vm_name"), $thisPopup.find("#wizard_vm_name_errormsg"), true);   //optional
-isValid &= validateString("Group", $thisPopup.find("#wizard_vm_group"), $thisPopup.find("#wizard_vm_group_errormsg"), true); //optional
-if (!isValid)
-return;
-*/
-
       // Create a new VM!!!!
       var array1 = [];
 
@@ -473,7 +494,11 @@ return;
         if(checkedSecurityGroupIdArray.length > 0)
           array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(","));
       }
-
+      else if (step5ContainerType == 'nothing-to-select') {		
+				if(args.context.networks != null) //from VPC tier
+				  array1.push("&networkIds=" + args.context.networks[0].id);
+			}
+			
       var displayname = args.data.displayname;
       if(displayname != null && displayname.length > 0) {
         array1.push("&displayname="+todb(displayname));

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dc847ed8/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js
index 13719d4..ef65963 100644
--- a/ui/scripts/ui-custom/instanceWizard.js
+++ b/ui/scripts/ui-custom/instanceWizard.js
@@ -14,6 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+
 (function($, cloudStack) {
   /**
    * Instance wizard
@@ -166,7 +167,9 @@
         var dataProvider = function(step, providerArgs, callback) {
           // Call appropriate data provider
           args.steps[step - 1]($.extend(providerArgs, {
-            currentData: cloudStack.serializeForm($form)
+            currentData: cloudStack.serializeForm($form),
+						initArgs: args,
+						context: context
           }));
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dc847ed8/ui/scripts/ui-custom/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/vpc.js b/ui/scripts/ui-custom/vpc.js
index ab636a8..4de0acb 100644
--- a/ui/scripts/ui-custom/vpc.js
+++ b/ui/scripts/ui-custom/vpc.js
@@ -14,6 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License. 
+
 (function($, cloudStack) {
   var elems = {
     vpcConfigureTooltip: function(args) {
@@ -205,7 +206,10 @@
         $tier.addClass('placeholder');
         $title.html('Create Tier');
       } else {
-        $title.html(name);
+        $title.html(
+          cloudStack.concat(name, 8)
+        );
+        $title.attr('title', name);
         $cidr.html(cidr);
         $vmCount.append(
           $('<span>').addClass('total').html(virtualMachines != null? virtualMachines.length: 0),
@@ -463,7 +467,7 @@
           context: context
         })
       ).dialog({
-        title: 'Configure ACL for tier: ' + $tier.find('.title').html(),
+        title: 'Configure ACL for tier: ' + $tier.find('.title').attr('title'),
         dialogClass: 'configure-acl',
         width: 900,
         height: 600,