瀏覽代碼

AMBARI-1337. Refactor Job Browser filter. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1441689 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 年之前
父節點
當前提交
15d6769d88
共有 2 個文件被更改,包括 16 次插入57 次删除
  1. 2 0
      CHANGES.txt
  2. 14 57
      ambari-web/app/controllers/main/apps_controller.js

+ 2 - 0
CHANGES.txt

@@ -38,6 +38,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1337. Refactor Job Browser filter. (yusaku)
+
  AMBARI-1336. Externalize text to messages.js. (yusaku)
 
  AMBARI-1334. Show hosts that have failed install tasks as "red" to allow the user

+ 14 - 57
ambari-web/app/controllers/main/apps_controller.js

@@ -318,63 +318,20 @@ App.MainAppsController = Em.ArrayController.extend({
     createAppLink:function(){
       var link = "/jobhistory/datatable?";
 
-      if(this.sSearch_0){
-        link +=  "sSearch_0=" + this.sSearch_0 + "&";
-      }
-      if(this.sSearch_1){
-        link +=  "sSearch_1=" + this.sSearch_1 + "&";
-      }
-      if(this.sSearch_2 && this.sSearch_2 != "Any"){
-        link +=  "sSearch_2=" + this.sSearch_2 + "&";
-      }
-      if(this.sSearch_3){
-        link +=  "sSearch_3=" + this.sSearch_3 + "&";
-      }
-      if(this.minJobs){
-        link +=  "minJobs=" + this.minJobs + "&";
-      }
-      if(this.maxJobs){
-        link +=  "maxJobs=" + this.maxJobs + "&";
-      }
-      if(this.minInputBytes){
-        link +=  "minInputBytes=" + this.minInputBytes + "&";
-      }
-      if(this.maxInputBytes){
-        link +=  "maxInputBytes=" + this.maxInputBytes + "&";
-      }
-      if(this.minOutputBytes){
-        link +=  "minOutputBytes=" + this.minOutputBytes + "&";
-      }
-      if(this.maxOutputBytes){
-        link +=  "maxOutputBytes=" + this.maxOutputBytes + "&";
-      }
-      if(this.minDuration){
-        link +=  "minDuration=" + this.minDuration + "&";
-      }
-      if(this.maxDuration){
-        link +=  "maxDuration=" + this.maxDuration + "&";
-      }
-      if(this.minStartTime){
-        link +=  "minStartTime=" + this.minStartTime + "&";
-      }
-      if(this.maxStartTime){
-        link +=  "maxStartTime=" + this.maxStartTime + "&";
-      }
-      if(this.sSearch){
-        link +=  "sSearch=" + this.sSearch + "&";
-      }
-      if(this.iDisplayLength){
-        link +=  "iDisplayLength=" + this.iDisplayLength + "&";
-      }
-      if(this.iDisplayStart){
-        link +=  "iDisplayStart=" + this.iDisplayStart + "&";
-      }
-      if(this.iSortCol_0){
-        link +=  "iSortCol_0=" + this.iSortCol_0 + "&";
-      }
-      if(this.sSortDir_0){
-        link +=  "sSortDir_0=" + this.sSortDir_0 + "&";
-      }
+
+      var arr = [
+        "sSearch_0", "sSearch_1", "sSearch_2", "sSearch_3", "minJobs",
+        "maxJobs", "minInputBytes", "maxInputBytes", "minOutputBytes",
+        "maxOutputBytes", "minDuration", "maxDuration", "minStartTime",
+        "maxStartTime", "sSearch", "iDisplayLength", "iDisplayStart",
+        "iSortCol_0", "sSortDir_0"
+      ];
+
+      for (var n=0; n<arr.length;n++) {
+        if(this.get(arr[n])){
+          link += arr[n] + "=" + this.get(arr[n]) + "&";
+        }
+      };
 
       link = link.slice(0,link.length-1);