You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2014/01/09 23:36:04 UTC

git commit: updated refs/heads/4.3 to 277b93c

Updated Branches:
  refs/heads/4.3 9a4a2911d -> 277b93c19


CLOUDSTACK-5840: UI > Snapshots > create volume from snapshot dialog > add zone dropdown if region-wide secondary storage exists.


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

Branch: refs/heads/4.3
Commit: 277b93c19cb315a1c2126bf9d3f7a4385fb359ea
Parents: 9a4a291
Author: Jessica Wang <je...@citrix.com>
Authored: Thu Jan 9 14:35:12 2014 -0800
Committer: Jessica Wang <je...@citrix.com>
Committed: Thu Jan 9 14:35:48 2014 -0800

----------------------------------------------------------------------
 ui/scripts/storage.js | 47 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/277b93c1/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 7c3bb2a..e4cfff3 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -1744,13 +1744,50 @@
                                 createForm: {
                                     title: 'label.action.create.volume',
                                     desc: '',
+                                    preFilter: function(args) {
+                                	    debugger;
+                                	    if (g_regionsecondaryenabled == true) {
+                                	    	args.$form.find('.form-item[rel=zoneid]').css('display', 'inline-block');
+                                	    } else {
+                                	    	args.$form.find('.form-item[rel=zoneid]').hide();
+                                	    }
+                                    },
                                     fields: {
                                         name: {
                                             label: 'label.name',
                                             validation: {
                                                 required: true
                                             }
-                                        }
+                                        },                                        
+                                        zoneid: {
+                                            label: 'label.availability.zone',  
+                                            isHidden: true,
+                                            select: function(args) {
+                                                $.ajax({
+                                                    url: createURL("listZones&available=true"),
+                                                    dataType: "json",
+                                                    async: true,
+                                                    success: function(json) {
+                                                        var zoneObjs = json.listzonesresponse.zone;                                                        
+                                                        var items = [{
+                                                            id: '',
+                                                            description: ''
+                                                        }];                                                        
+                                                        if (zoneObjs != null) {
+                                                        	for (i = 0; i < zoneObjs.length; i++) {
+                                                        		items.push({
+                                                        			id: zoneObjs[i].id,
+                                                        			description: zoneObjs[i].name
+                                                        		});
+                                                        	}
+                                                        }     
+                                                        args.response.success({                                                            
+                                                            data: items
+                                                        });
+                                                    }
+                                                });
+                                            }
+                                        }                                        
                                     }
                                 },
                                 action: function(args) {
@@ -1758,7 +1795,13 @@
                                         snapshotid: args.context.snapshots[0].id,
                                         name: args.data.name
                                     };
-
+                                    
+                                    if (args.$form.find('.form-item[rel=zoneid]').css("display") != "none" && args.data.zoneid != '') {                                    
+	                                    $.extend(data, {
+	                                    	zoneId: args.data.zoneid
+	                                    });   
+                                    }                                    
+                                    
                                     $.ajax({
                                         url: createURL('createVolume'),
                                         data: data,