Эх сурвалжийг харах

HUE-2161 [oozie] Kill job popup in dashboard should disable the ok button

Manual feedback trigger for workflows, coordinators and bundles
Enrico Berti 11 жил өмнө
parent
commit
44ad542b67

+ 6 - 2
apps/oozie/src/oozie/templates/dashboard/list_oozie_bundle.mako

@@ -78,7 +78,7 @@ ${ layout.menubar(section='bundles', dashboard=True) }
           <li class="white">
           <li class="white">
             <button title="${_('Kill %(bundle)s') % dict(bundle=oozie_bundle.id)}"
             <button title="${_('Kill %(bundle)s') % dict(bundle=oozie_bundle.id)}"
               id="kill-btn"
               id="kill-btn"
-              class="btn btn-small confirmationModal
+              class="btn btn-small btn-danger disable-feedback confirmationModal
                % if not oozie_bundle.is_running():
                % if not oozie_bundle.is_running():
                  hide
                  hide
                % endif
                % endif
@@ -289,7 +289,7 @@ ${ layout.menubar(section='bundles', dashboard=True) }
   </div>
   </div>
   <div class="modal-footer">
   <div class="modal-footer">
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
-    <a class="btn btn-danger" href="javascript:void(0);">${_('Yes')}</a>
+    <a class="btn btn-danger disable-feedback" href="javascript:void(0);">${_('Yes')}</a>
   </div>
   </div>
 </div>
 </div>
 
 
@@ -379,6 +379,8 @@ ${ layout.menubar(section='bundles', dashboard=True) }
       $("#confirmation").modal("show");
       $("#confirmation").modal("show");
       $("#confirmation a.btn-danger").click(function() {
       $("#confirmation a.btn-danger").click(function() {
         _this.trigger('confirmation');
         _this.trigger('confirmation');
+        $(this).attr("data-loading-text", $(this).text() + " ...");
+        $(this).button("loading");
       });
       });
     });
     });
 
 
@@ -389,6 +391,7 @@ ${ layout.menubar(section='bundles', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Problem: ') }" + response['data']);
             $(document).trigger("error", "${ _('Problem: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }
@@ -404,6 +407,7 @@ ${ layout.menubar(section='bundles', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }

+ 15 - 12
apps/oozie/src/oozie/templates/dashboard/list_oozie_bundles.mako

@@ -105,7 +105,7 @@ ${layout.menubar(section='bundles', dashboard=True)}
   </div>
   </div>
   <div class="modal-footer">
   <div class="modal-footer">
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
-    <a class="btn btn-danger" href="javascript:void(0);">${_('Yes')}</a>
+    <a class="btn btn-danger disable-feedback" href="javascript:void(0);">${_('Yes')}</a>
   </div>
   </div>
 </div>
 </div>
 
 
@@ -284,14 +284,15 @@ ${layout.menubar(section='bundles', dashboard=True)}
       _this.bind("confirmation", function () {
       _this.bind("confirmation", function () {
         var _this = this;
         var _this = this;
         $.post($(this).attr("data-url"),
         $.post($(this).attr("data-url"),
-                { "notification":$(this).attr("data-message") },
-                function (response) {
-                  if (response["status"] != 0) {
-                    $(document).trigger("error", "${ _('Problem: ') }" + response["data"]);
-                  } else {
-                    window.location.reload();
-                  }
-                }
+          { "notification":$(this).attr("data-message") },
+          function (response) {
+            if (response["status"] != 0) {
+              $(document).trigger("error", "${ _('Problem: ') }" + response["data"]);
+              $("#confirmation a.btn-danger").button("reset");
+            } else {
+              window.location.reload();
+            }
+          }
         );
         );
         return false;
         return false;
       });
       });
@@ -299,6 +300,8 @@ ${layout.menubar(section='bundles', dashboard=True)}
       $("#confirmation").modal("show");
       $("#confirmation").modal("show");
       $("#confirmation a.btn-danger").click(function () {
       $("#confirmation a.btn-danger").click(function () {
         _this.trigger("confirmation");
         _this.trigger("confirmation");
+        $(this).attr("data-loading-text", $(this).text() + " ...");
+        $(this).button("loading");
       });
       });
     });
     });
 
 
