cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/master to 08a7b28
Date Fri, 21 Jun 2013 21:05:42 GMT
Updated Branches:
  refs/heads/master 73c1a56c2 -> 08a7b2824


CLOUDSTACK-3123: UI > Infrastructure menu > Secondary Storage > Cache Storage: implement
Add NFS Cache Storage action.


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

Branch: refs/heads/master
Commit: 08a7b2824522ddb26912c412b764d471461c5a60
Parents: 73c1a56
Author: Jessica Wang <jessicawang@apache.org>
Authored: Fri Jun 21 14:04:16 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Fri Jun 21 14:04:16 2013 -0700

----------------------------------------------------------------------
 ui/scripts/system.js | 397 ++++------------------------------------------
 1 file changed, 32 insertions(+), 365 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/08a7b282/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 2265edf..71b913e 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -6895,22 +6895,20 @@
                     },
                     cacheStorage: {
                       listView: {
-                        dataProvider: function (args) {
+                        dataProvider: function (args) {                        
                           var searchByArgs = args.filterBy.search.value.length ?
                             '&name=' + args.filterBy.search.value : '';
 
-                          var data = {
-                            type: 'SecondaryStorage',
+                          var data = {                            
                             page: args.page,
-                            pageSize: pageSize,
-                            listAll: true
+                            pageSize: pageSize
                           };
 
                           $.ajax({
                             url: createURL('listCacheStores' + searchByArgs),
                             data: data,
                             success: function (json) {
-                              args.response.success({ data: json.listcachestoreresponse.cachestore
});
+                              args.response.success({ data: json.listcachestoreresponse.imagestore
});
                             },
                             error: function (json) {
                               args.response.error(parseXMLHttpResponse(json));
@@ -13430,7 +13428,8 @@
                 providername: { label: 'Provider' }
               },
 
-              dataProvider: function(args) {
+              /*
+              dataProvider: function(args) {  //being replaced with dataProvider in line
6898              
                 var array1 = [];
                 if(args.filterBy != null) {
                   if(args.filterBy.search != null && args.filterBy.search.by != null
&& args.filterBy.search.value != null) {
@@ -13457,139 +13456,16 @@
                   }
                 });
               },
+              */
 
               actions: {
                 add: {
-                  label: 'label.add.secondary.storage',
-
+                  label: 'Add NFS Cache Storage',
                   createForm: {
-                    title: 'label.add.secondary.storage',
-
-                    fields: {
-                      name: { label: 'label.name' },
-                      provider: {
-                        label: 'Provider',
-                        select: function(args){
-                          $.ajax({
-                            url: createURL('listStorageProviders'),
-                            data: {
-                              type: 'image'
-                            },
-                            success: function(json){
-                              var objs = json.liststorageprovidersresponse.dataStoreProvider;
-                              var items = [];
-                              if(objs != null) {
-                                for(var i = 0; i < objs.length; i++){
-                                  if(objs[i].name == 'NFS')
-                                    items.unshift({id: objs[i].name, description: objs[i].name});
-                                  else
-                                    items.push({id: objs[i].name, description: objs[i].name});
-                                }
-                              }
-                              args.response.success({
-                                data: items
-                              });
-
-                              args.$select.change(function() {
-                                var $form = $(this).closest('form');
-                                if($(this).val() == "NFS") {
-                                  //NFS
-                                  $form.find('.form-item[rel=zoneid]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=nfsServer]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=path]').css('display', 'inline-block');
-
-                                  //S3
-                                  $form.find('.form-item[rel=accesskey]').hide();
-                                  $form.find('.form-item[rel=secretkey]').hide();
-                                  $form.find('.form-item[rel=bucket]').hide();
-                                  $form.find('.form-item[rel=endpoint]').hide();
-                                  $form.find('.form-item[rel=usehttps]').hide();
-                                  $form.find('.form-item[rel=connectiontimeout]').hide();
-                                  $form.find('.form-item[rel=maxerrorretry]').hide();
-                                  $form.find('.form-item[rel=sockettimeout]').hide();
-
-                                  $form.find('.form-item[rel=createNfsCache]').find('input').removeAttr('checked');
-                                  $form.find('.form-item[rel=createNfsCache]').hide();
-                                  $form.find('.form-item[rel=nfsCacheZoneid]').hide();
-                                  $form.find('.form-item[rel=nfsCacheNfsServer]').hide();
-                                  $form.find('.form-item[rel=nfsCachePath]').hide();
-
-                                  //Swift
-                                  $form.find('.form-item[rel=url]').hide();
-                                  $form.find('.form-item[rel=account]').hide();
-                                  $form.find('.form-item[rel=username]').hide();
-                                  $form.find('.form-item[rel=key]').hide();
-                                }
-                                else if ($(this).val() == "S3") {
-                                  //NFS
-                                  $form.find('.form-item[rel=zoneid]').hide();
-                                  $form.find('.form-item[rel=nfsServer]').hide();
-                                  $form.find('.form-item[rel=path]').hide();
-
-                                  //S3
-                                  $form.find('.form-item[rel=accesskey]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=secretkey]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=bucket]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=endpoint]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=usehttps]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=connectiontimeout]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=maxerrorretry]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=sockettimeout]').css('display',
'inline-block');
-
-                                  $form.find('.form-item[rel=createNfsCache]').find('input').attr('checked','checked');
-                                  $form.find('.form-item[rel=createNfsCache]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=nfsCacheZoneid]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=nfsCacheNfsServer]').css('display',
'inline-block');
-                                  $form.find('.form-item[rel=nfsCachePath]').css('display',
'inline-block');
-
-
-                                  //Swift
-                                  $form.find('.form-item[rel=url]').hide();
-                                  $form.find('.form-item[rel=account]').hide();
-                                  $form.find('.form-item[rel=username]').hide();
-                                  $form.find('.form-item[rel=key]').hide();
-                                }
-                                else if($(this).val() == "Swift") {
-                                  //NFS
-                                  $form.find('.form-item[rel=zoneid]').hide();
-                                  $form.find('.form-item[rel=nfsServer]').hide();
-                                  $form.find('.form-item[rel=path]').hide();
-
-                                  //S3
-                                  $form.find('.form-item[rel=accesskey]').hide();
-                                  $form.find('.form-item[rel=secretkey]').hide();
-                                  $form.find('.form-item[rel=bucket]').hide();
-                                  $form.find('.form-item[rel=endpoint]').hide();
-                                  $form.find('.form-item[rel=usehttps]').hide();
-                                  $form.find('.form-item[rel=connectiontimeout]').hide();
-                                  $form.find('.form-item[rel=maxerrorretry]').hide();
-                                  $form.find('.form-item[rel=sockettimeout]').hide();
-
-                                  $form.find('.form-item[rel=createNfsCache]').find('input').removeAttr('checked');
-                                  $form.find('.form-item[rel=createNfsCache]').hide();
-                                  $form.find('.form-item[rel=nfsCacheZoneid]').hide();
-                                  $form.find('.form-item[rel=nfsCacheNfsServer]').hide();
-                                  $form.find('.form-item[rel=nfsCachePath]').hide();
-
-                                  //Swift
-                                  $form.find('.form-item[rel=url]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=account]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=username]').css('display', 'inline-block');
-                                  $form.find('.form-item[rel=key]').css('display', 'inline-block');
-                                }
-                              });
-
-                              args.$select.change();
-                            }
-                          });
-                        }
-                      },
-
-
-                      //NFS (begin)
+                    title: 'Add NFS Cache Storage',
+                    fields: {     
                       zoneid: {
-                        label: 'Zone',
-                        docID: 'helpSecondaryStorageZone',
+                        label: 'Zone',                        
                         validation: { required: true },
                         select: function(args) {
                           $.ajax({
@@ -13618,250 +13494,41 @@
                         }
                       },
                       nfsServer: {
-                        label: 'label.nfs.server',
-                        docID: 'helpSecondaryStorageNFSServer',
+                        label: 'label.nfs.server',                        
                         validation: { required: true }
                       },
                       path: {
-                        label: 'label.path',
-                        docID: 'helpSecondaryStoragePath',
-                        validation: { required: true }
-                      },
-                      //NFS (end)
-
-
-                      //S3 (begin)
-                      accesskey: { label: 'label.s3.access_key', validation: { required:
true } },
-                      secretkey: { label: 'label.s3.secret_key', validation: { required:
true} },
-                      bucket: { label: 'label.s3.bucket', validation: { required: true} },
-                      endpoint: { label: 'label.s3.endpoint' },
-                      usehttps: {
-                        label: 'label.s3.use_https',
-                        isEditable: true,
-                        isBoolean: true,
-                        isChecked: true,
-                        converter:cloudStack.converters.toBooleanText
-                      },
-                      connectiontimeout: { label: 'label.s3.connection_timeout' },
-                      maxerrorretry: { label: 'label.s3.max_error_retry' },
-                      sockettimeout: { label: 'label.s3.socket_timeout' },
-
-                      createNfsCache: {
-                        label: 'Create NFS Cache Storage',
-                        isBoolean: true,
-                        isChecked: true
-                      },
-                      nfsCacheZoneid: {
-                        dependsOn: 'createNfsCache',
-                        label: 'Zone',
-                        validation: { required: true },
-                        select: function(args) {
-                          $.ajax({
-                            url: createURL('listZones'),
-                            data: {
-                              listAll: true
-                            },
-                            success: function(json) {
-                              var zones = json.listzonesresponse.zone;
-
-                              if(zones != null){ //$.map(items, fn) - items can not be null
-                                args.response.success({
-                                  data: $.map(zones, function(zone) {
-                                    return {
-                                      id: zone.id,
-                                      description: zone.name
-                                    };
-                                  })
-                                });
-                              }
-                              else {
-                                args.response.success({data: null});
-                              }
-                            }
-                          });
-                        }
-                      },
-                      nfsCacheNfsServer: {
-                        dependsOn: 'createNfsCache',
-                        label: 'label.nfs.server',
+                        label: 'label.path',                        
                         validation: { required: true }
-                      },
-                      nfsCachePath: {
-                        dependsOn: 'createNfsCache',
-                        label: 'label.path',
-                        validation: { required: true }
-                      },
-                      //S3 (end)
-
-
-                      //Swift (begin)
-                      url: { label: 'label.url', validation: { required: true } },
-                      account: { label: 'label.account' },
-                      username: { label: 'label.username' },
-                      key: { label: 'label.key' }
-                      //Swift (end)
+                      }                      
                     }
                   },
-
-                  action: function(args) {
-                    var data = {};
-                    if(args.data.name != null && args.data.name.length > 0) {
-                      $.extend(data, {
-                        name: args.data.name
-                      });
-                    }
-
-                    if(args.data.provider == 'NFS') {
-                      var zoneid = args.data.zoneid;
-                      var nfs_server = args.data.nfsServer;
-                      var path = args.data.path;
-                      var url = nfsURL(nfs_server, path);
-
-                      $.extend(data, {
-                        provider: args.data.provider,
-                        zoneid: zoneid,
-                        url: url
-                      });
-
-                      $.ajax({
-                        url: createURL('addImageStore'),
-                        data: data,
-                        success: function(json) {
-                          var item = json.addimagestoreresponse.secondarystorage;
-                          args.response.success({
-                            data:item
-                          });
-                        },
-                        error: function(XMLHttpResponse) {
-                          var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-                          args.response.error(errorMsg);
-                        }
-                      });
-                    }
-                    else if(args.data.provider == 'S3') {
-                      $.extend(data, {
-                        provider: args.data.provider,
-                        'details[0].key': 'accesskey',
-                        'details[0].value': args.data.accesskey,
-                        'details[1].key': 'secretkey',
-                        'details[1].value': args.data.secretkey,
-                        'details[2].key': 'bucket',
-                        'details[2].value': args.data.bucket,
-                        'details[3].key': 'usehttps',
-                        'details[3].value': (args.data.usehttps != null && args.data.usehttps
== 'on' ? 'true' : 'false')
-                      });
-
-                      var index = 4;
-                      if(args.data.endpoint != null && args.data.endpoint.length
> 0){
-                        data['details[' + index.toString() + '].key'] = 'endpoint';
-                        data['details[' + index.toString() + '].value'] = args.data.endpoint;
-                        index++;
-                      }
-                      if(args.data.connectiontimeout != null && args.data.connectiontimeout.length
> 0){
-                        data['details[' + index.toString() + '].key'] = 'connectiontimeout';
-                        data['details[' + index.toString() + '].value'] = args.data.connectiontimeout;
-                        index++;
-                      }
-                      if(args.data.maxerrorretry != null && args.data.maxerrorretry.length
> 0){
-                        data['details[' + index.toString() + '].key'] = 'maxerrorretry';
-                        data['details[' + index.toString() + '].value'] = args.data.maxerrorretry;
-                        index++;
-                      }
-                      if(args.data.sockettimeout != null && args.data.sockettimeout.length
> 0){
-                        data['details[' + index.toString() + '].key'] = 'sockettimeout';
-                        data['details[' + index.toString() + '].value'] = args.data.sockettimeout;
-                        index++;
-                      }
-
-                      $.ajax({
-                        url: createURL('addImageStore'),
-                        data: data,
-                        success: function(json) {
-                          havingS3 = true;
-                          var item = json.addimagestoreresponse.secondarystorage;
-                          args.response.success({
-                            data:item
-                          });
-                        },
-                        error: function(json) {
-                          args.response.error(parseXMLHttpResponse(json));
-                        }
-                      });
-
-                      if(args.data.createNfsCache == 'on') {
-                        var zoneid = args.data.nfsCacheZoneid;
-                        var nfs_server = args.data.nfsCacheNfsServer;
-                        var path = args.data.nfsCachePath;
-                        var url = nfsURL(nfs_server, path);
-
-                        var nfsCacheData = {
-                          provider: 'NFS',
-                          zoneid: zoneid,
-                          url: url
-                        };
-
-                        $.ajax({
-                          url: createURL('createCacheStore'),
-                          data: nfsCacheData,
-                          success: function(json) {
-                            //do nothing
-                          },
-                          error: function(json) {
-                            args.response.error(parseXMLHttpResponse(json));
-                          }
-                        });
-                      }
-                    }
-                    else if(args.data.provider == 'Swift') {
-                      $.extend(data, {
-                        provider: args.data.provider,
-                        url: args.data.url
-                      });
-
-                      var index = 0;
-                      if(args.data.account != null && args.data.account.length >
0){
-                        data['details[' + index.toString() + '].key'] = 'account';
-                        data['details[' + index.toString() + '].value'] = args.data.account;
-                        index++;
-                      }
-                      if(args.data.username != null && args.data.username.length
> 0){
-                        data['details[' + index.toString() + '].key'] = 'username';
-                        data['details[' + index.toString() + '].value'] = args.data.username;
-                        index++;
-                      }
-                      if(args.data.key != null && args.data.key.length > 0){
-                        data['details[' + index.toString() + '].key'] = 'key';
-                        data['details[' + index.toString() + '].value'] = args.data.key;
-                        index++;
+                  action: function(args) {                       
+                    var data = {
+                      provider: 'NFS',
+                      zoneid: args.data.zoneid,
+                      url: nfsURL(args.data.nfsServer, args.data.path)
+                    };
+                    $.ajax({
+                      url: createURL('createCacheStore'),
+                      data: data,
+                      success: function(json) {                  
+                        var item = json.createcachestoreresponse.secondarystorage;
+                        args.response.success({ data: item });                        
+                      },
+                      error: function(json) {
+                        args.response.error(parseXMLHttpResponse(json));
                       }
-                      $.ajax({
-                        url: createURL('addImageStore'),
-                        data: data,
-                        success: function(json) {
-                          havingSwift = true;
-                          var item = json.addimagestoreresponse.secondarystorage;
-                          args.response.success({
-                            data:item
-                          });
-                        },
-                        error: function(json) {
-                          args.response.error(parseXMLHttpResponse(json));
-                        }
-                      });
-                    }
+                    });               
                   },
-
                   notification: {
                     poll: function(args) {
-                      args.complete({
-                        actionFilter: secondarystorageActionfilter
-                      });
+                      args.complete();
                     }
                   },
-
                   messages: {
                     notification: function(args) {
-                      return 'label.add.secondary.storage';
+                      return 'Add NFS Cache Storage';
                     }
                   }
                 }


Mime
View raw message