ソースを参照

AMBARI-8735. Preparing to deploy issue for 1.3 stack. (onechiporenko)

Oleg Nechiporenko 10 年 前
コミット
a840c24d5e

+ 2 - 2
ambari-web/app/controllers/wizard/step7_controller.js

@@ -721,8 +721,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
         serviceConfigs.findProperty('serviceName', 'HDFS').configs = c;
       }
 
-      // Remove Notifications from MISC if it isn't Installer Controller
-      if (this.get('wizardController.name') !== 'installerController') {
+      // Remove Notifications from MISC if it isn't Installer Controller or stack is < 2.0
+      if (this.get('wizardController.name') !== 'installerController' || !App.get('isHadoop2Stack')) {
         var miscService = serviceConfigs.findProperty('serviceName', 'MISC');
         if (miscService) {
           c = miscService.configs;

+ 2 - 2
ambari-web/app/controllers/wizard/step8_controller.js

@@ -1827,11 +1827,11 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
 
   /**
    * Create one Alert Notification (if user select this on step7)
-   * Only for Install Wizard!
+   * Only for Install Wizard and stack >= 2!
    * @method createNotification
    */
   createNotification: function () {
-    if (this.get('content.controllerName') !== 'installerController') return;
+    if (this.get('content.controllerName') !== 'installerController' || !App.get('isHadoop2Stack')) return;
     var miscConfigs = this.get('configs').filterProperty('serviceName', 'MISC'),
       createNotification = miscConfigs.findProperty('name', 'create_notification').value;
     if (createNotification === 'yes') {

+ 4 - 0
ambari-web/app/views/common/configs/services_config.js

@@ -801,6 +801,10 @@ App.ServiceConfigContainerView = Em.ContainerView.extend({
       }
       var categoriesToPush = [];
       this.get('controller.selectedService.configCategories').forEach(function (item) {
+
+        // stack 1.3 doesn't need customView
+        if (!App.get('isHadoop2Stack') && item.get('isCustomView')) return;
+
         var categoryView = item.get('isCustomView') ? item.get('customView') : App.ServiceConfigsByCategoryView;
         if (categoryView !== null) {
           categoriesToPush.pushObject(categoryView.extend({

+ 1 - 0
ambari-web/test/controllers/wizard/step7_test.js

@@ -1107,6 +1107,7 @@ describe('App.InstallerStep7Controller', function () {
       });
     });
   });
+
   describe('#_updateValueForCheckBoxConfig', function () {
     Em.A([
         {

+ 33 - 6
ambari-web/test/controllers/wizard/step8_test.js

@@ -905,7 +905,6 @@ describe('App.WizardStep8Controller', function () {
     });
   });
 
-
   describe('#createStormSiteObj', function() {
     it('should replace quote \'"\' to "\'" for some properties', function() {
       var configs = [
@@ -1058,10 +1057,6 @@ describe('App.WizardStep8Controller', function () {
     });
   });
 
-  describe('#formatProperties', function() {
-
-  });
-
   describe('#applyInstalledServicesConfigurationGroup', function() {
     beforeEach(function() {
       sinon.stub($, 'ajax', Em.K);
@@ -1297,7 +1292,6 @@ describe('App.WizardStep8Controller', function () {
 
     });
 
-
     describe('#createAdditionalHostComponents', function() {
 
       beforeEach(function() {
@@ -1402,6 +1396,39 @@ describe('App.WizardStep8Controller', function () {
 
     });
 
+    describe('#createNotification', function () {
+
+      beforeEach(function () {
+        installerStep8Controller.set('content', {controllerName: 'installerController'});
+        installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
+        installerStep8Controller.set('configs', [
+          {name: 'create_notification', value: 'yes', serviceName: 'MISC'},
+          {name: 'ambari.dispatch.recipients', value: 'to@f.c', serviceName: 'MISC'},
+          {name: 'mail.smtp.host', value: 'h', serviceName: 'MISC'},
+          {name: 'mail.smtp.port', value: '25', serviceName: 'MISC'},
+          {name: 'mail.smtp.from', value: 'from@f.c', serviceName: 'MISC'},
+          {name: 'mail.smtp.starttls.enable', value: true, serviceName: 'MISC'},
+          {name: 'mail.smtp.startssl.enable', value: false, serviceName: 'MISC'},
+          {name: 'smtp_use_auth', value: 'false', serviceName: 'MISC'},
+        ]);
+        sinon.stub(App, 'get', function (k) {
+          if ('isHadoop2Stack' === k) return true;
+          return Em.get(App, k);
+        });
+      });
+
+      afterEach(function () {
+        App.get.restore();
+      });
+
+      it('should add request to queue', function () {
+
+        installerStep8Controller.createNotification();
+        expect(installerStep8Controller.get('ajaxRequestsQueue.queue.length')).to.equal(1);
+
+      });
+
+    });
 
   });