Bläddra i källkod

[oozie] Move isSaving(false) to .always in the AJAX calls

Enrico Berti 10 år sedan
förälder
incheckning
e5e30da

+ 3 - 2
apps/oozie/src/oozie/static/oozie/js/bundle-editor.ko.js

@@ -99,7 +99,7 @@ var BundleEditorViewModel = function (bundle_json, coordinators_json, can_edit_j
 
 
   self.save = function () {
-    if (! self.isSaving()) {
+    if (!self.isSaving()) {
       self.isSaving(true);
       $.post("/oozie/editor/bundle/save/", {
         "bundle": ko.mapping.toJSON(self.bundle)
@@ -115,9 +115,10 @@ var BundleEditorViewModel = function (bundle_json, coordinators_json, can_edit_j
         else {
           $(document).trigger("error", data.message);
         }
-        self.isSaving(false);
       }).fail(function (xhr, textStatus, errorThrown) {
         $(document).trigger("error", xhr.responseText);
+      }).always(function () {
+        self.isSaving(false);
       });
     }
   };

+ 3 - 2
apps/oozie/src/oozie/static/oozie/js/coordinator-editor.ko.js

@@ -191,7 +191,7 @@ var CoordinatorEditorViewModel = function (coordinator_json, credentials_json, w
 
 
   self.save = function () {
-    if (! self.isSaving()) {
+    if (!self.isSaving()) {
       self.isSaving(true);
       $(".jHueNotify").hide();
       $.post("/oozie/editor/coordinator/save/", {
@@ -208,9 +208,10 @@ var CoordinatorEditorViewModel = function (coordinator_json, credentials_json, w
         else {
           $(document).trigger("error", data.message);
         }
-        self.isSaving(false);
       }).fail(function (xhr, textStatus, errorThrown) {
         $(document).trigger("error", xhr.responseText);
+      }).always(function () {
+        self.isSaving(false);
       });
     }
   };

+ 3 - 2
apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js

@@ -1027,7 +1027,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
   }
 
   self.save = function () {
-    if (! self.isSaving()) {
+    if (!self.isSaving()) {
       self.isSaving(true);
       $(".jHueNotify").hide();
       $.post("/oozie/editor/workflow/save/", {
@@ -1051,9 +1051,10 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
         else {
           $(document).trigger("error", data.message);
         }
-        self.isSaving(false);
       }).fail(function (xhr, textStatus, errorThrown) {
         $(document).trigger("error", xhr.responseText);
+      }).always(function () {
+        self.isSaving(false);
       });
     }
   };