Repository: ambari
Updated Branches:
  refs/heads/trunk 08d73372e -> 5659711cf


AMBARI-8928 Hide "Custom" option in Dashboard > Config History. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5659711c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5659711c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5659711c

Branch: refs/heads/trunk
Commit: 5659711cfd800aaacab619fae55d94a00cd0cd3a
Parents: 08d7337
Author: aBabiichuk <[email protected]>
Authored: Fri Dec 26 19:30:53 2014 +0200
Committer: aBabiichuk <[email protected]>
Committed: Fri Dec 26 19:30:53 2014 +0200

----------------------------------------------------------------------
 .../main/dashboard/config_history_controller.js | 23 ++++----------------
 ambari-web/app/views/common/filter_view.js      |  6 ++++-
 .../views/main/dashboard/config_history_view.js | 13 +++--------
 .../main/dashboard/config_history_view_test.js  |  4 +++-
 4 files changed, 15 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5659711c/ambari-web/app/controllers/main/dashboard/config_history_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/dashboard/config_history_controller.js 
b/ambari-web/app/controllers/main/dashboard/config_history_controller.js
index 125c304..5931b40 100644
--- a/ambari-web/app/controllers/main/dashboard/config_history_controller.js
+++ b/ambari-web/app/controllers/main/dashboard/config_history_controller.js
@@ -17,7 +17,6 @@
  */
 
 var App = require('app');
-var customDatePopup = require('/views/common/custom_date_popup');
 
 App.MainConfigHistoryController = 
Em.ArrayController.extend(App.TableServerMixin, {
   name: 'mainConfigHistoryController',
@@ -130,14 +129,6 @@ App.MainConfigHistoryController = 
Em.ArrayController.extend(App.TableServerMixin
       {
         value: 'Past 30 Days',
         label: 'Past 30 Days'
-      },
-      {
-        value: 'Custom',
-        label: 'Custom'
-      },
-      {
-        value: 'Custom2',
-        label: 'Custom'
       }
     ],
     optionValue: 'Any',
@@ -164,20 +155,14 @@ App.MainConfigHistoryController = 
Em.ArrayController.extend(App.TableServerMixin
         case 'Past 30 Days':
           time = curTime - 2592000000;
           break;
-        case 'Custom':
-        case 'Custom2':
-          customDatePopup.showCustomDatePopup(this, this.get('actualValues'));
-          break;
         case 'Any':
           time = "";
           break;
       }
-      if (!["Custom", "Custom2"].contains(this.get('optionValue.value'))) {
-        this.set("actualValues", {
-          endTime: '',
-          startTime: time
-        });
-      }
+      this.set("actualValues", {
+        endTime: '',
+        startTime: time
+      });
     }.observes('optionValue'),
     cancel: function () {
       this.set('optionValue', this.get('content').findProperty('value', 
'Any'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/5659711c/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 fac4b7c..c353045 100644
--- a/ambari-web/app/views/common/filter_view.js
+++ b/ambari-web/app/views/common/filter_view.js
@@ -66,6 +66,7 @@ var wrapperView = Ember.View.extend({
    * @type {Array}
    *
    **/
+  //TODO delete if will not be used
   triggeredOnSameValue: null,
 
   clearFilter: function () {
@@ -157,12 +158,14 @@ var wrapperView = Ember.View.extend({
     var parent = this.$().parent();
     this.set('parentNode', parent);
     parent.addClass('notActive');
-    this.checkSelectSpecialOptions();
+    //TODO delete if will not be used
+    //this.checkSelectSpecialOptions();
   },
 
   /**
    * Check for Em.Select that should use dispatching event when option with 
same value selected more than one time.
    **/
+    //TODO delete if will not be used
   checkSelectSpecialOptions: function () {
     // check predefined property
     if (!this.get('triggeredOnSameValue') || 
!this.get('triggeredOnSameValue').length) return;
@@ -195,6 +198,7 @@ var wrapperView = Ember.View.extend({
    * when option with same value selected more than one time.
    *
    **/
+  //TODO delete if will not be used
   valueCustomObserver: function () {
     var hiddenValue;
     this.get('triggeredOnSameValue').forEach(function (triggeredValue) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5659711c/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 bd3c2db..593ce70 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -142,19 +142,12 @@ App.MainConfigHistoryView = 
App.TableView.extend(App.TableServerViewMixin, {
     column: 3,
     appliedEmptyValue: ["", ""],
     fieldType: 'filter-input-width,modified-filter',
-    triggeredOnSameValue: [
-      {
-        values: ['Custom', 'Custom2'],
-        displayAs: 'Custom'
-      }
-    ],
     emptyValue: 'Any',
-    valueBinding: "controller.modifiedFilter.optionValue",
-    selectedBinding: "controller.modifiedFilter.optionValue",
     contentBinding: "controller.modifiedFilter.content",
-    onTimeChange: function () {
+    onChangeValue: function () {
+      this.set("controller.modifiedFilter.optionValue", this.get('selected'));
       this.get('parentView').updateFilter(this.get('column'), 
[this.get('controller.modifiedFilter.actualValues.startTime'), 
this.get('controller.modifiedFilter.actualValues.endTime')], 'range');
-    }.observes('controller.modifiedFilter.actualValues')
+    }
   }),
 
   authorFilterView: filters.createTextView({

http://git-wip-us.apache.org/repos/asf/ambari/blob/5659711c/ambari-web/test/views/main/dashboard/config_history_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/config_history_view_test.js 
b/ambari-web/test/views/main/dashboard/config_history_view_test.js
index a4958b6..c3669de 100644
--- a/ambari-web/test/views/main/dashboard/config_history_view_test.js
+++ b/ambari-web/test/views/main/dashboard/config_history_view_test.js
@@ -136,6 +136,8 @@ describe('App.MainConfigHistoryView', function() {
     });
   });
 
+  /**
+   * for now we don't use this method
   describe("#modifiedFilterView", function () {
     var subView = view.get('modifiedFilterView').create({
       parentView: view,
@@ -160,7 +162,7 @@ describe('App.MainConfigHistoryView', function() {
       subView.onTimeChange();
       expect(view.updateFilter.calledWith(1, [0, 1], 'range')).to.be.true;
     });
-  });
+  });*/
 
   describe("#authorFilterView", function () {
     var subView = view.get('authorFilterView').create({

Reply via email to