tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeag...@apache.org
Subject [31/53] tez git commit: TEZ-1765. Allow dropdown lists in table filters. (Prakash Ramachandran via hitesh)
Date Wed, 10 Dec 2014 03:33:54 GMT
TEZ-1765. Allow dropdown lists in table filters. (Prakash Ramachandran via hitesh)


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

Branch: refs/heads/master
Commit: ac8c86b408c7ca5081a24287127e61ddf8b7d6a0
Parents: 7ef637b
Author: Hitesh Shah <hitesh@apache.org>
Authored: Tue Nov 11 13:07:10 2014 -0800
Committer: Hitesh Shah <hitesh@apache.org>
Committed: Tue Nov 11 13:07:10 2014 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../app/scripts/components/extended-table.js    | 66 ++++++++++++++++++--
 .../webapp/app/scripts/controllers/dag_tasks.js |  2 +
 .../app/scripts/controllers/dag_vertices.js     |  2 +
 .../app/scripts/controllers/dags_controller.js  |  4 +-
 .../task_task_attempts_controller.js            |  2 +
 .../controllers/vertex_tasks_controller.js      |  2 +
 .../src/main/webapp/app/scripts/helpers/misc.js | 30 ++++++++-
 .../components/extended-table/filter-cell.hbs   |  4 +-
 9 files changed, 102 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c3b1412..bb5f4d0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -16,6 +16,7 @@ ALL CHANGES:
   TEZ-1741. App view.
   TEZ-1751. Log view & download links in task and task attempt view.
   TEZ-1753. Queue in dags view.
+  TEZ-1765. Allow dropdown lists in table filters.
 
 Release 0.5.2: Unreleased
 

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/components/extended-table.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/components/extended-table.js b/tez-ui/src/main/webapp/app/scripts/components/extended-table.js
index 5047af9..fc8e092 100644
--- a/tez-ui/src/main/webapp/app/scripts/components/extended-table.js
+++ b/tez-ui/src/main/webapp/app/scripts/components/extended-table.js
@@ -18,7 +18,7 @@
 
 App.ExTable = Ember.Namespace.create();
 
