You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by tu...@apache.org on 2013/12/09 17:52:42 UTC

[16/21] git commit: updated refs/heads/master to 267ff79

fix UI


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

Branch: refs/heads/master
Commit: 32c55e6d0c80a80c110c13febab9661cb28de777
Parents: 015ab6a
Author: tuna <ng...@gmail.com>
Authored: Sat Oct 5 18:35:18 2013 +0700
Committer: tuna <ng...@gmail.com>
Committed: Mon Dec 9 23:33:15 2013 +0700

----------------------------------------------------------------------
 ui/scripts/zoneWizard.js | 94 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32c55e6d/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 000bed3..6c1c814 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -3022,6 +3022,100 @@
                                                         });
                                                         // ***** Virtual Router ***** (end) *****
 
+                                                         // ***** Ovs ***** (begin) *****
+                                                        var ovsProviderId =  null;
+                                                        $.ajax({
+                                                            url: createURL("listNetworkServiceProviders&name=Ovs&physicalNetworkId=" + thisPhysicalNetwork.id),
+                                                            dataType: "json",
+                                                            async: false,
+                                                            success: function (json) {
+                                                                var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
+                                                                if (items != null && items.length > 0) {
+                                                                    ovsProviderId = items[0].id;
+                                                                }
+                                                            }
+                                                        });
+                                                        if (ovsProviderId != null) {
+                                                            var ovsElementId = null;
+                                                            $.ajax({
+                                                                url: createURL("listOvsElements&nspid=" + ovsProviderId),
+                                                                dataType: "json",
+                                                                async: false,
+                                                                success: function (json) {
+                                                                    var items = json.listovselementsresponse.ovselement;
+                                                                    if (items != null && items.length > 0) {
+                                                                        ovsElementId = items[0].id;
+                                                                    }
+                                                                }
+                                                            });
+                                                            if (ovsElementId != null) {
+                                                                $.ajax({
+                                                                    url: createURL("configureOvsElement&enabled=true&id=" + ovsElementId),
+                                                                    dataType: "json",
+                                                                    async: false,
+                                                                    success: function (json) {
+                                                                        var jobId = json.configureovselementresponse.jobid;
+                                                                        var enableOvsElementIntervalID = setInterval(function () {
+                                                                            $.ajax({
+                                                                                url: createURL("queryAsyncJobResult&jobId=" + jobId),
+                                                                                dataType: "json",
+                                                                                success: function (json) {
+                                                                                    var result = json.queryasyncjobresultresponse;
+                                                                                    if (result.jobstatus == 0) {
+                                                                                        return; //Job has not completed
+                                                                                    } else {
+                                                                                        clearInterval(enableOvsElementIntervalID);
+
+                                                                                        if (result.jobstatus == 1) { //configureOvsElement succeeded
+                                                                                            $.ajax({
+                                                                                                url: createURL("updateNetworkServiceProvider&state=Enabled&id=" + ovsProviderId),
+                                                                                                dataType: "json",
+                                                                                                async: false,
+                                                                                                success: function (json) {
+                                                                                                    var jobId = json.updatenetworkserviceproviderresponse.jobid;
+                                                                                                    var enableOvsProviderIntervalID = setInterval(function () {
+                                                                                                        $.ajax({
+                                                                                                            url: createURL("queryAsyncJobResult&jobId=" + jobId),
+                                                                                                            dataType: "json",
+                                                                                                            success: function (json) {
+                                                                                                                var result = json.queryasyncjobresultresponse;
+                                                                                                                if (result.jobstatus == 0) {
+                                                                                                                    return; //Job has not completed
+                                                                                                                } else {
+                                                                                                                    clearInterval(enableOvsProviderIntervalID);
+
+                                                                                                                    if (result.jobstatus == 2) {
+                                                                                                                        alert("failed to enable Ovs Provider. Error: " + _s(result.jobresult.errortext));
+                                                                                                                    }
+                                                                                                                }
+                                                                                                            },
+                                                                                                            error: function (XMLHttpResponse) {
+                                                                                                                var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+                                                                                                                alert("updateNetworkServiceProvider failed. Error: " + errorMsg);
+                                                                                                            }
+                                                                                                        });
+                                                                                                    }, g_queryAsyncJobResultInterval);
+                                                                                                }
+                                                                                            });
+                                                                                        } else if (result.jobstatus == 2) {
+                                                                                            alert("configureOvsElement failed. Error: " + _s(result.jobresult.errortext));
+                                                                                        }
+                                                                                    }
+                                                                                },
+                                                                                error: function (XMLHttpResponse) {
+                                                                                    var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+                                                                                    alert("configureOvsElement failed. Error: " + errorMsg);
+                                                                                }
+                                                                            });
+                                                                        }, g_queryAsyncJobResultInterval);
+                                                                    }
+                                                                });
+                                                            }
+
+
+                                                        }
+                                                        // ***** Ovs ***** (end) *****
+
                                                         // ***** Internal LB ***** (begin) *****
                                                         var internalLbProviderId;
                                                         $.ajax({