소스 검색

AMBARI-20415. JS error when filtering config history table (onechiporenko)

Oleg Nechiporenko 8 년 전
부모
커밋
bec836e84e

+ 6 - 0
ambari-web/app/mixins/common/table_server_view_mixin.js

@@ -149,6 +149,12 @@ App.TableServerViewMixin = Em.Mixin.create({
       this.refresh();
     }
   },
+
+  /**
+   * Placeholder for `saveStartIndex`
+   */
+  saveStartIndex: Em.K,
+
   /**
    * when new filter applied page index should be reset to first page
    */

+ 4 - 0
ambari-web/app/views/main/dashboard/config_history_view.js

@@ -231,6 +231,10 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, {
     App.loadTimer.finish('Config History Page');
   },
 
+  saveStartIndex: function() {
+    App.db.setStartIndex(this.get('controller.name'), this.get('startIndex'));
+  }.observes('startIndex'),
+
   /**
    * associations between host property and column index
    * @type {Array}

+ 2 - 1
ambari-web/test/mixins/common/table_server_view_mixin_test.js

@@ -28,7 +28,6 @@ describe('App.MainConfigHistoryView', function() {
     filteredContent: [],
     refresh: Em.K,
     saveFilterConditions: Em.K,
-    saveStartIndex: sinon.spy(),
     controller: Em.Object.create({
       name: 'mainConfigHistoryController',
       paginationProps: [
@@ -212,8 +211,10 @@ describe('App.MainConfigHistoryView', function() {
   describe('#resetStartIndex()', function() {
     beforeEach(function () {
       sinon.stub(view, 'updatePagination');
+      sinon.spy(view, 'saveStartIndex');
     });
     afterEach(function () {
+      view.saveStartIndex.restore();
       view.updatePagination.restore();
     });
     it('resetStartIndex is false and filteredCount is 0', function() {