Ver código fonte

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

aBabiichuk 10 anos atrás
pai
commit
5659711cfd

+ 4 - 19
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'));

+ 5 - 1
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) {

+ 3 - 10
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({

+ 3 - 1
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({