tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject tez git commit: TEZ-3214. Tez UI 2: Pagination in All DAGs (sree)
Date Fri, 15 Apr 2016 06:28:12 GMT
Repository: tez
Updated Branches:
  refs/heads/master 4675a651f -> 82793ff9d


TEZ-3214. Tez UI 2: Pagination in All DAGs (sree)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/82793ff9
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/82793ff9
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/82793ff9

Branch: refs/heads/master
Commit: 82793ff9d5e8cd23b19d3b2a0f5910df9f587e38
Parents: 4675a65
Author: Sreenath Somarajapuram <sree@apache.org>
Authored: Fri Apr 15 11:57:27 2016 +0530
Committer: Sreenath Somarajapuram <sree@apache.org>
Committed: Fri Apr 15 11:57:27 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 tez-ui2/src/main/resources/META-INF/LICENSE.txt |  2 +-
 .../webapp/app/components/dags-pagination-ui.js | 20 +++++-
 tez-ui2/src/main/webapp/app/controllers/dags.js | 31 +++++++--
 .../src/main/webapp/app/routes/application.js   | 14 ++--
 tez-ui2/src/main/webapp/app/routes/dags.js      | 52 ++++++++++++--
 .../webapp/app/styles/dags-page-search.less     |  2 +-
 .../src/main/webapp/app/styles/page-layout.less |  2 +-
 .../templates/components/dags-pagination-ui.hbs | 36 +++++++++-
 .../app/templates/components/table-controls.hbs |  2 +-
 tez-ui2/src/main/webapp/app/templates/dags.hbs  |  1 +
 tez-ui2/src/main/webapp/package.json            |  2 +-
 .../components/dags-pagination-ui-test.js       | 58 ++++++++++++++--
 .../webapp/tests/unit/controllers/dags-test.js  |  4 +-
 .../tests/unit/routes/application-test.js       |  2 +
 .../main/webapp/tests/unit/routes/dags-test.js  | 71 ++++++++++++++++++++
 16 files changed, 268 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2ed4091..65b8bbd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,7 @@ INCOMPATIBLE CHANGES
 ALL CHANGES:
   TEZ-3202. Reduce the memory need for jobs with high number of segments
   TEZ-3165. Allow Inputs/Outputs to be initialized serially, control processor initialization
