浏览代码

HUE-2241 [oozie] Bulk rerun failed coordinator actions

Modified jHueSelector plugin to exclude select all checkbox
Fixed close popup global css
Added status filters to the rerun coord modal
Enrico Berti 11 年之前
父节点
当前提交
a4aa66f

+ 25 - 2
apps/oozie/src/oozie/templates/dashboard/rerun_coord_popup.mako

@@ -25,6 +25,11 @@
 <form action="${ action }" method="POST">
 <form action="${ action }" method="POST">
   <div class="modal-header">
   <div class="modal-header">
     <a href="#" class="close" data-dismiss="modal">&times;</a>
     <a href="#" class="close" data-dismiss="modal">&times;</a>
+    <span class="btn-group pull-right" style="margin-right: 20px">
+      <a class="btn btn-status btn-success" data-value="success">${ _('Succeeded') }</a>
+      <a class="btn btn-status btn-warning" data-value="warning">${ _('Running') }</a>
+      <a class="btn btn-status btn-danger disable-feedback" data-value="important">${ _('Failed') }</a>
+    </span>
     <h3>${ _('Select actions to rerun') }</h3>
     <h3>${ _('Select actions to rerun') }</h3>
   </div>
   </div>
 
 
@@ -86,15 +91,17 @@
   $(document).ready(function(){
   $(document).ready(function(){
     var ViewModel = function() {
     var ViewModel = function() {
       var self = this;
       var self = this;
+      self.isLoading = ko.observable(false);
+      self.actions = ko.observableArray([]);
     };
     };
 
 
     window.viewModel = new ViewModel();
     window.viewModel = new ViewModel();
 
 
     $("#id_actions").jHueSelector({
     $("#id_actions").jHueSelector({
-      selectAllLabel: "${_('Select all')}",
+      showSelectAll: false,
       searchPlaceholder: "${_('Search')}",
       searchPlaceholder: "${_('Search')}",
       noChoicesFound: "${_('No successful actions found.')}",
       noChoicesFound: "${_('No successful actions found.')}",
-      width:524,
+      width:558,
       height:200
       height:200
     });
     });
 
 
@@ -102,5 +109,21 @@
     $(".jHueSelectorBody ul li label").each(function(index) {
     $(".jHueSelectorBody ul li label").each(function(index) {
       $(this).addClass($("#date-" + index).attr('class'));
       $(this).addClass($("#date-" + index).attr('class'));
     });
     });
+
+    $(".btn-status").on("click", function () {
+      $(this).toggleClass("active");
+      $(".btn-status.active").each(function (cnt, item) {
+        $(".jHueSelectorBody ul li .label-" + $(item).data("value")).find("input").prop("checked", true);
+        $(".jHueSelectorBody ul li .label-" + $(item).data("value")).find("input").each(function(icnt, option){
+          $(option).data("opt").prop("selected", true);
+        });
+      });
+      $(".btn-status:not(.active)").each(function (cnt, item) {
+        $(".jHueSelectorBody ul li .label-" + $(item).data("value")).find("input").prop("checked", false);
+        $(".jHueSelectorBody ul li .label-" + $(item).data("value")).find("input").each(function(icnt, option){
+          $(option).data("opt").prop("selected", false);
+        });
+      });
+    });
   });
   });
 </script>
 </script>

+ 1 - 1
desktop/core/static/css/hue3.css

@@ -1837,7 +1837,7 @@ input.no-margin, select.no-margin {
   font-weight: bold;
   font-weight: bold;
 }
 }
 
 
-form .modal-header .close {
+form.form-inline .modal-header .close {
   top: 0px;
   top: 0px;
   right: -11px;
   right: -11px;
 }
 }

+ 22 - 16
desktop/core/static/js/jquery.selector.js

@@ -23,6 +23,7 @@
   var pluginName = "jHueSelector",
   var pluginName = "jHueSelector",
       defaults = {
       defaults = {
         selectAllLabel: "Select all",
         selectAllLabel: "Select all",
+        showSelectAll: true,
         searchPlaceholder: "Search",
         searchPlaceholder: "Search",
         noChoicesFound: "No choices found for this element",
         noChoicesFound: "No choices found for this element",
         width: 300,
         width: 300,
@@ -104,24 +105,29 @@
       var header = $("<div>").addClass("jHueSelectorHeader");
       var header = $("<div>").addClass("jHueSelectorHeader");
       header.prependTo(selectorContainer);
       header.prependTo(selectorContainer);
 
 
-      var selectAll = $("<label>").text(this.options.selectAllLabel);
-      $("<input>").attr("type", "checkbox").change(function () {
-        var isChecked = $(this).is(":checked");
-        selectorContainer.find("input.selector:visible").each(function () {
-          if (isChecked) {
-            $(this).attr("checked", "checked");
-            $(this).data("opt").attr("selected", "selected");
-          }
-          else {
+      var selectAll = $("<label>").html("&nbsp;");
+
+      if (this.options.showSelectAll) {
+        selectAll.text(this.options.selectAllLabel);
+        $("<input>").attr("type", "checkbox").change(function () {
+          var isChecked = $(this).is(":checked");
+          selectorContainer.find("input.selector:visible").each(function () {
+            if (isChecked) {
+              $(this).attr("checked", "checked");
+              $(this).data("opt").attr("selected", "selected");
+            }
+            else {
+              $(this).removeAttr("checked");
+              $(this).data("opt").removeAttr("selected");
+            }
+          });
+          if (searchBox.val() != "") {
             $(this).removeAttr("checked");
             $(this).removeAttr("checked");
-            $(this).data("opt").removeAttr("selected");
           }
           }
-        });
-        if (searchBox.val() != "") {
-          $(this).removeAttr("checked");
-        }
-        _this.options.onChange();
-      }).prependTo(selectAll);
+          _this.options.onChange();
+        }).prependTo(selectAll);
+      }
+
       selectAll.appendTo(header);
       selectAll.appendTo(header);
 
 
       var searchBox = $("<input>").attr("type", "text").attr("placeholder", this.options.searchPlaceholder).keyup(function () {
       var searchBox = $("<input>").attr("type", "text").attr("placeholder", this.options.searchPlaceholder).keyup(function () {