Updated Branches:
  refs/heads/ui-vpc-redesign bc7d7e64c -> a292bfbfc

CLOUDSTACK-747: UI - VPC tier - Public LB IP - populate listView of Public LB 
IP.


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

Branch: refs/heads/ui-vpc-redesign
Commit: a292bfbfcd8823d28c2f0f4b706be0d1ed9256f2
Parents: bc7d7e6
Author: Jessica Wang <jessicaw...@apache.org>
Authored: Thu May 23 11:53:25 2013 -0700
Committer: Jessica Wang <jessicaw...@apache.org>
Committed: Thu May 23 11:53:25 2013 -0700

----------------------------------------------------------------------
 ui/scripts/vpc.js |  119 +++++++++++------------------------------------
 1 files changed, 28 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a292bfbf/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index ae3001a..2183aba 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -587,100 +587,37 @@
         listView: {
           id: 'publicLbIps',
           fields: {
-            ipaddress: { label: 'label.ip.address' },
-            type: { label: 'label.type' }
-          },
-          dataProvider: function(args) {
-            args.response.success({
-              data: [
-                { ipaddress: '10.3.2.1', type: 'Internal' },
-                { ipaddress: '10.3.2.3', type: 'Internal' },
-                { ipaddress: '10.232.1.4', type: 'Public' }
-              ]
-            });
-          },
-          actions: {
-            add: {
-              label: 'Add Public LB',
-              createForm: {
-                title: 'Add Public LB',                
-                fields: {                                   
-                  name: { label: 'label.name', validation: { required: true } 
},
-                  description: { label: 'label.description', validation: { 
required: false } },
-                  sourceipaddress: { label: 'Source IP Address', validation: { 
required: false } },
-                  sourceport: { label: 'sourceport', validation: { required: 
true } },
-                  instanceport: { label: 'instanceport', validation: { 
required: true } },
-                  algorithm: { 
-                    label: 'label.algorithm',
-                    validation: { required: true },
-                    select: function(args) {
-                      args.response.success({
-                        data: [
-                          { id: 'source', description: 'source' },
-                          { id: 'roundrobin', description: 'roundrobin' },
-                          { id: 'leastconn', description: 'leastconn' }
-                        ]
-                      });
-                    }
-                  }                  
-                }
-              },
-              messages: {
-                notification: function(args) {
-                  return 'Add Public LB';
-                }
-              },
-              action: function(args) {               
-                var data = {
-                  name: args.data.name,
-                  sourceport: args.data.sourceport,
-                  instanceport: args.data.instanceport,
-                  algorithm: args.data.algorithm,
-                  networkid: args.context.networks[0].id,
-                  sourceipaddressnetworkid: args.context.networks[0].id,
-                  scheme: 'Public'
-                };
-                if(args.data.description != null && 
args.data.description.length > 0){
-                  $.extend(data, {
-                    description: args.data.description
-                  });                  
-                }
-                if(args.data.sourceipaddress != null && 
args.data.sourceipaddress.length > 0){
-                  $.extend(data, {
-                    sourceipaddress: args.data.sourceipaddress
-                  });                  
-                }                
-                $.ajax({
-                  url: createURL('createLoadBalancer'),
-                  data: data,
-                  success: function(json){                    
-                    var jid = json.createloadbalancerresponse.jobid;   
-                    args.response.success(
-                      {_custom:
-                       {jobId: jid,
-                        getUpdatedItem: function(json) {                       
   
-                          return 
json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
-                        }
-                       }
-                      }
-                    );    
-                  }
-                });
-                
-                args.response.success();
-              },
-              notification: {
-                poll: function(args) {
-                  args.complete({
-                    data: {
-                      ipaddress: '10.0.3.2',
-                      type: 'Internal'
-                    }
-                  });
+            ipaddress: {
+              label: 'label.ips',
+              converter: function(text, item) {
+                if (item.issourcenat) {
+                  return text + ' [' + _l('label.source.nat') + ']';
                 }
+
+                return text;
               }
+            },
+            zonename: { label: 'label.zone' },            
+            virtualmachinedisplayname: { label: 'label.vm.name' },
+            state: {
+              converter: function(str) {
+                // For localization
+                return str;
+              },
+              label: 'label.state', indicator: { 'Allocated': 'on', 
'Released': 'off' }
             }
-          }
+          },
+          dataProvider: function(args) {            
+            $.ajax({
+              url: createURL('listPublicIpAddresses'),
+              async: false,
+              data: { networkid: args.context.networks[0].id, 
forloadbalancing: true },
+              success: function(json) {
+                var items = json.listpublicipaddressesresponse;
+                args.response.success({ data: items });
+              }
+            });     
+          }          
         }
       },
       

Reply via email to