CLOUDSTACK-1910: cloudstack UI - Regions menu - GSLB - (1) add detailView (2) 
implement Delete GSLB action.


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

Branch: refs/heads/internallb
Commit: 8bef069f01aaf1550b9cacb0363f04e5a01541ee
Parents: 202930f
Author: Jessica Wang <jessica.w...@citrix.com>
Authored: Tue Apr 16 12:38:00 2013 -0700
Committer: Jessica Wang <jessica.w...@citrix.com>
Committed: Tue Apr 16 12:38:37 2013 -0700

----------------------------------------------------------------------
 ui/scripts/regions.js |  139 ++++++++++++++++++++++++++++++++------------
 1 files changed, 102 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bef069f/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
index ec5e21b..2cfb0fe 100644
--- a/ui/scripts/regions.js
+++ b/ui/scripts/regions.js
@@ -246,8 +246,30 @@
                   },                                                           
        
                   description: {
                     label: 'label.description'  
-                  }, 
-                                                                       /*
+                  },   
+                  gslbdomainname: {
+                    label: 'GSLB Domain Name',
+                    validation: { required: true }                             
                                                
+                  },                   
+                                                                       
gslblbmethod: {                                 
+                                                                               
label: 'Algorithm',                                     
+                                                                               
select: function(args) {
+                                                                               
        var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 
'leastconn', description: 'leastconn'}, {id: 'proximity', description: 
'proximity'}];
+                                                                               
        args.response.success({
+                                                                               
                data: array1
+                                                                               
        });                                                                     
                                        
+                                                                               
}
+                                                                       },      
                                                                                
                                
+                                                                       
gslbservicetype: {                                      
+                                                                               
label: 'Service Type',                                  
+                                                                               
select: function(args) {
+                                                                               
        var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 
'udp'}];
+                                                                               
        args.response.success({
+                                                                               
                data: array1
+                                                                               
        });                                                                     
                                        
+                                                                               
},
+                                                                               
validation: { required: true }                          
+                                                                       },      
        
                                                                        
domainid: {                                     
                                                                                
label: 'Domain',                                        
                                                                                
select: function(args) {
@@ -293,31 +315,7 @@
                                                                                
        else
                                                                                
                return true;
                                                                                
}                       
-                                                                       },
-                                                                       */
-                                                                       
gslblbmethod: {                                 
-                                                                               
label: 'Algorithm',                                     
-                                                                               
select: function(args) {
-                                                                               
        var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 
'leastconn', description: 'leastconn'}, {id: 'proximity', description: 
'proximity'}];
-                                                                               
        args.response.success({
-                                                                               
                data: array1
-                                                                               
        });                                                                     
                                        
-                                                                               
}
-                                                                       },
-                                                                       
gslbdomainname: {
-                    label: 'GSLB Domain Name',
-                    validation: { required: true }                             
                                                
-                  },                                                           
-                                                                       
gslbservicetype: {                                      
-                                                                               
label: 'Service Type',                                  
-                                                                               
select: function(args) {
-                                                                               
        var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 
'udp'}];
-                                                                               
        args.response.success({
-                                                                               
                data: array1
-                                                                               
        });                                                                     
                                        
-                                                                               
},
-                                                                               
validation: { required: true }                          
-                                                                       }
+                                                                       }       
        
                 }
               },
               action: function(args) {                
@@ -330,23 +328,22 @@
                                                                        
gslbservicetype: args.data.gslbservicetype
                                                                };      
                 if(args.data.description != null && 
args.data.description.length > 0)
-                                                                 
$.extend(data, { description: args.data.description });  
-                /*                                                             
        
+                                                                 
$.extend(data, { description: args.data.description }); 
                 if(args.data.domainid != null && args.data.domainid.length > 0)
                                                                  
$.extend(data, { domainid: args.data.domainid });                               
                                              
                 if(args.data.account != null && args.data.account.length > 0)
                                                                  
$.extend(data, { account: args.data.account });   
-                                                               */      
+                                                               
                 $.ajax({
                   url: createURL('createGlobalLoadBalancerRule'),
                   data: data,                 
                   success: function(json) {            
-                                                                               
var jid = json.creategloballoadbalancerruleresponse.jobid;
+                                                                               
var jid = json.creategloballoadbalancerruleresponse.jobid;                      
                                                                      
                                                                                
args.response.success(
                                                                                
        {_custom:
                                                                                
         {jobId: jid,
-                                                                               
                getUpdatedItem: function(json) {                                
                                                                  
-                                                                               
                        return 
json.queryasyncjobresultresponse.jobresult.globalloadbalancerrule;
+                                                                               
                getUpdatedItem: function(json) {                                
                                                                          
+                                                                               
                        return 
json.queryasyncjobresultresponse.jobresult.globalloadbalancer;
                                                                                
                }
                                                                                
         }
                                                                                
        }
@@ -355,9 +352,7 @@
                 });
               },
               notification: {
-                poll: function(args) {
-                  poll: pollAsyncJobResult
-                }
+                poll: pollAsyncJobResult
               }
             }
           },
@@ -383,7 +378,77 @@
                 data: null
               });
             }
-          }
+          },
+                                                                               
+                                       detailView: {
+            name: 'GSLB details',
+            //viewAll: { path: 'storage.snapshots', label: 'label.snapshots' },
+            actions: {              
+                                                       remove: {
+                label: 'delete GSLB',
+                messages: {
+                  confirm: function(args) {
+                    return 'Please confirm you want to delete this GSLB';
+                  },
+                  notification: function(args) {
+                    return 'delete GSLB';
+                  }
+                },
+                action: function(args) {                                       
                          
+                                                                       var 
data = {
+                                                                         id: 
args.context.GSLB[0].id
+                                                                       };
+                  $.ajax({
+                    url: createURL("deleteGlobalLoadBalancerRule"),
+                    data: data,                    
+                    success: function(json) {                      
+                                                                               
        var jid = json.deletegloballoadbalancerruleresponse.jobid;
+                      args.response.success({
+                                                                               
          _custom: {
+                                                                               
                  jobId: jid
+                                                                               
                }
+                                                                               
        });                                                                     
                
+                    }
+                  });
+                },
+                notification: {
+                  poll: pollAsyncJobResult
+                }
+              }
+                                               },                              
                                                                
+                                               tabs: {
+              details: {
+                title: 'label.details',
+                fields: [
+                                                                {
+                                                                  name: { 
label: 'label.name' }
+                                                                },
+                 {                                                             
          
+                    description: { label: 'label.description' },
+                                                       gslbdomainname: { 
label: 'GSLB Domain Name' },
+                                                       gslblbmethod: { label: 
'Algorithm' },
+                    gslbservicetype: { label: 'Service Type' },                
                                                                
+                    id: { label: 'ID' }                                        
                                        
+                  }
+                ],
+                dataProvider: function(args) {                                 
                                  
+                                                                       var 
data = {
+                                                                               
id: args.context.GSLB[0].id
+                                                                       };
+                                                                       $.ajax({
+                                                                               
url: createURL('listGlobalLoadBalancerRules'),
+                                                                               
data: data,
+                                                                               
success: function(json) {                  
+                                                                               
        var item = 
json.listgloballoadbalancerrulesresponse.globalloadbalancerrule[0];
+                                                                               
        args.response.success({
+                                                                               
                data: item
+                                                                               
        });
+                                                                               
}
+                                                                       });     
                                                                
+                }
+              }
+            }                                          
+                                       }                                       
         }
       }
     }

Reply via email to