This is an automated email from the ASF dual-hosted git repository.

rafael pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 63094b2  Fix delete domain button in the UI to update only after job 
finishes (#2905)
63094b2 is described below

commit 63094b2fbf7a8ee7e6f4d109c9d33a155358eaa7
Author: Rafael Weingärtner <rafaelweingart...@gmail.com>
AuthorDate: Sun Nov 11 18:41:37 2018 -0200

    Fix delete domain button in the UI to update only after job finishes (#2905)
    
    When the “deleteDomain” command is sent via UI, the HTML is already updated 
assuming that the “deleteDomain” command will actually delete it. However, 
there are cases (domain with allocated resources) that will not allow ACS to 
remove the command; as a consequence, the UI will not be in sync with ACS 
state, which can lead to misunderstandings.
---
 ui/scripts/domains.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ui/scripts/domains.js b/ui/scripts/domains.js
index 1f65ff4..9e96f49 100644
--- a/ui/scripts/domains.js
+++ b/ui/scripts/domains.js
@@ -69,11 +69,23 @@
                                 async: false,
                                 success: function(json) {
                                     var jid = json.deletedomainresponse.jobid;
+                                    var wasDomainDeletedWithSuccess = false;
+                                    $.ajax({
+                                        url: 
createURL("queryAsyncJobResult&jobId=" + jid),
+                                        dataType: "json",
+                                        async: false,
+                                        success: function(json) {
+                                            wasDomainDeletedWithSuccess = 
json.queryasyncjobresultresponse.jobresultcode ==  0;
+                                        }
+                                    });
                                     args.response.success({
                                         _custom: {
                                             jobId: jid
                                         }
                                     });
+                                    if(!wasDomainDeletedWithSuccess){
+                                        return;
+                                    }
 
                                     // Quick fix for proper UI reaction to 
delete domain
                                     var $item = 
$('.name.selected').closest('li');

Reply via email to