relative to Inputs/Outputs
+  TEZ-3214. Tez UI 2: Pagination in All DAGs
 
 Release 0.8.3: 2016-04-14 
 

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/resources/META-INF/LICENSE.txt b/tez-ui2/src/main/resources/META-INF/LICENSE.txt
index 54e2532..d5523c1 100644
--- a/tez-ui2/src/main/resources/META-INF/LICENSE.txt
+++ b/tez-ui2/src/main/resources/META-INF/LICENSE.txt
@@ -230,7 +230,7 @@ The Apache TEZ tez-ui bundles the following files under the MIT License:
  - ember-bootstrap v0.5.1 (https://github.com/kaliber5/ember-bootstrap) - Copyright 2015
kaliber5 GmbH.
  - snippet-ss v1.11.0 (https://github.com/sreenaths/snippet-ss)
  - em-tgraph v0.0.3 (https://github.com/sreenaths/em-tgraph)
- - em-table v0.3.10 (https://github.com/sreenaths/em-table)
+ - em-table v0.3.11 (https://github.com/sreenaths/em-table)
  - em-helpers v0.5.8 (https://github.com/sreenaths/em-helpers)
  - ember-cli-app-version v1.0.0 (https://github.com/EmberSherpa/ember-cli-app-version) -
Authored by Taras Mankovski <tarasm@gmail.com>
  - ember-cli-auto-register v1.1.0 (https://github.com/williamsbdev/ember-cli-auto-register)
- Copyright © 2015 Brandon Williams http://williamsbdev.com

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js b/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js
index bedb6cb..624f4d8 100644
--- a/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js
+++ b/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js
@@ -33,6 +33,17 @@ export default Ember.Component.extend({
     return this.get('tableDefinition.pageNum') === this.get('dataProcessor.totalPages');
   }),
 
+  loadButton: Ember.computed("tableDefinition.moreAvailable",
+      "tableDefinition.loadingMore",
+      "tableDefinition.rowCount", function () {
+    var rowCount = this.get("tableDefinition.rowCount"),
+        moreAvailable = this.get("tableDefinition.moreAvailable");
+    return {
+      title: moreAvailable ? `Load ${rowCount} more record(s)` : "All available records loaded",
+      disabled: !moreAvailable || this.get("tableDefinition.loadingMore")
+    };
+  }),
+
   rowCountOptions: Ember.computed('tableDefinition.rowCountOptions', 'tableDefinition.rowCount',
function () {
     var options = this.get('tableDefinition.rowCountOptions'),
         rowCount = this.get('tableDefinition.rowCount');
@@ -53,9 +64,9 @@ export default Ember.Component.extend({
         endPage = totalPages,
         delta = 0;
 
-    if(totalPages > 5) {
-      startPage = pageNum - 2;
-      endPage = pageNum + 2;
+    if(totalPages > 3) {
+      startPage = pageNum - 1;
+      endPage = pageNum + 1;
 
       if(startPage < 1) {
         delta = 1 - startPage;
@@ -87,6 +98,9 @@ export default Ember.Component.extend({
     },
     changePage: function (value) {
       this.get('parentView').send('pageChanged', value);
+    },
+    loadMore: function () {
+      this.get('parentView').sendAction('loadMore');
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/controllers/dags.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/controllers/dags.js b/tez-ui2/src/main/webapp/app/controllers/dags.js
index 0365987..3109ebd 100644
--- a/tez-ui2/src/main/webapp/app/controllers/dags.js
+++ b/tez-ui2/src/main/webapp/app/controllers/dags.js
@@ -24,21 +24,33 @@ import TableDefinition from 'em-table/utils/table-definition';
 
 export default TableController.extend({
 
-  queryParams: ["dagName", "dagID", "submitter", "status", "appID", "callerID", "pageNo"],
+  queryParams: ["dagName", "dagID", "submitter", "status", "appID", "callerID"],
   dagName: "",
   dagID: "",
   submitter: "",
   status: "",
   appID: "",
   callerID: "",
-  pageNo: 1,
+
+  // Because pageNo is a query param added by table controller, and in the current design
+  // we don't want page to be a query param as only the first page will be loaded first.
+  pageNum: 1,
 
   breadcrumbs: [],
 
+  moreAvailable: false,
+  loadingMore: false,
+
   headerComponentNames: ['dags-page-search', 'table-controls', 'dags-pagination-ui'],
 
-  definition: Ember.computed("dagName", "dagID", "submitter", "status", "appID", "callerID",
"pageNo", function () {
-    return TableDefinition.create({
+  _definition: TableDefinition.create(),
+  // Using computed, as observer won't fire if the property is not used
+  definition: Ember.computed("dagName", "dagID", "submitter", "status",
+      "appID", "callerID", "pageNum", "moreAvailable", "loadingMore", function () {
+
+    var definition = this.get("_definition");
+
+    definition.setProperties({
       dagName: this.get("dagName"),
       dagID: this.get("dagID"),
       submitter: this.get("submitter"),
@@ -46,9 +58,13 @@ export default TableController.extend({
       appID: this.get("appID"),
       callerID: this.get("callerID"),
 
-      pageNum: this.get("pageNo"),
-      rowCountOptions: [5, 10, 25, 50, 100, 250, 500]
+      pageNum: this.get("pageNum"),
+
+      moreAvailable: this.get("moreAvailable"),
+      loadingMore: this.get("loadingMore")
     });
+
+    return definition;
   }),
 
   columns: ColumnDefinition.make([{
@@ -142,6 +158,9 @@ export default TableController.extend({
     searchChanged: function (propertyName, value) {
       this.set(propertyName, value);
     },
+    pageChanged: function (pageNum) {
+      this.set("pageNum", pageNum);
+    },
   }
 
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/routes/application.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/routes/application.js b/tez-ui2/src/main/webapp/app/routes/application.js
index 039e329..5ae68b8 100644
--- a/tez-ui2/src/main/webapp/app/routes/application.js
+++ b/tez-ui2/src/main/webapp/app/routes/application.js
@@ -22,11 +22,7 @@ export default Ember.Route.extend({
   title: "Application",
 
   pageReset: function () {
-    Ember.$(document).tooltip("destroy");
-    Ember.$(document).tooltip({
-      delay: 20,
-      tooltipClass: 'generic-tooltip'
-    });
+    this.send("resetTooltip");
   },
 
   actions: {
@@ -42,6 +38,14 @@ export default Ember.Route.extend({
       Ember.Logger.error(error);
     },
 
+    resetTooltip: function () {
+      Ember.$(document).tooltip("destroy");
+      Ember.$(document).tooltip({
+        delay: 20,
+        tooltipClass: 'generic-tooltip'
+      });
+    },
+
     // Modal window actions
     openModal: function (componentName, options) {
       options = options || {};

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/routes/dags.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/routes/dags.js b/tez-ui2/src/main/webapp/app/routes/dags.js
index ebbbe92..8538920 100644
--- a/tez-ui2/src/main/webapp/app/routes/dags.js
+++ b/tez-ui2/src/main/webapp/app/routes/dags.js
@@ -32,9 +32,6 @@ export default AbstractRoute.extend({
     status: REFRESH,
     appID: REFRESH,
     callerID: REFRESH,
-    pageNo: REFRESH,
-
-    rowCount: REFRESH,
   },
 
   loaderQueryParams: {
@@ -45,10 +42,11 @@ export default AbstractRoute.extend({
     appID: "appID",
     callerID: "callerID",
 
-    pageNo: "pageNo",
     limit: "rowCount",
   },
 
+  fromId: null,
+
   setupController: function (controller, model) {
     this._super(controller, model);
     Ember.run.later(this, "startCrumbBubble");
@@ -77,7 +75,8 @@ export default AbstractRoute.extend({
 
   load: function (value, query/*, options*/) {
     var loader,
-        that = this;
+        that = this,
+        limit = this.get("controller.rowCount") || query.limit;
 
     if(query.dagID) {
       that.set("loadedRecords", []);
@@ -86,10 +85,23 @@ export default AbstractRoute.extend({
       });
     }
     else {
+      query = Ember.$.extend({}, query, {
+        limit: limit + 1
+      });
       loader = this.get("loader").query('dag', query, {reload: true});
     }
 
     return loader.then(function (records) {
+
+      if(records.get("length") > limit) {
+        let lastRecord = records.popObject();
+        that.set("controller.moreAvailable", true);
+        that.set("fromId", lastRecord.get("entityID"));
+      }
+      else {
+        that.set("controller.moreAvailable", false);
+      }
+
       records = that.filterRecords(records, query);
       records.forEach(function (record) {
         if(record.get("status") === "RUNNING") {
@@ -102,9 +114,37 @@ export default AbstractRoute.extend({
     });
   },
 
+  loadNewPage: function () {
+    var query = this.get("currentQuery"),
+        that = this;
+
+    query = Ember.$.extend({}, query, {
+      fromId: this.get("fromId")
+    });
+
+    this.set("controller.loadingMore", true);
+    this.load(null, query).then(function (data) {
+      if(that.get("controller.loadingMore")) {
+        that.set("controller.loadingMore", false);
+        that.get("loadedValue").pushObjects(data);
+      }
+    });
+  },
+
   actions: {
     setLoadTime: function (time) {
       this.set("controller.loadTime", time);
-    }
+    },
+    loadMore: function () {
+      if(this.get("controller.moreAvailable")) {
+        this.send("resetTooltip");
+        this.loadNewPage();
+      }
+    },
+    reload: function () {
+      this.set("controller.loadingMore", false);
+      this.set("controller.pageNum", 1);
+      this._super();
+    },
   }
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/styles/dags-page-search.less
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/styles/dags-page-search.less b/tez-ui2/src/main/webapp/app/styles/dags-page-search.less
index 25a470d..2081156 100644
--- a/tez-ui2/src/main/webapp/app/styles/dags-page-search.less
+++ b/tez-ui2/src/main/webapp/app/styles/dags-page-search.less
@@ -52,7 +52,7 @@
 @media screen and (min-width: 1300px) {
   .dags-page-search{
     float: left;
-    width: 1000px;
+    width: 60%;
 
     .form-group {
       margin-bottom: 0px;

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/styles/page-layout.less
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/styles/page-layout.less b/tez-ui2/src/main/webapp/app/styles/page-layout.less
index 7249903..6dab69f 100644
--- a/tez-ui2/src/main/webapp/app/styles/page-layout.less
+++ b/tez-ui2/src/main/webapp/app/styles/page-layout.less
@@ -120,7 +120,7 @@ body, html {
 .standalone {
   height: 100%;
 
-  a, .pagination > li > a, .btn-default, .clickable {
+  a, .pagination > li > a, .clickable {
     color: @logo-orange;
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs b/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs
index 60b3bee..46fe20b 100644
--- a/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs
+++ b/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs
@@ -16,12 +16,44 @@
  * limitations under the License.
 }}
 
+<ul class="page-list">
+  <li class="{{unless atFirst 'clickable'}}" {{action 'changePage' 1}}>
+    First
+  </li>
+  {{#each _possiblePages as |page|}}
+    <li class="{{if page.isCurrent 'is-current' 'clickable'}}" {{action 'changePage' page.pageNum}}>
+      {{page.pageNum}}
+    </li>
+  {{/each}}
+  <li title="{{dataProcessor.totalPages}} pages loaded, more are available"  class="{{unless
atLast 'clickable'}}" {{action 'changePage' dataProcessor.totalPages}}>
+    {{#if tableDefinition.moreAvailable}}
+      {{dataProcessor.totalPages}} ...
+    {{else}}
+      Last - {{dataProcessor.totalPages}}
+    {{/if}}
+  </li>
+</ul>
+
+<button type="button" title={{loadButton.title}}
+    class="btn {{if loadButton.disabled 'disabled'}} {{if tableDefinition.moreAvailable 'btn-success'
'btn-default'}}"
+    {{action "loadMore" }}>
+  {{#if tableDefinition.moreAvailable}}
+    {{#if tableDefinition.loadingMore}}
+      <i class="fa fa-spinner fa-spin"></i>
+    {{else}}
+      <i class="fa fa-download"></i>
+    {{/if}}
+  {{else}}
+    All loaded!
+  {{/if}}
+</button>
+
 <div class='row-select'>
-  <select class="form-control" onchange={{action "rowSelected" value="target.value"}}>
+  <select title="Select rows to display" class="form-control" onchange={{action "rowSelected"
value="target.value"}}>
     {{#each rowCountOptions as |option|}}
       <option value={{option.value}} selected={{option.selected}}>
         {{option.value}} Rows
       </option>
     {{/each}}
   </select>
-</div>
\ No newline at end of file
+</div>

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/templates/components/table-controls.hbs
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/templates/components/table-controls.hbs b/tez-ui2/src/main/webapp/app/templates/components/table-controls.hbs
index b70d19d..1894cb7 100644
--- a/tez-ui2/src/main/webapp/app/templates/components/table-controls.hbs
+++ b/tez-ui2/src/main/webapp/app/templates/components/table-controls.hbs
@@ -16,4 +16,4 @@
  * limitations under the License.
 }}
 
-<i class='fa fa-cog' {{action 'cogClicked'}}></i>
+<i class='fa fa-cog' title="Customize" {{action 'cogClicked'}}></i>

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/app/templates/dags.hbs
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/templates/dags.hbs b/tez-ui2/src/main/webapp/app/templates/dags.hbs
index cb75f26..6e04caf 100644
--- a/tez-ui2/src/main/webapp/app/templates/dags.hbs
+++ b/tez-ui2/src/main/webapp/app/templates/dags.hbs
@@ -35,6 +35,7 @@
     sortAction="sortChanged"
     rowAction="rowCountChanged"
     pageAction="pageChanged"
+    loadMore="loadMore"
   }}
 {{else}}
   {{partial "loading"}}

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/package.json b/tez-ui2/src/main/webapp/package.json
index 1a641b4..4145ab4 100644
--- a/tez-ui2/src/main/webapp/package.json
+++ b/tez-ui2/src/main/webapp/package.json
@@ -57,7 +57,7 @@
   },
   "dependencies": {
     "em-helpers": "0.5.8",
-    "em-table": "0.3.10",
+    "em-table": "0.3.11",
     "em-tgraph": "0.0.3"
   }
 }

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js
b/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js
index b4c192a..8c75343 100644
--- a/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js
+++ b/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js
@@ -19,15 +19,13 @@
 import { moduleForComponent, test } from 'ember-qunit';
 import hbs from 'htmlbars-inline-precompile';
 
+import wait from 'ember-test-helpers/wait';
+
 moduleForComponent('dags-pagination-ui', 'Integration | Component | dags pagination ui',
{
   integration: true
 });
 
 test('Basic creation test', function(assert) {
-
-  // Set any properties with this.set('myProperty', 'value');
-  // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL +
-
   this.set("rowCountOptions", {
     rowCountOptions: [1, 2]
   });
@@ -36,6 +34,11 @@ test('Basic creation test', function(assert) {
 
   assert.equal(this.$('select').length, 1);
 
+  assert.equal(this.$('.page-list').length, 1);
+  assert.equal(this.$('li').length, 2);
+
+  assert.equal(this.$('.btn').length, 1);
+
   // Template block usage:" + EOL +
   this.render(hbs`
     {{#dags-pagination-ui rowCountOptions=rowCountOptions}}
@@ -45,3 +48,50 @@ test('Basic creation test', function(assert) {
 
   assert.equal(this.$('select').length, 1);
 });
+
+test('Page list test', function(assert) {
+  this.set("tableDefinition", {
+    pageNum: 5,
+    rowCount: 5,
+
+    loadingMore: false,
+    moreAvailable: true,
+
+    rowCountOptions: []
+  });
+  this.set("processor", {
+    totalPages: 10,
+  });
+
+  this.render(hbs`{{dags-pagination-ui tableDefinition=tableDefinition dataProcessor=processor}}`);
+
+  return wait().then(() => {
+    assert.equal(this.$('li').length, 5);
+    assert.equal(this.$('li').eq(1).text().trim(), "4");
+    assert.equal(this.$('li').eq(2).text().trim(), "5");
+    assert.equal(this.$('li').eq(3).text().trim(), "6");
+    assert.equal(this.$('li').eq(4).text().trim(), "10 ...");
+  });
+});
+
+test('Page list - moreAvailable false test', function(assert) {
+  this.set("tableDefinition", {
+    pageNum: 5,
+    rowCount: 5,
+
+    loadingMore: false,
+    moreAvailable: false,
+
+    rowCountOptions: []
+  });
+  this.set("processor", {
+    totalPages: 10,
+  });
+
+  this.render(hbs`{{dags-pagination-ui tableDefinition=tableDefinition dataProcessor=processor}}`);
+
+  return wait().then(() => {
+    assert.equal(this.$('li').length, 5);
+    assert.equal(this.$('li').eq(4).text().trim(), "Last - 10");
+  });
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js
index 98f2815..506af5c 100644
--- a/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js
@@ -26,7 +26,7 @@ moduleFor('controller:dags', 'Unit | Controller | dags', {
 });
 
 test('Basic creation test', function(assert) {
-  assert.expect(2 + 3 + 4);
+  assert.expect(2 + 3 + 1 + 4);
 
   let controller = this.subject({
     initVisibleColumns: Ember.K,
@@ -41,6 +41,8 @@ test('Basic creation test', function(assert) {
   assert.ok(controller.columns);
   assert.ok(controller.getCounterColumns);
 
+  assert.ok(controller.pageNum);
+
   assert.ok(controller.queryParams);
   assert.ok(controller.headerComponentNames);
   assert.ok(controller.definition);

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/tests/unit/routes/application-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/application-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/application-test.js
index e441e49..d6c455a 100644
--- a/tez-ui2/src/main/webapp/tests/unit/routes/application-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/routes/application-test.js
@@ -36,6 +36,8 @@ test('Basic creation test', function(assert) {
   assert.ok(route.actions.openModal);
   assert.ok(route.actions.closeModal);
   assert.ok(route.actions.destroyModal);
+
+  assert.ok(route.actions.resetTooltip);
 });
 
 test('Test didTransition action', function(assert) {

http://git-wip-us.apache.org/repos/asf/tez/blob/82793ff9/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js
index baadf16..0fa3ea3 100644
--- a/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js
@@ -36,6 +36,12 @@ test('Basic creation test', function(assert) {
   assert.ok(route.load);
 
   assert.ok(route.filterRecords);
+
+  assert.ok(route.loadNewPage);
+
+  assert.ok(route.actions.setLoadTime);
+  assert.ok(route.actions.loadMore);
+  assert.ok(route.actions.reload);
 });
 
 test('filterRecords test', function(assert) {
@@ -56,3 +62,68 @@ test('filterRecords test', function(assert) {
   assert.equal(filteredRecords.length, 1);
   assert.equal(filteredRecords[0].name, "test");
 });
+
+test('load test', function(assert) {
+  let route = this.subject({
+        filterRecords: function () {
+          return [];
+        },
+        controller: Ember.Object.create(),
+        loader: {
+          query: function (type, query, options) {
+            assert.equal(type, "dag");
+            assert.equal(query.limit, 6);
+            assert.equal(options.reload, true);
+            return {
+              then: function (callback) {
+                callback(Ember.Object.create({
+                  length: 6,
+                  popObject: function () {
+                    assert.ok(true);
+                    return Ember.Object.create();
+                  }
+                }));
+              }
+            };
+          }
+        }
+      }),
+      query = {
+        limit: 5
+      };
+
+  assert.expect(3 + 1);
+
+  route.load(null, query);
+});
+
+test('loadNewPage test', function(assert) {
+  let currentQuery = {
+        val: {}
+      },
+      data = [],
+      fromId = "id1",
+      route = this.subject({
+        controller: Ember.Object.create(),
+        currentQuery: currentQuery,
+        fromId: fromId,
+        loadedValue: {
+          pushObjects: function (objs) {
+            assert.equal(data, objs);
+          }
+        },
+        load: function (value, query) {
+          assert.equal(query.val, currentQuery.val);
+          assert.equal(query.fromId, fromId);
+          return {
+            then: function (callback) {
+              callback(data);
+            }
+          };
+        }
+      });
+
+  assert.expect(1 + 2);
+
+  route.loadNewPage();
+});


Mime
View raw message