Преглед на файлове

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 години
родител
ревизия
a4aa66f075
променени са 3 файла, в които са добавени 48 реда и са изтрити 19 реда
  1. 25 2
      apps/oozie/src/oozie/templates/dashboard/rerun_coord_popup.mako
  2. 1 1
      desktop/core/static/css/hue3.css
  3. 22 16
      desktop/core/static/js/jquery.selector.js

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

@@ -25,6 +25,11 @@
 <form action="${ action }" method="POST">
   <div class="modal-header">
     <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>
   </div>
 
@@ -86,15 +91,17 @@
   $(document).ready(function(){
     var ViewModel = function() {
       var self = this;
+      self.isLoading = ko.observable(false);
+      self.actions = ko.observableArray([]);
     };
 
     window.viewModel = new ViewModel();
 
     $("#id_actions").jHueSelector({
-      selectAllLabel: "${_('Select all')}",
+      showSelectAll: false,
       searchPlaceholder: "${_('Search')}",
       noChoicesFound: "${_('No successful actions found.')}",
-      width:524,
+      width:558,
       height:200
     });
 
@@ -102,5 +109,21 @@
     $(".jHueSelectorBody ul li label").each(function(index) {
       $(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>

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

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

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

@@ -23,6 +23,7 @@
   var pluginName = "jHueSelector",
       defaults = {
         selectAllLabel: "Select all",
+        showSelectAll: true,
         searchPlaceholder: "Search",
         noChoicesFound: "No choices found for this element",
         width: 300,
@@ -104,24 +105,29 @@
       var header = $("<div>").addClass("jHueSelectorHeader");
       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).data("opt").removeAttr("selected");
           }
-        });
-        if (searchBox.val() != "") {
-          $(this).removeAttr("checked");
-        }
-        _this.options.onChange();
-      }).prependTo(selectAll);
+          _this.options.onChange();
+        }).prependTo(selectAll);
+      }
+
       selectAll.appendTo(header);
 
       var searchBox = $("<input>").attr("type", "text").attr("placeholder", this.options.searchPlaceholder).keyup(function () {