incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: AMBARI-2668. Jobs page: All should not switch to Filtered after clicking next page. (Oleg Nechiporenko via yusaku)
Date Wed, 17 Jul 2013 18:24:55 GMT
Updated Branches:
  refs/heads/trunk 7f00dbc2c -> 6a7855c83


AMBARI-2668. Jobs page: All should not switch to Filtered after clicking next page. (Oleg
Nechiporenko via yusaku)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/6a7855c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/6a7855c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/6a7855c8

Branch: refs/heads/trunk
Commit: 6a7855c830bc6bda8c9468015332ddd3ef53a64b
Parents: 7f00dbc
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Wed Jul 17 11:24:39 2013 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Wed Jul 17 11:24:39 2013 -0700

----------------------------------------------------------------------
 .../app/controllers/main/apps_controller.js     | 16 ++++++-----
 ambari-web/app/views/main/apps_view.js          |  2 +-
 .../test/controllers/main/app_contoller_test.js | 28 +++++++++++++++++++-
 3 files changed, 37 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6a7855c8/ambari-web/app/controllers/main/apps_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/apps_controller.js b/ambari-web/app/controllers/main/apps_controller.js
index f7ab229..4a548ce 100644
--- a/ambari-web/app/controllers/main/apps_controller.js
+++ b/ambari-web/app/controllers/main/apps_controller.js
@@ -326,21 +326,23 @@ App.MainAppsController = Em.ArrayController.extend({
         "iSortCol_0", "sSortDir_0"
       ];
 
+      var notFilterFields = ["iDisplayLength", "iDisplayStart", "iSortCol_0", "sSortDir_0"];
+
+      var filtersUsed = false;
+
       for (var n=0; n<arr.length;n++) {
         if(this.get(arr[n])){
           link += arr[n] + "=" + this.get(arr[n]) + "&";
+          if (!notFilterFields.contains(arr[n])) {
+            filtersUsed = true;
+          }
         }
       };
 
       link = link.slice(0,link.length-1);
 
-      var valueInString=link.match(/&/g);
-
-      if(!this.get("viewTypeClickEvent"))
-      if(valueInString != null){
-        this.set("viewType","filtered");
-      }else{
-        this.set("viewType","all");
+      if(!this.get("viewTypeClickEvent")) {
+        this.set('viewType', filtersUsed?'filtered':'all');
       }
 
       return link;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6a7855c8/ambari-web/app/views/main/apps_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/apps_view.js b/ambari-web/app/views/main/apps_view.js
index e77dff4..a644667 100644
--- a/ambari-web/app/views/main/apps_view.js
+++ b/ambari-web/app/views/main/apps_view.js
@@ -275,7 +275,7 @@ App.MainAppsView = Em.View.extend({
         }
       });
     });
-    App.router.get('mainAppsItemController').set('lastJobId', null);
+    this.get('controller').set('lastJobId', null);
     this.onChangeViewType();
   },
   /**

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6a7855c8/ambari-web/test/controllers/main/app_contoller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/app_contoller_test.js b/ambari-web/test/controllers/main/app_contoller_test.js
index 9801b63..77308f0 100644
--- a/ambari-web/test/controllers/main/app_contoller_test.js
+++ b/ambari-web/test/controllers/main/app_contoller_test.js
@@ -177,9 +177,35 @@ describe('MainAppsController', function () {
            "&iDisplayStart=10" +
            "&iSortCol_0=1" +
            "&sSortDir_0=ASC");
-     })
+       expect(mainAppsController.get('filterObject.viewType')).to.equal('filtered');
+     });
+
+     it('should set viewType to "all" when set iDisplayLength, iDisplayStart, iSortCol_0,
sSortDir_0', function () {
+       mainAppsController.set("filterObject.sSearch_0", "");
+       mainAppsController.set("filterObject.sSearch_1", "");
+       mainAppsController.set("filterObject.sSearch_2", "");
+       mainAppsController.set("filterObject.sSearch_3", "");
+       mainAppsController.set("filterObject.minJobs", "");
+       mainAppsController.set("filterObject.maxJobs", "");
+       mainAppsController.set("filterObject.minInputBytes", "");
+       mainAppsController.set("filterObject.maxInputBytes", "");
+       mainAppsController.set("filterObject.minOutputBytes", "");
+       mainAppsController.set("filterObject.maxOutputBytes", "");
+       mainAppsController.set("filterObject.minDuration", "");
+       mainAppsController.set("filterObject.maxDuration", "");
+       mainAppsController.set("filterObject.minStartTime", "");
+       mainAppsController.set("filterObject.maxStartTime", "");
+       mainAppsController.set("filterObject.sSearch", "");
+       mainAppsController.set("filterObject.iDisplayLength", "10");
+       mainAppsController.set("filterObject.iDisplayStart", "10");
+       mainAppsController.set("filterObject.iSortCol_0", "1");
+       mainAppsController.set("filterObject.sSortDir_0", "ASC");
+       expect(mainAppsController.get('filterObject.viewType')).to.equal('all');
+     });
    });
 
 
+
+
  });
 


Mime
View raw message