@@ -338,7 +341,7 @@ ${layout.menubar(section='bundles', dashboard=True)}
             var suspendCell = "";
             var suspendCell = "";
             var resumeCell = "";
             var resumeCell = "";
             if (bundle.canEdit) {
             if (bundle.canEdit) {
-              killCell = '<a class="btn btn-small confirmationModal" ' +
+              killCell = '<a class="btn btn-mini btn-danger disable-feedback confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + bundle.killUrl + '" ' +
                       'data-url="' + bundle.killUrl + '" ' +
                       'title="${ _('Kill') } ' + bundle.id + '"' +
                       'title="${ _('Kill') } ' + bundle.id + '"' +
@@ -346,7 +349,7 @@ ${layout.menubar(section='bundles', dashboard=True)}
                       'data-message="${ _('The bundle was killed!') }" ' +
                       'data-message="${ _('The bundle was killed!') }" ' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to kill this job?') }"' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to kill this job?') }"' +
                       '>${ _('Kill') }</a>';
                       '>${ _('Kill') }</a>';
-              suspendCell = '<a class="btn btn-small confirmationModal" ' +
+              suspendCell = '<a class="btn btn-mini confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + bundle.suspendUrl + '" ' +
                       'data-url="' + bundle.suspendUrl + '" ' +
                       'title="${ _('Suspend') } ' + bundle.id + '"' +
                       'title="${ _('Suspend') } ' + bundle.id + '"' +
@@ -354,7 +357,7 @@ ${layout.menubar(section='bundles', dashboard=True)}
                       'data-message="${ _('The bundle was suspended!') }" ' +
                       'data-message="${ _('The bundle was suspended!') }" ' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to suspend this job?') }"' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to suspend this job?') }"' +
                       '>${ _('Suspend') }</a>';
                       '>${ _('Suspend') }</a>';
-              resumeCell = '<a class="btn btn-small confirmationModal" ' +
+              resumeCell = '<a class="btn btn-mini confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + bundle.resumeUrl + '" ' +
                       'data-url="' + bundle.resumeUrl + '" ' +
                       'title="${ _('Resume') } ' + bundle.id + '"' +
                       'title="${ _('Resume') } ' + bundle.id + '"' +

+ 6 - 2
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinator.mako

@@ -80,7 +80,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
           <li class="white">
           <li class="white">
             <button title="${_('Kill %(coordinator)s') % dict(coordinator=oozie_coordinator.id)}"
             <button title="${_('Kill %(coordinator)s') % dict(coordinator=oozie_coordinator.id)}"
               id="kill-btn"
               id="kill-btn"
-              class="btn btn-small confirmationModal
+              class="btn btn-small btn-danger disable-feedback confirmationModal
                % if not oozie_coordinator.is_running():
                % if not oozie_coordinator.is_running():
                  hide
                  hide
                % endif
                % endif
@@ -342,7 +342,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
   </div>
   </div>
   <div class="modal-footer">
   <div class="modal-footer">
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
-    <a class="btn btn-danger" href="javascript:void(0);">${_('Yes')}</a>
+    <a class="btn btn-danger disable-feedback" href="javascript:void(0);">${_('Yes')}</a>
   </div>
   </div>
 </div>
 </div>
 
 
@@ -499,6 +499,8 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
       $("#confirmation").modal("show");
       $("#confirmation").modal("show");
       $("#confirmation a.btn-danger").click(function() {
       $("#confirmation a.btn-danger").click(function() {
         _this.trigger('confirmation');
         _this.trigger('confirmation');
+        $(this).attr("data-loading-text", $(this).text() + " ...");
+        $(this).button("loading");
       });
       });
     });
     });
 
 
@@ -509,6 +511,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Problem: ') }" + response['data']);
             $(document).trigger("error", "${ _('Problem: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }
@@ -524,6 +527,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }

+ 13 - 10
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinators.mako

@@ -118,7 +118,7 @@ ${layout.menubar(section='coordinators', dashboard=True)}
   </div>
   </div>
   <div class="modal-footer">
   <div class="modal-footer">
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
-    <a class="btn btn-danger" href="javascript:void(0);">${_('Yes')}</a>
+    <a class="btn btn-danger disable-feedback" href="javascript:void(0);">${_('Yes')}</a>
   </div>
   </div>
 </div>
 </div>
 
 
