ソースを参照

AMBARI-6865. Visiting Hosts page causes the table to flash twice (should only show the spinner once, not twice). (akovalenko)

Aleksandr Kovalenko 11 年 前
コミット
c6c216542c

+ 1 - 1
ambari-web/app/templates/main/menu_item.hbs

@@ -17,7 +17,7 @@
 }}
 
 
-<a href="#/main/{{unbound view.content.routing}}">
+<a href="#" {{action goToSection view.content.routing target="view"}}>
   {{{unbound view.content.label}}}
   {{#if view.alertsCount}}
     <span class="label label-important alerts-count">

+ 3 - 3
ambari-web/app/views/common/table_view.js

@@ -89,10 +89,11 @@ App.TableView = Em.View.extend(App.UserPref, {
     var name = this.get('controller.name');
     var self = this;
     var filterConditions = App.db.getFilterConditions(name);
-    if ((filterConditions && name != 'mainHostController') || (filterConditions && this.get('controller.showFilterConditionsFirstLoad'))) {
+    if (filterConditions) {
       this.set('filterConditions', filterConditions);
-      this.get('controller').set('showFilterConditionsFirstLoad', false);
+
       var childViews = this.get('childViews');
+
       filterConditions.forEach(function (condition, index, filteredConditions) {
         var view = !Em.isNone(condition.iColumn) && childViews.findProperty('column', condition.iColumn);
         if (view) {
@@ -111,7 +112,6 @@ App.TableView = Em.View.extend(App.UserPref, {
         }
       });
     } else {
-      this.clearFilters();
       this.set('tableFilteringComplete', true);
     }
   },

+ 3 - 0
ambari-web/app/views/main/host.js

@@ -193,6 +193,9 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
    * Restore filter properties in view
    */
   willInsertElement: function () {
+    if (!this.get('controller.showFilterConditionsFirstLoad')) {
+      this.clearFilterCondition();
+    }
     this._super();
     this.set('startIndex', this.get('controller.startIndex'));
     this.addObserver('pageContent.@each.selected', this, this.selectedHostsObserver);

+ 6 - 0
ambari-web/app/views/main/menu.js

@@ -117,6 +117,12 @@ App.MainMenuView = Em.CollectionView.extend({
     isViewsItem: function () {
       return this.get('content').routing == 'views';
     }.property(''),
+    goToSection: function (event) {
+      if (event.context === 'hosts') {
+        App.router.set('mainHostController.showFilterConditionsFirstLoad', false);
+      }
+      App.router.route('main/' + event.context);
+    },
     goToCategory: function (event) {
       var itemName = this.get('content').routing;
       // route to correct category of current menu item