ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-19441 Ambari should add warning when LogSearch selected without Ambari-Infra (atkach)
Date Tue, 10 Jan 2017 13:33:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 410f57e2a -> ba99a2944


AMBARI-19441 Ambari should add warning when LogSearch selected without Ambari-Infra (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ba99a294
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba99a294
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba99a294

Branch: refs/heads/trunk
Commit: ba99a29445f0f9f1b5d9936aee9a219b58a7335f
Parents: 410f57e
Author: Andrii Tkach <atkach@apache.org>
Authored: Tue Jan 10 13:09:46 2017 +0200
Committer: Andrii Tkach <atkach@apache.org>
Committed: Tue Jan 10 15:33:32 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard.js            |  2 +-
 .../app/controllers/wizard/step4_controller.js  | 22 +++--
 .../app/controllers/wizard/step7_controller.js  |  4 +-
 ambari-web/app/mappers/stack_service_mapper.js  |  3 -
 ambari-web/app/messages.js                      |  1 +
 ambari-web/app/utils/configs/theme/theme.js     |  6 +-
 .../test/controllers/wizard/step4_test.js       | 90 +++++++++++++++++---
 .../test/utils/configs/theme/theme_test.js      | 48 +++++------
 8 files changed, 129 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index b4fc8c5..7af9ab0 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -658,7 +658,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
     this.set('content.installedServiceNames', savedInstalledServices);
     if (!savedSelectedServices) {
       jsonData.items.forEach(function (service) {
-        service.StackServices.is_selected = true;
+        service.StackServices.is_selected = !(service.StackServices.selection === "TECH_PREVIEW");
       }, this);
     } else {
       jsonData.items.forEach(function (service) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/app/controllers/wizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js
index 317c548..9e61a7d 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -181,11 +181,8 @@ App.WizardStep4Controller = Em.ArrayController.extend({
       this.serviceValidation(callback, 'AMBARI_METRICS', 'ambariMetricsCheck');
       this.serviceValidation(callback, 'SMARTSENSE', 'smartSenseCheck');
     }
-    var atlasService = this.findProperty('serviceName', 'ATLAS');
-    var ambariInfraService = this.findProperty('serviceName', 'AMBARI_INFRA');
-    if (atlasService && atlasService.get('isSelected') && ambariInfraService
&& !ambariInfraService.get('isSelected')) {
-      this.serviceValidation(callback, 'AMBARI_INFRA', 'ambariInfraCheck');
-    }
+    this.dependentServiceValidation('ATLAS', 'AMBARI_INFRA', 'ambariInfraCheck', callback);
+    this.dependentServiceValidation('LOGSEARCH', 'AMBARI_INFRA', 'ambariLogsearchCheck',
callback);
     this.rangerValidation(callback);
     this.sparkValidation(callback);
     if (!!this.get('errorStack').filterProperty('isShown', false).length) {
@@ -199,6 +196,21 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   },
 
   /**
+   * display validation warning if dependent service not selected
+   * @param {string} selectedService
+   * @param {string} dependentService
+   * @param {string} checkId
+   * @param {Function} callback
+   */
+  dependentServiceValidation: function(selectedService, dependentService, checkId, callback)
{
+    var selected = this.findProperty('serviceName', selectedService);
+    var dependent = this.findProperty('serviceName', dependentService);
+    if (selected && selected.get('isSelected') && dependent && !dependent.get('isSelected'))
{
+      this.serviceValidation(callback, dependentService, checkId);
+    }
+  },
+
+  /**
    * Check whether user selected service to install and go to next step
    * @param callback {Function}
    * @param serviceName {string}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 0d30d12..2d83bca 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -523,7 +523,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     if (App.get('isKerberosEnabled') && this.get('wizardController.name') === 'addServiceController')
{
       this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs')
|| []);
     }
-    App.configTheme.resolveConfigThemeConditions(configs);
     var stepConfigs = this.createStepConfigs();
     var serviceConfigs = this.renderConfigs(stepConfigs, configs);
     // if HA is enabled -> Make some reconfigurations
@@ -578,6 +577,9 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   },
 
   completeConfigLoading: function() {
+    this.get('stepConfigs').forEach(function(service) {
+      App.configTheme.resolveConfigThemeConditions(service.get('configs'));
+    });
     this.clearRecommendationsByServiceName(App.StackService.find().filter(function (s) {
       return s.get('isSelected') && !s.get('isInstalled');
     }).mapProperty('serviceName'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index c0454b0..21c4db9 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -117,9 +117,6 @@ App.stackServiceMapper = App.QuickDataMapper.create({
         stackService.is_installable = false;
         stackService.is_selected = false;
       }
-      if (stackService.selection === "TECH_PREVIEW") {
-        stackService.is_selected = false;
-      }
       if(stackService.selection === "MANDATORY") {
         stackService.is_mandatory = true;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 0c3e10a..f02ba2a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -865,6 +865,7 @@ Em.I18n.translations = {
   'installer.step4.limitedFunctionality.popup.header':'Limited Functionality Warning',
   'installer.step4.ambariMetricsCheck.popup.body':'Ambari Metrics collects metrics from the
cluster and makes them available to Ambari.  If you do not install Ambari Metrics service,
metrics will not be accessible from Ambari.  Are you sure you want to proceed without Ambari
Metrics?',
   'installer.step4.ambariInfraCheck.popup.body':'Since Ambari Infra is not selected, you
must supply your own Solr to make Atlas work. Are you sure you want to proceed?',
+  'installer.step4.ambariLogsearchCheck.popup.body':'Since Ambari Infra is not selected,
you must supply your own Solr to make Log Search work. Are you sure you want to proceed?',
   'installer.step4.smartSenseCheck.popup.body':'SmartSense securely collects cluster diagnostics
in order to send you recommendations and automate analysis for ' +
   'troubleshooting support cases. If you choose not to install SmartSense, you will not receive
any recommendations, and you ' +
   'will need to collect configuration and logs manually for troubleshooting support cases.
' +

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/app/utils/configs/theme/theme.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/theme/theme.js b/ambari-web/app/utils/configs/theme/theme.js
index c3b312a..dbb4c14 100644
--- a/ambari-web/app/utils/configs/theme/theme.js
+++ b/ambari-web/app/utils/configs/theme/theme.js
@@ -38,11 +38,11 @@ App.configTheme = Em.Object.create({
             if (themeResource) {
               themeResource.get('configProperties').forEach(function (_configId) {
                 configs.forEach(function (item) {
-                  if (App.config.configId(item.name, item.filename) === _configId) {
+                  if (App.config.configId(item.get('name'), item.get('filename')) === _configId)
{
                     // if config has already been hidden by condition with "subsection" or
"subsectionTab" type
                     // then ignore condition of "config" type
-                    if (configCondition.get('type') === 'config' && item.hiddenBySection)
return false;
-                    item.hiddenBySection = !valueAttributes.visible;
+                    if (configCondition.get('type') === 'config' && item.get('hiddenBySection'))
return false;
+                    item.set('hiddenBySection', !valueAttributes.visible);
                   }
                 }, this);
               }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index b9b21cf..0fad0c1 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -24,11 +24,19 @@ require('controllers/wizard/step4_controller');
 describe('App.WizardStep4Controller', function () {
 
   var services = [
-    'HDFS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER', 'SMARTSENSE',
+    'HDFS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER', 'SMARTSENSE',
'LOGSEARCH',
     'YARN', 'MAPREDUCE2', 'FALCON', 'TEZ', 'STORM', 'AMBARI_METRICS', 'RANGER', 'SPARK',
'SLIDER', 'ATLAS', 'AMBARI_INFRA'
   ];
-
-  var controller = App.WizardStep4Controller.create();
+  var controller;
+
+  beforeEach(function() {
+    controller = App.WizardStep4Controller.create();
+    services.forEach(function(serviceName) {
+      controller.pushObject(Ember.Object.create({
+        'serviceName':serviceName, 'isSelected': true, 'isHiddenOnSelectServicePage': false,
'isInstalled': false, 'isDisabled': 'HDFS' === serviceName, isDFS: 'HDFS' === serviceName
+      }));
+    });
+  });
 
   var generateSelectedServicesContent = function(selectedServiceNames) {
     var allServices = services.slice(0);
@@ -58,12 +66,6 @@ describe('App.WizardStep4Controller', function () {
     return allServices;
   };
 
-  services.forEach(function(serviceName) {
-    controller.pushObject(Ember.Object.create({
-      'serviceName':serviceName, 'isSelected': true, 'isHiddenOnSelectServicePage': false,
'isInstalled': false, 'isDisabled': 'HDFS' === serviceName, isDFS: 'HDFS' === serviceName
-    }));
-  });
-
   describe('#isSubmitDisabled', function () {
     it('should return false if at least one selected service is not installed', function
() {
       expect(controller.get('isSubmitDisabled')).to.equal(false);
@@ -322,6 +324,10 @@ describe('App.WizardStep4Controller', function () {
         {
           services: ['ATLAS', 'AMBARI_METRICS', 'SMARTSENSE'],
           errorsExpected: ['ambariInfraCheck']
+        },
+        {
+          services: ['LOGSEARCH', 'AMBARI_METRICS', 'SMARTSENSE'],
+          errorsExpected: ['ambariLogsearchCheck']
         }
       ],
       controllerNames = ['installerController', 'addServiceController'],
@@ -979,11 +985,75 @@ describe('App.WizardStep4Controller', function () {
           this.popup.onClose();
           expect(target.clb.calledWith(id)).to.be.true;
         });
-
       });
+    });
+  });
 
+  describe('#dependentServiceValidation', function() {
+
+    beforeEach(function() {
+      sinon.stub(controller, 'serviceValidation');
     });
 
+    afterEach(function() {
+      controller.serviceValidation.restore();
+      controller.clear();
+    });
+
+    it('serviceValidation should not be called when selected service does not exist', function()
{
+      controller.dependentServiceValidation('S1', 'S2', 'check', Em.K);
+      expect(controller.serviceValidation.called).to.be.false;
+    });
+
+    it('serviceValidation should not be called when service not selected', function() {
+      controller.pushObject(Em.Object.create({
+        serviceName: 'S1',
+        isSelected: false
+      }));
+      controller.dependentServiceValidation('S1', 'S2', 'check', Em.K);
+      expect(controller.serviceValidation.called).to.be.false;
+    });
+
+    it('serviceValidation should not be called when dependent service does not exist', function()
{
+      controller.pushObjects([
+        Em.Object.create({
+          serviceName: 'S1',
+          isSelected: true
+        })
+      ]);
+      controller.dependentServiceValidation('S1', 'S2', 'check', Em.K);
+      expect(controller.serviceValidation.called).to.be.false;
+    });
+
+    it('serviceValidation should not be called when dependent service is selected', function()
{
+      controller.pushObjects([
+        Em.Object.create({
+          serviceName: 'S1',
+          isSelected: true
+        }),
+        Em.Object.create({
+          serviceName: 'S2',
+          isSelected: true
+        })
+      ]);
+      controller.dependentServiceValidation('S1', 'S2', 'check', Em.K);
+      expect(controller.serviceValidation.called).to.be.false;
+    });
+
+    it('serviceValidation should be called when dependent service is not selected', function()
{
+      controller.pushObjects([
+        Em.Object.create({
+          serviceName: 'S1',
+          isSelected: true
+        }),
+        Em.Object.create({
+          serviceName: 'S2',
+          isSelected: false
+        })
+      ]);
+      controller.dependentServiceValidation('S1', 'S2', 'check', Em.K);
+      expect(controller.serviceValidation.calledOnce).to.be.true;
+    });
   });
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba99a294/ambari-web/test/utils/configs/theme/theme_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/theme/theme_test.js b/ambari-web/test/utils/configs/theme/theme_test.js
index c9abf78..6aec271 100644
--- a/ambari-web/test/utils/configs/theme/theme_test.js
+++ b/ambari-web/test/utils/configs/theme/theme_test.js
@@ -39,11 +39,11 @@ describe('App.configTheme', function() {
     });
 
     it("theme configs empty", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: false
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: []
@@ -51,15 +51,15 @@ describe('App.configTheme', function() {
       ]);
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.called).to.be.false;
-      expect(configs[0].hiddenBySection).to.be.false;
+      expect(configs[0].get('hiddenBySection')).to.be.false;
     });
 
     it("theme resource is not 'config'", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: false
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -68,15 +68,15 @@ describe('App.configTheme', function() {
       ]);
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.called).to.be.false;
-      expect(configs[0].hiddenBySection).to.be.false;
+      expect(configs[0].get('hiddenBySection')).to.be.false;
     });
 
     it("property_value_attributes is null", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: false
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -90,15 +90,15 @@ describe('App.configTheme', function() {
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.calledOnce).to.be.true;
       expect(App.configTheme.getThemeResource.called).to.be.false;
-      expect(configs[0].hiddenBySection).to.be.false;
+      expect(configs[0].get('hiddenBySection')).to.be.false;
     });
 
     it("property_value_attributes.visible is null", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: false
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -114,15 +114,15 @@ describe('App.configTheme', function() {
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.calledOnce).to.be.true;
       expect(App.configTheme.getThemeResource.called).to.be.false;
-      expect(configs[0].hiddenBySection).to.be.false;
+      expect(configs[0].get('hiddenBySection')).to.be.false;
     });
 
     it("config not in the theme", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: false
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -139,15 +139,15 @@ describe('App.configTheme', function() {
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.calledOnce).to.be.true;
       expect(App.configTheme.getThemeResource.calledOnce).to.be.true;
-      expect(configs[0].hiddenBySection).to.be.false;
+      expect(configs[0].get('hiddenBySection')).to.be.false;
     });
 
     it("configCondition type is 'config' and hiddenBySection is true", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: true
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -165,15 +165,15 @@ describe('App.configTheme', function() {
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.calledOnce).to.be.true;
       expect(App.configTheme.getThemeResource.calledOnce).to.be.true;
-      expect(configs[0].hiddenBySection).to.be.true;
+      expect(configs[0].get('hiddenBySection')).to.be.true;
     });
 
     it("hiddenBySection should be true", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: false
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -191,15 +191,15 @@ describe('App.configTheme', function() {
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.calledOnce).to.be.true;
       expect(App.configTheme.getThemeResource.calledOnce).to.be.true;
-      expect(configs[0].hiddenBySection).to.be.true;
+      expect(configs[0].get('hiddenBySection')).to.be.true;
     });
 
     it("hiddenBySection should be false", function() {
-      var configs = [{
+      var configs = [Em.Object.create({
         name: 'conf1',
         filename: 'file1',
         hiddenBySection: true
-      }];
+      })];
       this.mockThemeCondition.returns([
         Em.Object.create({
           configs: [{}],
@@ -216,7 +216,7 @@ describe('App.configTheme', function() {
       App.configTheme.resolveConfigThemeConditions(configs);
       expect(App.configTheme.calculateConfigCondition.calledOnce).to.be.true;
       expect(App.configTheme.getThemeResource.calledOnce).to.be.true;
-      expect(configs[0].hiddenBySection).to.be.false;
+      expect(configs[0].get('hiddenBySection')).to.be.false;
     });
   });
 


Mime
View raw message