@@ -314,14 +314,15 @@ ${layout.menubar(section='coordinators', dashboard=True)}
       _this.bind("confirmation", function () {
       _this.bind("confirmation", function () {
         var _this = this;
         var _this = this;
         $.post($(this).attr("data-url"),
         $.post($(this).attr("data-url"),
-                { "notification":$(this).attr("data-message") },
-                function (response) {
-                  if (response["status"] != 0) {
-                    $(document).trigger("error", "${ _('Problem: ') }" + response["data"]);
-                  } else {
-                    window.location.reload();
-                  }
-                }
+          { "notification":$(this).attr("data-message") },
+          function (response) {
+            if (response["status"] != 0) {
+              $(document).trigger("error", "${ _('Problem: ') }" + response["data"]);
+              $("#confirmation a.btn-danger").button("reset");
+            } else {
+              window.location.reload();
+            }
+          }
         );
         );
         return false;
         return false;
       });
       });
@@ -329,6 +330,8 @@ ${layout.menubar(section='coordinators', dashboard=True)}
       $("#confirmation").modal("show");
       $("#confirmation").modal("show");
       $("#confirmation a.btn-danger").click(function () {
       $("#confirmation a.btn-danger").click(function () {
         _this.trigger("confirmation");
         _this.trigger("confirmation");
+        $(this).attr("data-loading-text", $(this).text() + " ...");
+        $(this).button("loading");
       });
       });
     });
     });
 
 
@@ -373,7 +376,7 @@ ${layout.menubar(section='coordinators', dashboard=True)}
             var suspendCell = "";
             var suspendCell = "";
             var resumeCell = "";
             var resumeCell = "";
             if (coord.canEdit) {
             if (coord.canEdit) {
-              killCell = '<a class="btn btn-small confirmationModal" ' +
+              killCell = '<a class="btn btn-mini btn-danger disable-feedback confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + coord.killUrl + '" ' +
                       'data-url="' + coord.killUrl + '" ' +
                       'title="${ _('Kill') } ' + coord.id + '"' +
                       'title="${ _('Kill') } ' + coord.id + '"' +

+ 8 - 3
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow.mako

@@ -85,7 +85,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
               <li class="white">
               <li class="white">
                 <button title="${_('Kill %(workflow)s') % dict(workflow=oozie_workflow.id)}"
                 <button title="${_('Kill %(workflow)s') % dict(workflow=oozie_workflow.id)}"
                    id="kill-btn"
                    id="kill-btn"
-                   class="btn btn-small confirmationModal
+                   class="btn btn-small btn-danger disable-feedback confirmationModal
                    % if not oozie_workflow.is_running():
                    % if not oozie_workflow.is_running():
                      hide
                      hide
                    % endif
                    % endif
@@ -342,7 +342,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
   </div>
   </div>
   <div class="modal-footer">
   <div class="modal-footer">
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
-    <a class="btn btn-danger" href="javascript:void(0);">${_('Yes')}</a>
+    <a class="btn btn-danger disable-feedback" href="javascript:void(0);">${_('Yes')}</a>
   </div>
   </div>
 </div>
 </div>
 
 
@@ -513,8 +513,10 @@ ${ layout.menubar(section='workflows', dashboard=True) }
       var _this = $(this);
       var _this = $(this);
       $("#confirmation .message").text(_this.data("confirmation-message"));
       $("#confirmation .message").text(_this.data("confirmation-message"));
       $("#confirmation").modal("show");
       $("#confirmation").modal("show");
-      $("#confirmation a.btn-danger").click(function() {
+      $("#confirmation a.btn-danger").on("click", function() {
         _this.trigger('confirmation');
         _this.trigger('confirmation');
+        $(this).attr("data-loading-text", $(this).text() + " ...");
+        $(this).button("loading");
       });
       });
     });
     });
 
 
