cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [23/50] [abbrv] git commit: updated refs/heads/vmsync to cd6aea1
Date Thu, 30 May 2013 00:04:17 GMT
CLOUDSTACK-2678: portable IP ranges - regions detailView - Portable IP Ranges - implement Add
Portable IP Range action.


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

Branch: refs/heads/vmsync
Commit: 78e50c3bc8f250f0ba72207e08aaeb553eafb4b0
Parents: 7ee71df
Author: Jessica Wang <jessicawang@apache.org>
Authored: Tue May 28 14:17:47 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Tue May 28 14:17:47 2013 -0700

----------------------------------------------------------------------
 ui/scripts/regions.js |   84 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 79 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78e50c3b/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
index e86fd28..5ca4167 100644
--- a/ui/scripts/regions.js
+++ b/ui/scripts/regions.js
@@ -463,9 +463,11 @@
           id: 'portableIpRanges',
           label: 'Portable IP Ranges',
           fields: {
-            name: { label: 'label.name' },
-            gslbdomainname: { label: 'GSLB Domain Name' },
-            gslblbmethod: { label: 'Algorithm' }
+            startip: { label: 'label.start.IP' },
+            endip: { label: 'label.end.IP' },
+            gateway: { label: 'label.gateway' },
+            netmask: { label: 'label.netmask' },
+            vlan: { label: 'label.vlan' }                    
           },
           dataProvider: function(args) {            
             $.ajax({
@@ -474,7 +476,7 @@
                 regionid: args.context.regions[0].id
               },
               success: function(json) {                
-                var items = json.listportableipresponse.portableip;
+                var items = json.listportableipresponse.portableiprange;
                 args.response.success({                
                   data: items
                 });
@@ -483,7 +485,79 @@
                 args.response.error(parseXMLHttpResponse(json));
               }
             });
-          }
+          },
+          actions: {
+            add: {
+              label: 'Add Portable IP Range',
+
+              messages: {               
+                notification: function(args) {
+                  return 'Add Portable IP Range';
+                }
+              },
+
+              createForm: {
+                title: 'Add Portable IP Range',
+                fields: {
+                  startip: {
+                    label: 'label.start.IP',                    
+                    validation: { required: true }
+                  },
+                  endip: {
+                    label: 'label.end.IP',                    
+                    validation: { required: true }
+                  },
+                  gateway: {
+                    label: 'label.gateway',                    
+                    validation: { required: true }
+                  },
+                  netmask: {
+                    label: 'label.netmask',                    
+                    validation: { required: true }
+                  },
+                  vlan: {
+                    label: 'label.vlan',                    
+                    validation: { required: false }
+                  }
+                }                
+              },     
+              action: function(args) {                
+                var data = {
+                  regionid: args.context.regions[0].id,
+                  startip: args.data.startip,
+                  endip: args.data.endip,
+                  gateway: args.data.gateway,
+                  netmask: args.data.netmask                      
+                };       
+                if(args.data.vlan != null && args.data.vlan.length > 0) {
+                  $.extend(data, {
+                    vlan: args.data.vlan
+                  })
+                }                  
+                $.ajax({
+                  url: createURL('createPortableIpRange'),
+                  data: data,                 
+                  success: function(json) {             
+                    var jid = json.createportableiprangeresponse.jobid;
+                    args.response.success({
+                      _custom: { 
+                        jobId: jid,
+                        getUpdatedItem: function(json) {                          
+                          return json.queryasyncjobresultresponse.jobresult.portableiprange;
+                        }
+                      }
+                    });                    
+                  },
+                  error: function(data) {
+                    args.response.error(parseXMLHttpResponse(data));
+                  }
+                });
+              },
+              notification: {
+                poll: pollAsyncJobResult
+              }    
+            }
+          }         
         }
       },      
             


Mime
View raw message