cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [2/7] git commit: updated refs/heads/4.5-samlfixes to 69f39d5
Date Sat, 08 Aug 2015 19:06:58 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/17366f2b/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 700904d..5f898af 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -379,7 +379,10 @@
             },
 
             addPrimaryStorage: function(args) {
-                return args.data.localstorageenabled != 'on';
+                if(args.data.localstorageenabled == 'on' && args.data.localstorageenabledforsystemvm
== 'on') {
+                    return false; //skip step only when both localstorage and localstorage
for system vm are checked
+                }
+                return true;
             }
         },
 
@@ -665,23 +668,13 @@
                         label: 'label.local.storage.enabled',
                         isBoolean: true,
                         onChange: function(args) {
-                            var $checkbox = args.$checkbox;
-
-                            if ($checkbox.is(':checked')) {
-                                cloudStack.dialog.confirm({
-                                    message: 'message.zoneWizard.enable.local.storage',
-                                    action: function() {
-                                        $checkbox.attr('checked', true);
-                                    },
-                                    cancelAction: function() {
-                                        $checkbox.attr('checked', false);
-                                    }
-                                });
-
-                                return false;
-                            }
+                        }
+                    },
 
-                            return true;
+                    localstorageenabledforsystemvm: {
+                        label: 'label.local.storage.enabled.system.vms',
+                        isBoolean: true,
+                        onChange: function(args) {
                         }
                     }
                 }
@@ -2242,9 +2235,9 @@
             }
         },
 
-        action: function(args) {      	
-        	var $wizard = args.wizard;
-        	        	
+        action: function(args) {
+            var $wizard = args.wizard;
+            var formData = args.data;
             var advZoneConfiguredVirtualRouterCount = 0; //for multiple physical networks
in advanced zone. Each physical network has 2 virtual routers: regular one and VPC one.
 
             var success = args.response.success;
@@ -4419,29 +4412,50 @@
                         });
                     }
 
-                    $.ajax({
-                        url: createURL("addHost"),
-                        type: "POST",
-                        data: data,
-                        success: function(json) {
-                            stepFns.addPrimaryStorage({
-                                data: $.extend(args.data, {
-                                    returnedHost: json.addhostresponse.host[0]
-                                })
-                            });
-                        },
-                        error: function(XMLHttpResponse) {
-                            var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-                            error('addHost', errorMsg, {
-                                fn: 'addHost',
-                                args: args
-                            });
-                        }
-                    });
+                    var addHostAjax = function() {
+                        $.ajax({
+                            url: createURL("addHost"),
+                            type: "POST",
+                            data: data,
+                            success: function(json) {
+                                stepFns.addPrimaryStorage({
+                                    data: $.extend(args.data, {
+                                        returnedHost: json.addhostresponse.host[0]
+                                    })
+                                });
+                            },
+                            error: function(XMLHttpResponse) {
+                                var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+                                error('addHost', errorMsg, {
+                                    fn: 'addHost',
+                                    args: args
+                                });
+                            }
+                        });
+                    };
+
+                    if(args.data.zone.localstorageenabledforsystemvm == 'on') {
+                        $.ajax({
+                            url: createURL("updateConfiguration&name=system.vm.use.local.storage&value=true&zoneid="
+ args.data.returnedZone.id),
+                            dataType: "json",
+                            success: function(json) {
+                                addHostAjax();
+                            },
+                            error: function(XMLHttpResponse) {
+                               var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+                               error('addHost', errorMsg, {
+                                   fn: 'addHost',
+                                   args: args
+                               });
+                            }
+                        });
+                    } else {
+                        addHostAjax();
+                    }
                 },
 
                 addPrimaryStorage: function(args) {
-                    if (args.data.zone.localstorageenabled == 'on') { //use local storage,
don't need primary storage. So, skip this step.
+                    if (args.data.zone.localstorageenabled == 'on' && args.data.zone.localstorageenabledforsystemvm
== 'on') { //use local storage, don't need primary storage. So, skip
                         stepFns.addSecondaryStorage({
                             data: args.data
                         });


Mime
View raw message