cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [24/50] [abbrv] git commit: updated refs/heads/vmsync to 6a1e1e8
Date Fri, 24 May 2013 01:14:48 GMT
Add base internal LB provider module


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

Branch: refs/heads/vmsync
Commit: 0a443697ea48d48310a24c5e25a2298522183901
Parents: 92ad6ab
Author: Brian Federle <bfederle@gmail.com>
Authored: Tue May 21 15:26:55 2013 -0700
Committer: Brian Federle <bfederle@gmail.com>
Committed: Tue May 21 15:26:59 2013 -0700

----------------------------------------------------------------------
 .../internalLbProvider/internalLbProvider.js       |  182 +++++++++++++++
 ui/modules/modules.js                              |    3 +-
 2 files changed, 184 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a443697/ui/modules/internalLbProvider/internalLbProvider.js
----------------------------------------------------------------------
diff --git a/ui/modules/internalLbProvider/internalLbProvider.js b/ui/modules/internalLbProvider/internalLbProvider.js
new file mode 100644
index 0000000..aaa386e
--- /dev/null
+++ b/ui/modules/internalLbProvider/internalLbProvider.js
@@ -0,0 +1,182 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+(function($, cloudStack) {
+  cloudStack.modules.internalLbProvider = function(module) {    
+    var internalLbDeviceViewAll = [
+      {
+        label: 'Devices',
+        path: '_zone.internalLbDevices'
+      }
+    ];
+
+    var internalLbListView = {
+      id: 'internalLbDevices',
+      fields: {
+        resourcename: { label: 'Resource Name' },
+        provider: { label: 'Provider' }
+      },      
+      dataProvider: function(args) {        
+        args.response.success({ data: [] });  
+      },    
+      actions: {
+        add: {
+          label: 'Add internal LB device',
+
+          messages: {           
+            notification: function(args) {
+              return 'Add internal LB device';
+            }
+          },
+
+          createForm: {
+            title: 'Add internal LB device',
+            fields: {
+              hostname: {
+                label: 'label.host',                
+                validation: { required: true }
+              },
+              username: {
+                label: 'label.username',                
+                validation: { required: true }
+              },
+              password: {
+                label: 'label.password', 
+                isPassword: true,
+                validation: { required: true }
+              }            
+            }
+          },
+
+          action: function(args) {
+            args.response.success();
+          },
+
+          notification: {
+            poll: function(args) {
+              args.complete();
+            }
+          }
+        }
+      },
+      
+      detailView: {
+        name: 'Internal LB resource details',
+        actions: {    
+          remove: {
+            label: 'delete Internal LB resource',
+            messages: {
+              confirm: function(args) {
+                return 'Please confirm you want to delete Internal LB resource';
+              },
+              notification: function(args) {
+                return 'delete Internal LB resource';
+              }
+            },
+            action: function(args) {                               
+              args.response.success();
+            },
+            notification: {
+              poll: function(args) {
+                args.complete();
+              }
+            }
+          }
+        },
+
+        tabs: {
+          details: {
+            title: 'label.details',            
+            fields: [
+             {
+               resourcename: { label: 'Resource Name' }
+             },
+             {   
+               resourceid: { label: 'Resource ID'},
+               provider: { label: 'Provider' },
+               RESOURCE_NAME: { label: 'Resource Name'}
+             }
+           ],
+           dataProvider: function(args) {   
+             args.response.success({ data: args.context.internalLbDevices[0] });   
+            }    
+          }
+        }
+      }       
+    };
+
+    var internalLbProviderDetailView = {
+      id: 'internalLbProvider',
+      label: 'internal LB',
+      viewAll: internalLbDeviceViewAll,
+      tabs: {
+        details: {
+          title: 'label.details',
+          fields: [
+            {
+              name: { label: 'label.name' }
+            },
+            {
+              state: { label: 'label.state' }, 
+              id: { label: 'label.id' },
+              servicelist: {
+                label: 'Services',
+                converter: function(args){  
+                  if(args)                  
+                    return args.join(', ');
+                  else
+                    return '';
+                }
+              }
+            }
+          ],
+          dataProvider: function(args) {            
+            $.ajax({
+              url: createURL('listNetworkServiceProviders'),
+              data: {
+                name: 'InternalLb',
+                physicalnetworkid: args.context.physicalNetworks[0].id   
+              },              
+              success: function(json){                  
+                var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
+                if(items != null && items.length > 0) {   
+                  args.response.success({ data: items[0] });                  
+                }
+                else {
+                  args.response.success({ 
+                    data: {
+                      name: 'InternalLb',
+                      state: 'Disabled'
+                    }
+                  })
+                }
+              }
+            });                 
+          }
+        }
+      }
+    };
+   
+    module.infrastructure.networkServiceProvider({
+      id: 'internalLb',
+      name: 'Internal LB',
+      //state: 'Disabled', //don't know state until log in and visit Infrastructure menu
> zone detail > physical network > network service providers
+      listView: internalLbListView,
+
+      detailView: internalLbProviderDetailView
+    });
+  };
+}(jQuery, cloudStack));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a443697/ui/modules/modules.js
----------------------------------------------------------------------
diff --git a/ui/modules/modules.js b/ui/modules/modules.js
index d4502a1..3170122 100644
--- a/ui/modules/modules.js
+++ b/ui/modules/modules.js
@@ -18,6 +18,7 @@
   cloudStack.modules = [
     'infrastructure',
     'vnmcNetworkProvider',
-    'vnmcAsa1000v'
+    'vnmcAsa1000v',
+    'internalLbProvider'
   ];
 }(jQuery, cloudStack));


Mime
View raw message