@@ -525,6 +527,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }
@@ -540,6 +543,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }
@@ -555,6 +559,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         function(response) {
         function(response) {
           if (response['status'] != 0) {
           if (response['status'] != 0) {
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
             $(document).trigger("error", "${ _('Error: ') }" + response['data']);
+            $("#confirmation a.btn-danger").button("reset");
           } else {
           } else {
             window.location.reload();
             window.location.reload();
           }
           }

+ 16 - 13
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflows.mako

@@ -111,7 +111,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
   </div>
   </div>
   <div class="modal-footer">
   <div class="modal-footer">
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
     <a href="#" class="btn" data-dismiss="modal">${_('No')}</a>
-    <a class="btn btn-danger" href="javascript:void(0);">${_('Yes')}</a>
+    <a class="btn btn-danger disable-feedback" href="javascript:void(0);">${_('Yes')}</a>
   </div>
   </div>
 </div>
 </div>
 
 
@@ -291,21 +291,24 @@ ${ layout.menubar(section='workflows', dashboard=True) }
       _this.bind("confirmation", function () {
       _this.bind("confirmation", function () {
         var _this = this;
         var _this = this;
         $.post($(this).attr("data-url"),
         $.post($(this).attr("data-url"),
-                { "notification":$(this).attr("data-message") },
-                function (response) {
-                  if (response["status"] != 0) {
-                    $(document).trigger("error", "${ _('Problem: ') }" + response["data"]);
-                  } else {
-                    window.location.reload();
-                  }
-                }
+          { "notification":$(this).attr("data-message") },
+          function (response) {
+            if (response["status"] != 0) {
+              $(document).trigger("error", "${ _('Problem: ') }" + response["data"]);
+              $("#confirmation a.btn-danger").button("reset");
+            } else {
+              window.location.reload();
+            }
+          }
         );
         );
         return false;
         return false;
       });
       });
       $("#confirmation .message").text(_this.attr("data-confirmation-message"));
       $("#confirmation .message").text(_this.attr("data-confirmation-message"));
       $("#confirmation").modal("show");
       $("#confirmation").modal("show");
-      $("#confirmation a.btn-danger").click(function () {
+      $("#confirmation a.btn-danger").on("click", function () {
         _this.trigger("confirmation");
         _this.trigger("confirmation");
+        $(this).attr("data-loading-text", $(this).text() + " ...");
+        $(this).button("loading");
       });
       });
     });
     });
 
 
@@ -345,7 +348,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
             var suspendCell = "";
             var suspendCell = "";
             var resumeCell = "";
             var resumeCell = "";
             if (wf.canEdit) {
             if (wf.canEdit) {
-              killCell = '<a class="btn btn-small confirmationModal" ' +
+              killCell = '<a class="btn btn-mini btn-danger disable-feedback confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + wf.killUrl + '" ' +
                       'data-url="' + wf.killUrl + '" ' +
                       'title="${ _('Kill') } ' + wf.id + '"' +
                       'title="${ _('Kill') } ' + wf.id + '"' +
@@ -353,7 +356,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
                       'data-message="${ _('The workflow was killed!') }" ' +
                       'data-message="${ _('The workflow was killed!') }" ' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to kill this job?') }"' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to kill this job?') }"' +
                       '>${ _('Kill') }</a>';
                       '>${ _('Kill') }</a>';
-              suspendCell = '<a class="btn btn-small confirmationModal" ' +
+              suspendCell = '<a class="btn btn-mini confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + wf.suspendUrl + '" ' +
                       'data-url="' + wf.suspendUrl + '" ' +
                       'title="${ _('Suspend') } ' + wf.id + '"' +
                       'title="${ _('Suspend') } ' + wf.id + '"' +
@@ -361,7 +364,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
                       'data-message="${ _('The workflow was suspended!') }" ' +
                       'data-message="${ _('The workflow was suspended!') }" ' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to suspend this job?') }"' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to suspend this job?') }"' +
                       '>${ _('Suspend') }</a>';
                       '>${ _('Suspend') }</a>';
-              resumeCell = '<a class="btn btn-small confirmationModal" ' +
+              resumeCell = '<a class="btn btn-mini confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + wf.resumeUrl + '" ' +
                       'data-url="' + wf.resumeUrl + '" ' +
                       'title="${ _('Resume') } ' + wf.id + '"' +
                       'title="${ _('Resume') } ' + wf.id + '"' +