Repository: tez Updated Branches: refs/heads/master d7ba1098e -> e9344fb6e
TEZ-2894. Tez UI: Disable sorting for few columns while in progress. Display an alert on trying to sort them (sree) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/e9344fb6 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/e9344fb6 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/e9344fb6 Branch: refs/heads/master Commit: e9344fb6eb7155c777b644512795189919e88231 Parents: d7ba109 Author: Sreenath Somarajapuram <[email protected]> Authored: Thu Nov 5 07:51:48 2015 +0530 Committer: Sreenath Somarajapuram <[email protected]> Committed: Thu Nov 5 07:51:48 2015 +0530 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../components/basic-table/column-definition.js | 2 ++ .../components/basic-table/header-cell-view.js | 7 ++++++- .../controllers/dag-task-attempts-controller.js | 4 +++- .../webapp/app/scripts/controllers/dag_tasks.js | 4 +++- .../controllers/table-page-controller.js | 12 +++++++++++ .../task_task_attempts_controller.js | 2 ++ .../vertex_task_attempts_controller.js | 2 ++ .../controllers/vertex_tasks_controller.js | 2 ++ .../main/webapp/app/scripts/helpers/dialogs.js | 22 +++++++++++++++++++- .../src/main/webapp/app/scripts/helpers/misc.js | 7 +++++-- .../scripts/mixins/auto-counter-column-mixin.js | 2 +- 12 files changed, 60 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 355a85c..c4113f2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES TEZ-2679. Admin forms of launch env settings ALL CHANGES: + TEZ-2894. Tez UI: Disable sorting for few columns while in progress. Display an alert on trying to sort them TEZ-2893. Tez UI: Retain vertex info displayed in DAG details page even after completion TEZ-2878. Tez UI: AM error handling - Make the UI handle cases in which AM returns unexpected/no data TEZ-2922. Tez Live UI gives access denied for admins http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/components/basic-table/column-definition.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/components/basic-table/column-definition.js b/tez-ui/src/main/webapp/app/scripts/components/basic-table/column-definition.js index 3e29a45..27e6a9f 100644 --- a/tez-ui/src/main/webapp/app/scripts/components/basic-table/column-definition.js +++ b/tez-ui/src/main/webapp/app/scripts/components/basic-table/column-definition.js @@ -33,6 +33,8 @@ App.BasicTableComponent.ColumnDefinition = (function () { headerCellName: "Not Available!", searchAndSortable: true, + onSort: null, + width: "", customStyle: function () { http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/components/basic-table/header-cell-view.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/components/basic-table/header-cell-view.js b/tez-ui/src/main/webapp/app/scripts/components/basic-table/header-cell-view.js index b4f1165..4cfe6e8 100644 --- a/tez-ui/src/main/webapp/app/scripts/components/basic-table/header-cell-view.js +++ b/tez-ui/src/main/webapp/app/scripts/components/basic-table/header-cell-view.js @@ -52,7 +52,12 @@ App.BasicTableComponent.HeaderCellView = Ember.View.extend({ actions: { sort: function () { - this.get('parentView').send('sort', this.get('column.id')); + var column = this.get('column'), + onSort = column.get('onSort'); + + if(!onSort || onSort.call(column, column)) { + this.get('parentView').send('sort', this.get('column.id')); + } }, startColResize: function () { var mouseTracker = { http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/controllers/dag-task-attempts-controller.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/dag-task-attempts-controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/dag-task-attempts-controller.js index ade2c7f..a5e5200 100644 --- a/tez-ui/src/main/webapp/app/scripts/controllers/dag-task-attempts-controller.js +++ b/tez-ui/src/main/webapp/app/scripts/controllers/dag-task-attempts-controller.js @@ -140,6 +140,7 @@ App.DagTaskAttemptsController = App.TablePageController.extend({ templateName: 'components/basic-table/status-cell', contentPath: 'status', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), getCellContent: function(row) { var status = App.Helpers.misc.getFixedupDisplayStatus(row.get('status')); return { @@ -153,6 +154,7 @@ App.DagTaskAttemptsController = App.TablePageController.extend({ headerCellName: 'Progress', contentPath: 'progress', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), templateName: 'components/basic-table/progress-cell' }, { @@ -260,7 +262,7 @@ App.DagTaskAttemptsController = App.TablePageController.extend({ App.get('Configs.tables.entity.taskAttempt') || [], App.get('Configs.tables.sharedColumns') || [] ) - ) + , this) ); }.property('defaultColumnConfigs'), http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/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 33a11d6..d8cae6a 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 @@ -145,6 +145,7 @@ App.DagTasksController = App.TablePageController.extend({ templateName: 'components/basic-table/status-cell', contentPath: 'status', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), getCellContent: function(row) { var status = row.get('status'); return { @@ -159,6 +160,7 @@ App.DagTasksController = App.TablePageController.extend({ headerCellName: 'Progress', contentPath: 'progress', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), templateName: 'components/basic-table/progress-cell' }, { @@ -229,7 +231,7 @@ App.DagTasksController = App.TablePageController.extend({ App.get('Configs.tables.entity.task') || [], App.get('Configs.tables.sharedColumns') || [] ) - ) + , this) ); }.property('defaultColumnConfigs'), http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/controllers/table-page-controller.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/table-page-controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/table-page-controller.js index 285cc69..cf3d02c 100644 --- a/tez-ui/src/main/webapp/app/scripts/controllers/table-page-controller.js +++ b/tez-ui/src/main/webapp/app/scripts/controllers/table-page-controller.js @@ -62,6 +62,18 @@ App.TablePageController = App.PollingController.extend( return this.get('loading') ? "Loading all records..." : null; }.property('loading'), + onInProgressColumnSort: function (columnDef) { + var inProgress = this.get('pollster.isRunning'); + if(inProgress) { + App.Helpers.Dialogs.alert( + 'Cannot sort', + 'Sorting on %@ is disabled for in-progress DAGs!'.fmt(columnDef.get('headerCellName')), + this + ); + } + return !inProgress; + }, + actions: { refresh: function () { this.loadData(true); http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/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 eef2a4a..73151bf 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 @@ -123,6 +123,7 @@ App.TaskAttemptsController = App.TablePageController.extend(App.AutoCounterColum templateName: 'components/basic-table/status-cell', contentPath: 'status', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), getCellContent: function(row) { var status = App.Helpers.misc.getFixedupDisplayStatus(row.get('status')); return { @@ -136,6 +137,7 @@ App.TaskAttemptsController = App.TablePageController.extend(App.AutoCounterColum headerCellName: 'Progress', contentPath: 'progress', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), templateName: 'components/basic-table/progress-cell' }, { http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/controllers/vertex_task_attempts_controller.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_task_attempts_controller.js b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_task_attempts_controller.js index f9fa086..8f1e8f5 100644 --- a/tez-ui/src/main/webapp/app/scripts/controllers/vertex_task_attempts_controller.js +++ b/tez-ui/src/main/webapp/app/scripts/controllers/vertex_task_attempts_controller.js @@ -140,6 +140,7 @@ App.VertexTaskAttemptsController = App.TablePageController.extend(App.AutoCounte templateName: 'components/basic-table/status-cell', contentPath: 'status', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), getCellContent: function(row) { var status = App.Helpers.misc.getFixedupDisplayStatus(row.get('status')); return { @@ -153,6 +154,7 @@ App.VertexTaskAttemptsController = App.TablePageController.extend(App.AutoCounte headerCellName: 'Progress', contentPath: 'progress', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), templateName: 'components/basic-table/progress-cell' }, { http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/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 5ffa185..88b8dee 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 @@ -128,6 +128,7 @@ App.VertexTasksController = App.TablePageController.extend(App.AutoCounterColumn templateName: 'components/basic-table/status-cell', contentPath: 'status', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), getCellContent: function(row) { var status = row.get('status'); return { @@ -142,6 +143,7 @@ App.VertexTasksController = App.TablePageController.extend(App.AutoCounterColumn headerCellName: 'Progress', contentPath: 'progress', observePath: true, + onSort: this.onInProgressColumnSort.bind(this), templateName: 'components/basic-table/progress-cell' }, { http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/helpers/dialogs.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/dialogs.js b/tez-ui/src/main/webapp/app/scripts/helpers/dialogs.js index ddf7535..d4cdfae 100644 --- a/tez-ui/src/main/webapp/app/scripts/helpers/dialogs.js +++ b/tez-ui/src/main/webapp/app/scripts/helpers/dialogs.js @@ -16,7 +16,27 @@ * limitations under the License. */ -App.Dialogs = Em.Namespace.create({ +App.Helpers.Dialogs = Em.Namespace.create({ + + /** + * Shows an alert box with a title and body + * @param title {String} The alert window title + * @param message {String} The alert message + * @param controller {Controller} Active ember controller + */ + alert: function (title, message, controller) { + Bootstrap.ModalManager.open( + 'alertModal', + title, + Ember.View.extend({ + template: Em.Handlebars.compile( + '<p id="modalMessage">%@</p>'.fmt(message) + ) + }), [ + Ember.Object.create({title: 'OK', dismiss: 'modal'}) + ], controller); + }, + /* * Displays a dialog with a multiselector based on the provided data. * - Helper looks for id & displayText in listItems. http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/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 d6bd67a..550a758 100644 --- a/tez-ui/src/main/webapp/app/scripts/helpers/misc.js +++ b/tez-ui/src/main/webapp/app/scripts/helpers/misc.js @@ -160,7 +160,7 @@ App.Helpers.misc = { * @param counterConfigs Array * @return Normalized configurations */ - normalizeCounterConfigs: function (counterConfigs, inProgress) { + normalizeCounterConfigs: function (counterConfigs, controller) { return counterConfigs.map(function (configuration) { var groupName = configuration.counterGroupName || configuration.groupId, counterName = configuration.counterName || configuration.counterId; @@ -175,7 +175,10 @@ App.Helpers.misc = { configuration.contentPath = 'counterGroups'; configuration.counterGroupName = groupName; configuration.counterName = counterName; - configuration.searchAndSortable = !inProgress; + + if(controller) { + configuration.onSort = controller.onInProgressColumnSort.bind(controller); + } configuration.getSortValue = App.Helpers.misc.getCounterCellContent; configuration.getCellContent = http://git-wip-us.apache.org/repos/asf/tez/blob/e9344fb6/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js b/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js index 2c6b531..e868117 100644 --- a/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js +++ b/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js @@ -32,7 +32,7 @@ App.AutoCounterColumnMixin = Em.Mixin.create({ App.get('Configs.tables.entity.' + this.get('baseEntityType')) || [], App.get('Configs.tables.sharedColumns') || [] ) - ), dynamicCounterConfigs = []; + , this), dynamicCounterConfigs = []; this.get('data').forEach(function (row) { var counterGroups = row.get('counterGroups');
