This is an automated email from the ASF dual-hosted git repository. ababiichuk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 30d9ce0 AMBARI-23911 Selection information not present in Hosts page filtering. (ababiichuk) 30d9ce0 is described below commit 30d9ce0c5871d50f671722f1351d2377fd4b28db Author: ababiichuk <ababiic...@hortonworks.com> AuthorDate: Mon May 21 14:26:11 2018 +0300 AMBARI-23911 Selection information not present in Hosts page filtering. (ababiichuk) --- ambari-web/app/mixins/common/table_server_view_mixin.js | 5 +++-- ambari-web/app/templates/main/host.hbs | 9 +++++++++ ambari-web/app/templates/wizard/step3.hbs | 8 ++++++++ ambari-web/app/views/main/host.js | 9 +++++---- ambari-web/app/views/wizard/step3_view.js | 3 +++ 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ambari-web/app/mixins/common/table_server_view_mixin.js b/ambari-web/app/mixins/common/table_server_view_mixin.js index 9695579..6fdbaa1 100644 --- a/ambari-web/app/mixins/common/table_server_view_mixin.js +++ b/ambari-web/app/mixins/common/table_server_view_mixin.js @@ -65,8 +65,9 @@ App.TableServerViewMixin = Em.Mixin.create({ * @param iColumn * @param value * @param type + * @param preserveSelection */ - updateFilter: function (iColumn, value, type) { + updateFilter: function (iColumn, value, type, preserveSelection) { // Do not even trigger update flow if it's a blank update if (this.isBlankFilterUpdate(iColumn, value, type)) { return; } @@ -82,7 +83,7 @@ App.TableServerViewMixin = Em.Mixin.create({ this.set('controller.resetStartIndex', true); //save filter only when it's applied this.saveFilterConditions(iColumn, value, type, false); - this.refresh(); + this.refresh(preserveSelection); } return true; }, diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs index fe6780c..86ab272 100644 --- a/ambari-web/app/templates/main/host.hbs +++ b/ambari-web/app/templates/main/host.hbs @@ -130,6 +130,15 @@ <tfoot> <tr> <td colspan="13"> + {{#if view.showSelectedFilter}} + <div class="display-inline-block"> + <a {{action filterSelected target="view"}} href="#"> + {{view.selectedHosts.length}} + {{pluralize view.selectedHostsCount singular="t:hosts.filters.selectedHostInfo" plural="t:hosts.filters.selectedHostsInfo"}} + </a> + - <a {{action clearSelection target="view"}} href="#">{{t hosts.filters.clearSelection}}</a> + </div> + {{/if}} {{view App.PaginationView isDataLoadedBinding="view.filteringComplete" rowsPerPageSelectViewBinding="view.rowsPerPageSelectView"}} </td> </tr> diff --git a/ambari-web/app/templates/wizard/step3.hbs b/ambari-web/app/templates/wizard/step3.hbs index 5290845..bb5ac66 100644 --- a/ambari-web/app/templates/wizard/step3.hbs +++ b/ambari-web/app/templates/wizard/step3.hbs @@ -120,6 +120,14 @@ <tfoot> <tr> <td colspan="5"> + {{#if view.selectedHostsCount}} + <a {{action selectedHostsPopup target="controller"}} href="#"> + {{view.selectedHostsCount}} + {{pluralize view.selectedHostsCount singular="t:hosts.filters.selectedHostInfo" plural="t:hosts.filters.selectedHostsInfo"}} + </a> + - + <a {{action unSelectAll target="view"}} href="#">{{t hosts.filters.clearSelection}}</a> + {{/if}} {{view App.PaginationView}} </td> </tr> diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js index e6ca992..f91af3b 100644 --- a/ambari-web/app/views/main/host.js +++ b/ambari-web/app/views/main/host.js @@ -79,12 +79,14 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, { * request latest data filtered by new parameters * called when trigger property(<code>refreshTriggers</code>) is changed */ - refresh: function () { + refresh: function (preserveSelection) { App.loadTimer.start('Hosts Page'); this.set('filteringComplete', false); var updaterMethodName = this.get('updater.tableUpdaterMap')[this.get('tableName')]; this.get('updater')[updaterMethodName](this.updaterSuccessCb.bind(this), this.updaterErrorCb.bind(this), true); - this.clearSelection(); + if (!preserveSelection) { + this.clearSelection(); + } return true; }, @@ -255,7 +257,6 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, { this.set('selectAllHosts', false); } this.combineSelectedFilter(); - //10 is an index of selected column App.db.setSelectedHosts(this.get('selectedHosts')); this.addObserver('selectAllHosts', this, this.toggleAllHosts); @@ -282,7 +283,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, { */ filterSelected: function() { //10 is an index of selected column - this.updateFilter(10, this.get('selectedHosts'), 'multiple'); + this.updateFilter(10, this.get('selectedHosts'), 'multiple', true); }, /** diff --git a/ambari-web/app/views/wizard/step3_view.js b/ambari-web/app/views/wizard/step3_view.js index de4a1a7..46c44bc 100644 --- a/ambari-web/app/views/wizard/step3_view.js +++ b/ambari-web/app/views/wizard/step3_view.js @@ -154,13 +154,16 @@ App.WizardStep3View = App.TableView.extend({ this.set('selectionInProgress', false); var noNotRunningHostsSelected = true; var selectedNotRunningHostsCount = 0; + var selectedHostsCount = 0; this.get('content').forEach(function(host){ var isSelectedAndNotRunning = host.get('isChecked') && (host.get('bootStatus') !== 'RUNNING'); + selectedHostsCount += host.get('isChecked') ? 1 : 0; selectedNotRunningHostsCount += isSelectedAndNotRunning ? 1 : 0; noNotRunningHostsSelected = (noNotRunningHostsSelected) ? !isSelectedAndNotRunning : noNotRunningHostsSelected; }); this.set('noNotRunningHostsSelected', noNotRunningHostsSelected); this.set('selectedNotRunningHostsCount', selectedNotRunningHostsCount); + this.set('selectedHostsCount', selectedHostsCount); }, /** -- To stop receiving notification emails like this one, please contact ababiic...@apache.org.