You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by is...@apache.org on 2013/07/25 02:35:36 UTC

git commit: updated refs/heads/4.2 to 4730e55

Updated Branches:
  refs/heads/4.2 60bc2cc28 -> 4730e5593


CLOUDSTACK-3700: The dedication process should be listed as a step through zone wizard


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

Branch: refs/heads/4.2
Commit: 4730e5593c71afe1e23297409c1b8029a8685bd7
Parents: 60bc2cc
Author: Isaac Chiang <is...@gmail.com>
Authored: Wed Jul 24 16:33:49 2013 +0800
Committer: Isaac Chiang <is...@gmail.com>
Committed: Thu Jul 25 08:34:39 2013 +0800

----------------------------------------------------------------------
 .../classes/resources/messages.properties       |   1 +
 ui/dictionary.jsp                               |   1 +
 ui/scripts/zoneWizard.js                        | 179 ++++++++++++++-----
 3 files changed, 138 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4730e559/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index e03647d..3e775e0 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1344,6 +1344,7 @@ message.creating.primary.storage=Creating primary storage
 message.creating.secondary.storage=Creating secondary storage
 message.creating.zone=Creating zone
 message.decline.invitation=Are you sure you want to decline this project invitation?
+message.dedicate.zone=Dedicating zone
 message.delete.account=Please confirm that you want to delete this account.
 message.delete.affinity.group=Please confirm that you would like to remove this affinity group.
 message.delete.gateway=Please confirm you want to delete the gateway

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4730e559/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index b048a67..eec0264 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1311,6 +1311,7 @@ dictionary = {
 'message.creating.secondary.storage': '<fmt:message key="message.creating.secondary.storage" />',
 'message.creating.zone': '<fmt:message key="message.creating.zone" />',
 'message.decline.invitation': '<fmt:message key="message.decline.invitation" />',
+'message.dedicate.zone': '<fmt:message key="message.dedicate.zone" />',
 'message.delete.account': '<fmt:message key="message.delete.account" />',
 'message.delete.affinity.group': '<fmt:message key="message.delete.affinity.group" />',
 'message.delete.gateway': '<fmt:message key="message.delete.gateway" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4730e559/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 7d7beb6..67f67d9 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -2099,33 +2099,33 @@
                                 })
                             });
 