-App.ExTable.FilterField = Em.TextField.extend({
+App.ExTable.FilterTextField = Em.TextField.extend({
 	classNames: ['filter'],
   classNameBindings: ['isPopulated','isInputDirty:input-dirty'],
   type: 'search',
@@ -28,6 +28,7 @@ App.ExTable.FilterField = Em.TextField.extend({
   isPopulated: function() {
   	return !Em.isEmpty(this.get('value'));
   }.property('value'),
+
   insertNewline: function(event) {
     if (this.get('isInputDirty')) {
       this.set('filterValue', this.get('value'));
@@ -44,6 +45,20 @@ App.ExTable.FilterField = Em.TextField.extend({
   }.property('value', 'filterValue')
 });
 
+App.ExTable.FilterDropdownField = Em.Select.extend({
+  valueBinding: Em.Binding.oneWay('filterValue'),
+  change: function(key) {
+    if (this.get('isInputDirty')) {
+      this.set('filterValue', this.get('value'));
+      this.get('parentView.controller')
+        .send('filterUpdated', this.get('parentView.content'), this.get('value'));
+    }
+  },
+  isInputDirty: function() {
+    return $.trim(this.get('value')) != $.trim(this.get('filterValue'));
+  }.property('value', 'filterValue')
+});
+
 App.ExTable.FilterRow = Ember.View.extend(Ember.AddeparMixins.StyleBindingsMixin, {
   templateName: 'components/extended-table/filter-row',
   classNames: ['ember-table-table-row', 'ember-table-header-row'],
@@ -68,22 +83,59 @@ App.ExTable.FilterBlock = Ember.Table.TableBlock.extend({
   }.property('columns')
 });
 
-App.ExTable.FilterTableContainer = Ember.Table.TableContainer.extend(Ember.Table.ShowHorizontalScrollMixin,
{
+App.ExTable.FilterTableContainer = Ember.Table.TableContainer.extend(
+    Ember.Table.ShowHorizontalScrollMixin, {
   templateName: 'components/extended-table/filter-container',
-  classNames: ['ember-table-table-container', 'ember-table-fixed-table-container', 'ember-table-header-container'],
+  classNames: [
+    'ember-table-table-container', 
+    'ember-table-fixed-table-container', 
+    'ember-table-header-container'
+  ],
   height: Ember.computed.alias('controller._filterHeight'),
   width: Ember.computed.alias('controller._tableContainerWidth')
 });
 
 App.ExTable.FilterCell = Ember.View.extend(Ember.AddeparMixins.StyleBindingsMixin, {
+  init: function() {
+    var inputFieldView = null;
+    if (this.get('content.isFilterable')) {
+      var filterType = this.get('content.filterType');
+      switch (filterType) {
+        case 'dropdown':
+          inputFieldView = App.ExTable.FilterDropdownField.create({
+            content: this.get('content.dropdownValues'),
+            optionValuePath: 'content.id',
+            optionLabelPath: 'content.label',
+            classNames: 'inline-display'
+          });
+        break;
+        case 'textbox':
+          inputFieldView = App.ExTable.FilterTextField.create({
+            filterValueBinding: 'content.columnFilterValue',
+            classNames: 'inline-display'
+          });
+        break;
+        default:
+          console.log('Unknown filter type ' + filterType + ' defined on column ' + 
+            this.get('content.headerCellName') + '.Will be ignored');
+        break;
+      }
+    }
+    if (!inputFieldView) {
+      // if no filter is specified or type is unknown, use empty view.
+      inputFieldView = Em.View.create();
+    }
+    this.set('inputFieldView', inputFieldView);
+    this._super();
+  },
   templateName: 'components/extended-table/filter-cell',
   classNames: ['ember-table-cell', 'ember-table-header-cell'],
   classNameBindings: ['column.textAlign'],
   styleBindings: ['width', 'height'],
- 	column: Ember.computed.alias('content'),
+  column: Ember.computed.alias('content'),
   width: Ember.computed.alias('column.columnWidth'),
   height: function() {
-  	return this.get('controller._filterHeight');
+    return this.get('controller._filterHeight');
   }.property('controller._filterHeight'),
   // Currently resizing is not handled automatically. if required will need to do here.
 });
@@ -96,7 +148,9 @@ App.ExTable.ColumnDefinition = Ember.Table.ColumnDefinition.extend({
         .to('columnFilterValue');
       columnFilterValueBinding.connect(this);
     }
+    this._super();
   },
+  filterType: 'textbox', // default is textbox
   textAlign: 'text-align-left',
   filterCellView: 'App.ExTable.FilterCell',
   filterCellViewClass: Ember.computed.alias('filterCellView'),
@@ -187,4 +241,4 @@ App.ExTable.FilterColumnMixin = Ember.Mixin.create({
 		}.property('columnFilterValue'),
 });
 
-Ember.Handlebars.helper('extended-table-component', App.ExTable.TableComponent);
\ No newline at end of file
+Ember.Handlebars.helper('extended-table-component', App.ExTable.TableComponent);

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
index a7d3c38..b41dbda 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_tasks.js
@@ -118,6 +118,8 @@ App.DagTasksController = Em.ObjectController.extend(App.PaginatedContentMixin,
{
     var statusCol = App.ExTable.ColumnDefinition.createWithMixins(App.ExTable.FilterColumnMixin,{
       headerCellName: 'Status',
       filterID: 'status_filter',
+      filterType: 'dropdown',
+      dropdownValues: App.Helpers.misc.taskStatusUIOptions,
       tableCellViewClass: Em.Table.TableCell.extend({
         template: Em.Handlebars.compile(
           '<span class="ember-table-content">&nbsp;\

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/controllers/dag_vertices.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag_vertices.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag_vertices.js
index 5751de7..91777ab 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dag_vertices.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag_vertices.js
@@ -98,6 +98,8 @@ App.DagVerticesController = Em.ObjectController.extend(App.PaginatedContentMixin
     var statusCol = App.ExTable.ColumnDefinition.createWithMixins(App.ExTable.FilterColumnMixin,{
       headerCellName: 'Status',
       filterID: 'status_filter',
+      filterType: 'dropdown',
+      dropdownValues: App.Helpers.misc.vertexStatusUIOptions,
       tableCellViewClass: Em.Table.TableCell.extend({
         template: Em.Handlebars.compile(
           '<span class="ember-table-content">&nbsp;\

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
index 9997202..63f2f0d 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/dags_controller.js
@@ -139,6 +139,8 @@ App.DagsController = Em.ObjectController.extend(App.PaginatedContentMixin,
{
       textAlign: 'text-align-left',
       headerCellName: 'Status',
       filterID: 'status_filter',
+      filterType: 'dropdown',
+      dropdownValues: App.Helpers.misc.dagStatusUIOptions,
       tableCellViewClass: Em.Table.TableCell.extend({
         template: Em.Handlebars.compile(
           '<span class="ember-table-content">&nbsp;\
@@ -192,4 +194,4 @@ App.DagsController = Em.ObjectController.extend(App.PaginatedContentMixin,
{
   }.property(),
 
 
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/controllers/task_task_attempts_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/task_task_attempts_controller.js
b/tez-ui/src/main/webapp/app/scripts/controllers/task_task_attempts_controller.js
index 1b48277..244dd1d 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/task_task_attempts_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/task_task_attempts_controller.js
@@ -78,6 +78,8 @@ App.TaskAttemptsController = Em.ObjectController.extend(App.PaginatedContentMixi
     var statusCol = App.ExTable.ColumnDefinition.createWithMixins(App.ExTable.FilterColumnMixin,{
       headerCellName: 'Status',
       filterID: 'status_filter',
+      filterType: 'dropdown',
+      dropdownValues: App.Helpers.misc.taskStatusUIOptions,
       tableCellViewClass: Em.Table.TableCell.extend({
         template: Em.Handlebars.compile(
           '<span class="ember-table-content">&nbsp;\

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
index a093d86..986dedd 100644
--- a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
+++ b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_tasks_controller.js
@@ -118,6 +118,8 @@ App.VertexTasksController = Em.ObjectController.extend(App.PaginatedContentMixin
     var statusCol = App.ExTable.ColumnDefinition.createWithMixins(App.ExTable.FilterColumnMixin,{
       headerCellName: 'Status',
       filterID: 'status_filter',
+      filterType: 'dropdown',
+      dropdownValues: App.Helpers.misc.taskStatusUIOptions,
       tableCellViewClass: Em.Table.TableCell.extend({
         template: Em.Handlebars.compile(
           '<span class="ember-table-content">&nbsp;\

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
index 8db04a0..66651b5 100644
--- a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
+++ b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js
@@ -72,5 +72,33 @@ App.Helpers.misc = {
 
   isValidTaskStatus: function(status) {
     return $.inArray(status, ['RUNNING', 'SUCCEEDED', 'FAILED', 'KILLED']) != -1;
-  }
+  },
+
+  dagStatusUIOptions: [
+    { label: 'All', id: null },
+    { label: 'Submitted', id: 'SUBMITTED' },
+    { label: 'Running', id: 'RUNNING' },
+    { label: 'Succeeded', id: 'SUCCEEDED' },
+    { label: 'Failed', id: 'FAILED' },
+    { label: 'Killed', id: 'KILLED' },
+    { label: 'Error', id: 'ERROR' },
+  ],
+
+  vertexStatusUIOptions: [
+    { label: 'All', id: null },
+    { label: 'Running', id: 'RUNNING' },
+    { label: 'Succeeded', id: 'SUCCEEDED' },
+    { label: 'Failed', id: 'FAILED' },
+    { label: 'Killed', id: 'KILLED' },
+    { label: 'Error', id: 'ERROR' },
+  ],
+
+  taskStatusUIOptions: [
+    { label: 'All', id: null },
+    { label: 'Running', id: 'RUNNING' },
+    { label: 'Succeeded', id: 'SUCCEEDED' },
+    { label: 'Failed', id: 'FAILED' },
+    { label: 'Killed', id: 'KILLED' },
+  ],
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tez/blob/ac8c86b4/tez-ui/src/main/webapp/app/templates/components/extended-table/filter-cell.hbs
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/templates/components/extended-table/filter-cell.hbs
b/tez-ui/src/main/webapp/app/templates/components/extended-table/filter-cell.hbs
index a29906b..f0ec7bb 100644
--- a/tez-ui/src/main/webapp/app/templates/components/extended-table/filter-cell.hbs
+++ b/tez-ui/src/main/webapp/app/templates/components/extended-table/filter-cell.hbs
@@ -1,7 +1,5 @@
 <div class="ember-table-content-container" style='cursor: auto;'>
   <span class="ember-table-content" style='white-space: nowrap; cursor: auto;'>
-    {{#if view.content.isFilterable}}
-    	{{view App.ExTable.FilterField filterValueBinding='view.content.columnFilterValue' class='inline-display'}}
-    {{/if}}
+    {{view view.inputFieldView}}
   </span>
 </div>
\ No newline at end of file


Mime
View raw message