YARN-6291. Introduce query parameters (sort, filter, etc.) for tables to keep state on refresh/navigation in new YARN UI. Contributed by Gergely Novák.

This commit is contained in:
Sunil G 2017-04-24 13:28:57 +05:30
parent fda86ef2a3
commit 561718e05d
6 changed files with 31 additions and 3 deletions

View File

@ -16,7 +16,17 @@
* limitations under the License. * 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'; import AppTableController from '../app-table-columns';
export default AppTableController.extend({ 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')
}); });

View File

@ -16,7 +16,17 @@
* limitations under the License. * 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'; import AppTableController from '../app-table-columns';
export default AppTableController.extend({ 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')
}); });

View File

@ -19,8 +19,16 @@
import Ember from 'ember'; import Ember from 'ember';
import ColumnDef from 'em-table/utils/column-definition'; import ColumnDef from 'em-table/utils/column-definition';
import TableDefinition from 'em-table/utils/table-definition';
export default Ember.Controller.extend({ 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() { columns: function() {
var colums = []; var colums = [];
colums.push({ colums.push({

View File

@ -20,7 +20,7 @@
<h4 align="center">Loading...</h4> <h4 align="center">Loading...</h4>
{{else}} {{else}}
{{#if model.apps}} {{#if model.apps}}
{{em-table columns=columns rows=model.apps}} {{em-table columns=columns rows=model.apps definition=tableDefinition}}
{{else}} {{else}}
<h4 align="center">Could not find any applications from this cluster</h4> <h4 align="center">Could not find any applications from this cluster</h4>
{{/if}} {{/if}}

View File

@ -17,7 +17,7 @@
--}} --}}
{{#if model.apps}} {{#if model.apps}}
{{em-table columns=columns rows=model.apps}} {{em-table columns=columns rows=model.apps definition=tableDefinition}}
{{else}} {{else}}
<h4 align="center">Could not find any applications from this cluster</h4> <h4 align="center">Could not find any applications from this cluster</h4>
{{/if}} {{/if}}

View File

@ -18,7 +18,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{{#if model.nodes}} {{#if model.nodes}}
{{em-table columns=columns rows=model.nodes}} {{em-table columns=columns rows=model.nodes definition=tableDefinition}}
{{else}} {{else}}
<h4 align="center">No nodes found on this cluster</h4> <h4 align="center">No nodes found on this cluster</h4>
{{/if}} {{/if}}