-                            dedicatedZoneId = json.createzoneresponse.zone.id;
-                            //EXPLICIT ZONE DEDICATION
-                            if (args.data.pluginFrom == null && args.data.zone.ispublic != null) {
-                                var array2 = [];
-                                if (args.data.zone.domain != null)
-                                    array2.push("&domainid=" + args.data.zone.domain);
-                                if (args.data.zone.accountId != "")
-                                    array2.push("&account=" + todb(args.data.zone.accountId));
-
-                                if (dedicatedZoneId != null) {
-                                    $.ajax({
-                                        url: createURL("dedicateZone&ZoneId=" + dedicatedZoneId + array2.join("")),
-                                        dataType: "json",
-                                        success: function(json) {
-                                            var dedicatedObj = json.dedicatezoneresponse.jobid;
-                                            //args.response.success({ data: $.extend(item, dedicatedObj)});
-
-                                        },
-
-                                        error: function(json) {
-
-                                            args.response.error(parseXMLHttpResponse(XMLHttpResponse));
-                                        }
-                                    });
-
-                                }
-                            }
+                            // dedicatedZoneId = json.createzoneresponse.zone.id;
+                            // //EXPLICIT ZONE DEDICATION
+                            // if (args.data.pluginFrom == null && args.data.zone.ispublic != null) {
+                            //     var array2 = [];
+                            //     if (args.data.zone.domain != null)
+                            //         array2.push("&domainid=" + args.data.zone.domain);
+                            //     if (args.data.zone.accountId != "")
+                            //         array2.push("&account=" + todb(args.data.zone.accountId));
+
+                            //     if (dedicatedZoneId != null) {
+                            //         $.ajax({
+                            //             url: createURL("dedicateZone&ZoneId=" + dedicatedZoneId + array2.join("")),
+                            //             dataType: "json",
+                            //             success: function(json) {
+                            //                 var dedicatedObj = json.dedicatezoneresponse.jobid;
+                            //                 //args.response.success({ data: $.extend(item, dedicatedObj)});
+
+                            //             },
+
+                            //             error: function(json) {
+
+                            //                 args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                            //             }
+                            //         });
+
+                            //     }
+                            // }
 
                         },
                         error: function(XMLHttpResponse) {
@@ -4029,11 +4029,22 @@
                 },
 
                 addSecondaryStorage: function(args) {
+
+                    var dedicatedZone = (args.data.pluginFrom == null && args.data.zone.ispublic != null);
+
                 	if (args.data.secondaryStorage.provider == '') {
-                		 complete({
-                             data: args.data
-                         });
-                		return; //skip addSecondaryStorage if provider dropdown is blank
+
+                        if (dedicatedZone) {
+                            stepFns.dedicateZone({
+                                data: args.data
+                            });
+                        } else {
+                            complete({
+                                data: args.data
+                            })
+                        }
+
+                        return; //skip addSecondaryStorage if provider dropdown is blank
                 	}
                 	
                 	
@@ -4061,11 +4072,21 @@
                             url: createURL('addImageStore'),
                             data: data,
                             success: function(json) {
-                                complete({
-                                    data: $.extend(args.data, {
-                                        returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                
+                                if (dedicatedZone) {
+                                    stepFns.dedicateZone({
+                                        data: $.extend(args.data, {                                               
+                                            returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                        })
                                     })
-                                });
+                                } else {
+                                    complete({
+                                        data: $.extend(args.data, {
+                                            returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                        })
+                                    });
+                                }
+
                             },
                             error: function(XMLHttpResponse) {
                                 var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@@ -4113,11 +4134,20 @@
                             url: createURL('addImageStore'),
                             data: data,
                             success: function(json) {
-                                complete({
-                                    data: $.extend(args.data, {
-                                        returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                if (dedicatedZone) {
+                                    stepFns.dedicateZone({
+                                        data: $.extend(args.data, {                                               
+                                            returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                        })
                                     })
-                                });
+                                } else {
+                                    complete({
+                                        data: $.extend(args.data, {
+                                            returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                        })
+                                    });
+                                }
+                                
                             },
                             error: function(XMLHttpResponse) {
                                 var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@@ -4181,11 +4211,19 @@
                             url: createURL('addImageStore'),
                             data: data,
                             success: function(json) {
-                                complete({
-                                    data: $.extend(args.data, {
-                                        returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                if (dedicatedZone) {
+                                    stepFns.dedicateZone({
+                                        data: $.extend(args.data, {                                               
+                                            returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                        })
                                     })
-                                });
+                                } else {
+                                    complete({
+                                        data: $.extend(args.data, {
+                                            returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
+                                        })
+                                    });
+                                }
                             },
                             error: function(XMLHttpResponse) {
                                 var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@@ -4196,6 +4234,61 @@
                             }
                         });
                     }
+                },
+                dedicateZone: function(args) {
+
+                    if(args.data.pluginFrom == null && args.data.zone.ispublic != null) {
+                        var dedicatedZoneId = args.data.returnedZone.id;
+                	    message(dictionary['message.dedicate.zone']);
+
+                        var array2 = [];
+                        if (args.data.zone.domain != null)
+                            array2.push("&domainid=" + args.data.zone.domain);
+                        if (args.data.zone.accountId != "")
+                            array2.push("&account=" + todb(args.data.zone.accountId));
+
+                        if (dedicatedZoneId != null) {
+                            $.ajax({
+                                url: createURL("dedicateZone&ZoneId=" + dedicatedZoneId + array2.join("")),
+                                dataType: "json",
+                                success: function(json) {
+                                    var jobId = json.dedicatezoneresponse.jobid;
+                                    var dedicatedZoneIntervalId = setInterval(function() {
+                                        $.ajax({
+                                            url: createURL("queryAsyncJobResult&jobid=" + jobId),
+                                            dataType: "json",
+                                            success: function(json) {
+                                                if (json.queryasyncjobresultresponse.jobstatus == 0) { // not complete
+                                                    return;
+                                                } else {
+                                                    clearInterval(dedicatedZoneIntervalId);
+                                                    if(json.queryasyncjobresultresponse.jobstatus == 1) { // successed
+                                                        complete({
+                                                            data: $.extend(args.data, {
+                                                                returnedDedicateZone: json.queryasyncjobresultresponse.jobresult
+                                                            })
+                                                        });
+                                                    } else if(json.queryasyncjobresultresponse.jobstatus == 2) { // failed
+                                                        error('addZone', json.queryasyncjobresultresponse.jobresult.errortext, {
+                                                            fn: 'dedicateZone',
+                                                            args: args
+                                                        })
+                                                    }
+                                                }
+                                                
+                                            }
+                                        });
+                                    }, g_queryAsyncJobResultInterval);
+                                }
+                            });
+
+                        }
+                    } else {
+                        complete({
+                            data: args.data
+                        });
+                    }
+                    
                 }
             };