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.
*/
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')
});

View File

@ -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')
});

View File

@ -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({

View File

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

View File

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

View File

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