AMBARI-7513 Config History tab. "Created" filter's items remove after using. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a43c0816 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a43c0816 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a43c0816 Branch: refs/heads/branch-alerts-dev Commit: a43c0816bcce43d5ef181284fbb38431d02ead6d Parents: e95ec96 Author: atkach <[email protected]> Authored: Fri Sep 26 15:42:17 2014 +0300 Committer: atkach <[email protected]> Committed: Fri Sep 26 15:42:17 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/views/common/filter_view.js | 20 ++++++++++++++------ ambari-web/app/views/common/table_view.js | 1 + .../views/main/dashboard/config_history_view.js | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a43c0816/ambari-web/app/views/common/filter_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/filter_view.js b/ambari-web/app/views/common/filter_view.js index 83d23a7..a730a05 100644 --- a/ambari-web/app/views/common/filter_view.js +++ b/ambari-web/app/views/common/filter_view.js @@ -90,6 +90,12 @@ var wrapperView = Ember.View.extend({ emptyValue: '', /** + * empty value that actually applied to filtering on server, + * used with Select filter where displayed and actual filter value are different + */ + appliedEmptyValue: "", + + /** * reset value to empty string if emptyValue selected */ actualValue: function () { @@ -202,12 +208,14 @@ var wrapperView = Ember.View.extend({ // value assigned to hidden option hiddenValue = values[Number(currentValueIndex == 0)]; }, this); - // our select - var $select = $(this.get('element')).find(this.get('classInlineAttr')); - // now hide option with current value - $select.find('option[value="{0}"]'.format(this.get('value'))).css('display', 'none'); - // and show option that was hidden - $select.find('option[value="{0}"'.format(hiddenValue)).css('display', 'block'); + if (hiddenValue) { + // our select + var $select = $(this.get('element')).find(this.get('classInlineAttr')); + // now hide option with current value + $select.find('option[value="{0}"]'.format(this.get('value'))).css('display', 'none'); + // and show option that was hidden + $select.find('option[value="{0}"'.format(hiddenValue)).css('display', 'block'); + } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/a43c0816/ambari-web/app/views/common/table_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js index 29f87b9..1efe044 100644 --- a/ambari-web/app/views/common/table_view.js +++ b/ambari-web/app/views/common/table_view.js @@ -99,6 +99,7 @@ App.TableView = Em.View.extend(App.UserPref, { if (view) { if (view.get('emptyValue')) { view.set('value', view.get('emptyValue')); + self.saveFilterConditions(condition.iColumn, view.get('appliedEmptyValue'), condition.type, false); } else { view.set('value', condition.value); } http://git-wip-us.apache.org/repos/asf/ambari/blob/a43c0816/ambari-web/app/views/main/dashboard/config_history_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js index 49e1d82..cd05711 100644 --- a/ambari-web/app/views/main/dashboard/config_history_view.js +++ b/ambari-web/app/views/main/dashboard/config_history_view.js @@ -155,6 +155,7 @@ App.MainConfigHistoryView = App.TableView.extend({ displayAs: 'Custom' } ], + appliedEmptyValue: ["", ""], fieldType: 'filter-input-width,modified-filter', content: ['Any', 'Past 1 hour', 'Past 1 Day', 'Past 2 Days', 'Past 7 Days', 'Past 14 Days', 'Past 30 Days', 'Custom', 'Custom2'], valueBinding: "controller.modifiedFilter.optionValue",
