From 561718e05de51c0cb7c17295d7713d52408918eb Mon Sep 17 00:00:00 2001 From: Sunil G Date: Mon, 24 Apr 2017 13:28:57 +0530 Subject: [PATCH] =?UTF-8?q?YARN-6291.=20Introduce=20query=20parameters=20(?= =?UTF-8?q?sort,=20filter,=20etc.)=20for=20tables=20to=20keep=20state=20on?= =?UTF-8?q?=20refresh/navigation=20in=20new=20YARN=20UI.=20Contributed=20b?= =?UTF-8?q?y=20Gergely=20Nov=C3=A1k.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/webapp/app/controllers/yarn-apps/apps.js | 10 ++++++++++ .../main/webapp/app/controllers/yarn-apps/services.js | 10 ++++++++++ .../main/webapp/app/controllers/yarn-nodes/table.js | 8 ++++++++ .../src/main/webapp/app/templates/yarn-apps/apps.hbs | 2 +- .../main/webapp/app/templates/yarn-apps/services.hbs | 2 +- .../src/main/webapp/app/templates/yarn-nodes/table.hbs | 2 +- 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/apps.js index 0b0be20f81..44a7c1ca2b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/apps.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/apps.js @@ -16,7 +16,17 @@ * limitations under the License. */ +import Ember from 'ember'; +import ColumnDef from 'em-table/utils/column-definition'; +import TableDefinition from 'em-table/utils/table-definition'; import AppTableController from '../app-table-columns'; export default AppTableController.extend({ + queryParams: ['searchText', 'sortColumnId', 'sortOrder', 'pageNum', 'rowCount'], + tableDefinition: TableDefinition.create(), + searchText: Ember.computed.alias('tableDefinition.searchText'), + sortColumnId: Ember.computed.alias('tableDefinition.sortColumnId'), + sortOrder: Ember.computed.alias('tableDefinition.sortOrder'), + pageNum: Ember.computed.alias('tableDefinition.pageNum'), + rowCount: Ember.computed.alias('tableDefinition.rowCount') }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/services.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/services.js index 0b0be20f81..44a7c1ca2b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/services.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/services.js @@ -16,7 +16,17 @@ * limitations under the License. */ +import Ember from 'ember'; +import ColumnDef from 'em-table/utils/column-definition'; +import TableDefinition from 'em-table/utils/table-definition'; import AppTableController from '../app-table-columns'; export default AppTableController.extend({ + queryParams: ['searchText', 'sortColumnId', 'sortOrder', 'pageNum', 'rowCount'], + tableDefinition: TableDefinition.create(), + searchText: Ember.computed.alias('tableDefinition.searchText'), + sortColumnId: Ember.computed.alias('tableDefinition.sortColumnId'), + sortOrder: Ember.computed.alias('tableDefinition.sortOrder'), + pageNum: Ember.computed.alias('tableDefinition.pageNum'), + rowCount: Ember.computed.alias('tableDefinition.rowCount') }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js index 3b7b0f6721..3fae5961f8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js @@ -19,8 +19,16 @@ import Ember from 'ember'; import ColumnDef from 'em-table/utils/column-definition'; +import TableDefinition from 'em-table/utils/table-definition'; export default Ember.Controller.extend({ + queryParams: ['searchText', 'sortColumnId', 'sortOrder', 'pageNum', 'rowCount'], + tableDefinition: TableDefinition.create(), + searchText: Ember.computed.alias('tableDefinition.searchText'), + sortColumnId: Ember.computed.alias('tableDefinition.sortColumnId'), + sortOrder: Ember.computed.alias('tableDefinition.sortOrder'), + pageNum: Ember.computed.alias('tableDefinition.pageNum'), + rowCount: Ember.computed.alias('tableDefinition.rowCount'), columns: function() { var colums = []; colums.push({ diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs index 8c72ce4f83..f740083b8a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/apps.hbs @@ -20,7 +20,7 @@

Loading...

{{else}} {{#if model.apps}} - {{em-table columns=columns rows=model.apps}} + {{em-table columns=columns rows=model.apps definition=tableDefinition}} {{else}}

Could not find any applications from this cluster

{{/if}} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs index 7556908a9e..d56762cb36 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-apps/services.hbs @@ -17,7 +17,7 @@ --}} {{#if model.apps}} - {{em-table columns=columns rows=model.apps}} + {{em-table columns=columns rows=model.apps definition=tableDefinition}} {{else}}

Could not find any applications from this cluster

{{/if}} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs index 79d721bfc4..6ebcae21c1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes/table.hbs @@ -18,7 +18,7 @@
{{#if model.nodes}} - {{em-table columns=columns rows=model.nodes}} + {{em-table columns=columns rows=model.nodes definition=tableDefinition}} {{else}}

No nodes found on this cluster

{{/if}}