Browse Source

AMBARI-3952. SNameNode should not be available in AddServiceWizard if HA is enabled. (onechiporenko)

Oleg Nechiporenko 11 years ago
parent
commit
34c6d94b41

+ 13 - 0
ambari-web/app/controllers/wizard/step5_controller.js

@@ -33,6 +33,10 @@ App.WizardStep5Controller = Em.Controller.extend({
     return this.get('content.controllerName') == 'reassignMasterController';
   }.property('content.controllerName'),
 
+  isAddServiceWizard: function() {
+    return this.get('content.controllerName') == 'addServiceController';
+  }.property('content.controllerName'),
+
   isReassignHive: function () {
     return this.get('servicesMasters').objectAt(0) && this.get('servicesMasters').objectAt(0).component_name == 'HIVE_SERVER' && this.get('isReassignWizard');
   }.property('isReassignWizard', 'servicesMasters'),
@@ -219,6 +223,7 @@ App.WizardStep5Controller = Em.Controller.extend({
    * @param masterComponents
    */
   renderComponents:function (masterComponents) {
+    var self = this;
     var services = this.get('content.services')
       .filterProperty('isInstalled', true).mapProperty('serviceName'); //list of shown services
     var hosts = this.get('hosts');
@@ -236,6 +241,14 @@ App.WizardStep5Controller = Em.Controller.extend({
 
     masterComponents.forEach(function (item) {
 
+      if (item.component_name == 'SECONDARY_NAMENODE') {
+        if (self.get('isAddServiceWizard')) {
+          if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+            return;
+          }
+        }
+      }
+
       var componentObj = Ember.Object.create(item);
       console.log("TRACE: render master component name is: " + item.component_name);
 

+ 10 - 0
ambari-web/app/controllers/wizard/step7_controller.js

@@ -123,6 +123,16 @@ App.WizardStep7Controller = Em.Controller.extend({
       this.get('selectedServiceNames').forEach(function(serviceName) {
         serviceConfigs.findProperty('serviceName', serviceName).set('selected', true);
       });
+
+      // Remove SNameNode if HA is enabled
+      if (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) {
+        configs = serviceConfigs.findProperty('serviceName', 'HDFS').configs;
+        var removedConfigs = configs.filterProperty('category', 'SNameNode');
+        removedConfigs.map(function(config) {
+          configs = configs.without(config);
+        });
+        serviceConfigs.findProperty('serviceName', 'HDFS').configs = configs;
+      }
     }
 
     this.set('stepConfigs', serviceConfigs);