Browse Source

AMBARI-10455. Multible active tabs showing on service config section (Richard Zang via srimanth)

Srimanth Gunturi 10 years ago
parent
commit
ad1ad93181

+ 1 - 7
ambari-web/app/views/common/configs/service_config_layout_tab_view.js

@@ -189,13 +189,7 @@ App.ServiceConfigLayoutTabView = Em.View.extend(App.ConfigOverridable, {
       }
     }
     // no more active tab? pick the first non hidden tab and make it active
-    var activeTab = this.get('parentView.tabs').findProperty('isActive', true);
-    if (!activeTab) {
-      var nonHiddenTabs = this.get('parentView.tabs').filter(function (tab) {
-        return !(tab.get('isHiddenByFilter') === true);
-      });
-      nonHiddenTabs.get('firstObject').set('isActive', true);
-    }
+    this.get('parentView').pickActiveTab(this.get('parentView.tabs'));
   }.observes('parentView.filter', 'parentView.columns.@each.selected'),
 
   willInsertElement: function () {

+ 14 - 2
ambari-web/app/views/common/configs/service_config_view.js

@@ -109,11 +109,23 @@ App.ServiceConfigView = Em.View.extend({
     }
     var tabs = App.Tab.find().filterProperty('serviceName', this.get('controller.selectedService.serviceName'));
     this.processTabs(tabs);
-    // make first tab active
-    tabs.get('firstObject').set('isActive', true);
+    this.pickActiveTab(tabs);
     return tabs;
   }.property('controller.selectedService.serviceName'),
 
+  /**
+   * Pick the first non hidden tab and make it active when there is no active tab
+   */
+  pickActiveTab : function (tabs) {
+    var activeTab = tabs.findProperty('isActive', true);
+    if (!activeTab) {
+      var nonHiddenTabs = tabs.filter(function (tab) {
+        return !(tab.get('isHiddenByFilter') === true);
+      });
+      nonHiddenTabs.get('firstObject').set('isActive', true);
+    }
+  },
+
   /**
    * Data reordering before rendering.
    * Reorder all sections/subsections into rows based on their rowIndex