Repository: ambari
Updated Branches:
  refs/heads/trunk 5cdfce3c4 -> 12b59857e


AMBARI-15584 Need warning pop-up for not installing SmartSense. (atkach)


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

Branch: refs/heads/trunk
Commit: 12b59857e547a6af4e0e075829d597b7b5ef1257
Parents: 5cdfce3
Author: Andrii Tkach <atk...@hortonworks.com>
Authored: Mon Mar 28 11:46:15 2016 +0300
Committer: Andrii Tkach <atk...@hortonworks.com>
Committed: Mon Mar 28 11:46:15 2016 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step4_controller.js  | 70 ++++++++++----------
 ambari-web/app/messages.js                      |  6 +-
 .../test/controllers/wizard/step4_test.js       | 50 +++++++-------
 3 files changed, 68 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/12b59857/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 7cdbbba..56bf435 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -80,33 +80,6 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   },
 
   /**
-   * Check whether user selected Ambari Metrics service to install and go to 
next step
-   * @param callback {function}
-   * @method ambariMetricsValidation
-   */
-  ambariMetricsValidation: function (callback) {
-    var ambariMetricsService = this.findProperty('serviceName', 
'AMBARI_METRICS');
-    if (ambariMetricsService) {
-      if(!ambariMetricsService.get('isSelected')) {
-        this.addValidationError({
-          id: 'ambariMetricsCheck',
-          type: 'WARNING',
-          callback: this.ambariMetricsCheckPopup,
-          callbackParams: [callback]
-        });
-      }
-      else {
-        //metrics is selected, remove the metrics error from errorObject array
-        var metricsError = 
this.get('errorStack').filterProperty('id',"ambariMetricsCheck");
-        if(metricsError)
-        {
-           this.get('errorStack').removeObject(metricsError[0]);
-        }
-      }
-    }
-  },
-
-  /**
    * Check whether Ranger is selected and show installation requirements if yes
    * @param {function} callback
    * @method rangerValidation
@@ -209,8 +182,9 @@ App.WizardStep4Controller = Em.ArrayController.extend({
     };
     this.serviceDependencyValidation(callback);
     this.fileSystemServiceValidation(callback);
-    if (this.get('wizardController.name') == 'installerController') {
-      this.ambariMetricsValidation(callback);
+    if (this.get('wizardController.name') === 'installerController') {
+      this.serviceValidation(callback, 'AMBARI_METRICS', 'ambariMetricsCheck');
+      this.serviceValidation(callback, 'SMARTSENSE', 'smartSenseCheck');
     }
     this.rangerValidation(callback);
     this.sparkValidation(callback);
@@ -225,6 +199,34 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   },
 
   /**
+   * Check whether user selected service to install and go to next step
+   * @param callback {Function}
+   * @param serviceName {string}
+   * @param id {string}
+   * @method serviceValidation
+   */
+  serviceValidation: function(callback, serviceName, id) {
+    var service = this.findProperty('serviceName', serviceName);
+    if (service) {
+      if (!service.get('isSelected')) {
+        this.addValidationError({
+          id: id,
+          type: 'WARNING',
+          callback: this.serviceCheckPopup,
+          callbackParams: [callback]
+        });
+      }
+      else {
+        //metrics is selected, remove the metrics error from errorObject array
+        var metricsError = this.get('errorStack').filterProperty('id', id);
+        if (metricsError) {
+          this.get('errorStack').removeObject(metricsError[0]);
+        }
+      }
+    }
+  },
+
+  /**
    * Create error and push it to stack.
    *
    * @param {Object} errorObject - look to #createError
@@ -496,17 +498,17 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   },
 
   /**
-   * Show popup with info about not selected Ambari Metrics service
+   * Show popup with info about not selected service
    * @param {function} callback
    * @param {string} id
    * @return {App.ModalPopup}
-   * @method ambariMetricsCheckPopup
+   * @method serviceCheckPopup
    */
-  ambariMetricsCheckPopup: function (callback, id) {
+  serviceCheckPopup: function (callback, id) {
     var self = this;
     return App.ModalPopup.show({
-      header: Em.I18n.t('installer.step4.ambariMetricsCheck.popup.header'),
-      body: Em.I18n.t('installer.step4.ambariMetricsCheck.popup.body'),
+      header: Em.I18n.t('installer.step4.limitedFunctionality.popup.header'),
+      body: Em.I18n.t('installer.step4.' + id + '.popup.body'),
       primary: Em.I18n.t('common.proceedAnyway'),
       primaryClass: 'btn-warning',
       onPrimary: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/12b59857/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 86fab86..ea06bf3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -772,8 +772,12 @@ Em.I18n.translations = {
   'installer.step4.multipleDFS.popup.body':'You selected more than one file 
system. We will automatically select only {0}. Is this OK?',
   'installer.step4.serviceCheck.popup.header':'{0} Needed',
   'installer.step4.serviceCheck.popup.body':'You did not select {0}, but it is 
needed by other services you selected. We will automatically add {0}. Is this 
OK?',
-  'installer.step4.ambariMetricsCheck.popup.header':'Limited Functionality 
Warning',
+  '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.smartSenseCheck.popup.body':'SmartSense securely 
collections diagnostic data from the cluster and ' +
+  'provides both recommendations as well as automated analysis for 
troubleshooting support cases. If you do not ' +
+  'install the SmartSense service, no recommendations will be provided and 
data must be gathered manually for ' +
+  'troubleshooting support cases. Are you sure you want to proceed without 
SmartSense?',
   'installer.step4.rangerRequirements.popup.header': 'Ranger Requirements',
   'installer.step4.rangerRequirements.popup.body.requirements': '<ol><li>You 
must have an <strong>MySQL/Oracle/Postgres/MSSQL/SQL Anywhere Server</strong> 
database instance running to be used by Ranger.</li>' +
     '<li>In Assign Masters step of this wizard, you will be prompted to 
specify which host for the Ranger Admin. On that host, you <strong>must have DB 
Client installed</strong> for Ranger to access to the database. (Note: This is 
applicable for only Ranger 0.4.0)</li>' +

http://git-wip-us.apache.org/repos/asf/ambari/blob/12b59857/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 0b6685b..3bb6fb5 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -24,7 +24,7 @@ require('controllers/wizard/step4_controller');
 describe('App.WizardStep4Controller', function () {
 
   var services = [
-    'HDFS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER',
+    'HDFS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER', 
'SMARTSENSE',
     'YARN', 'MAPREDUCE2', 'FALCON', 'TEZ', 'STORM', 'AMBARI_METRICS', 
'RANGER', 'SPARK', 'SLIDER'
   ];
 
@@ -248,72 +248,76 @@ describe('App.WizardStep4Controller', function () {
   describe('#validate()', function() {
     var tests = [
         {
-          services: ['HDFS','ZOOKEEPER'],
-          errorsExpected: ['ambariMetricsCheck']
+          services: ['HDFS', 'ZOOKEEPER'],
+          errorsExpected: ['ambariMetricsCheck', 'smartSenseCheck']
         },
         {
           services: ['ZOOKEEPER'],
-          errorsExpected: ['ambariMetricsCheck']
+          errorsExpected: ['ambariMetricsCheck', 'smartSenseCheck']
         },
         {
           services: ['HDFS'],
-          errorsExpected: ['serviceCheck_ZOOKEEPER', 'ambariMetricsCheck']
+          errorsExpected: ['serviceCheck_ZOOKEEPER', 'ambariMetricsCheck', 
'smartSenseCheck']
         },
         {
           services: ['HDFS', 'TEZ', 'ZOOKEEPER'],
-          errorsExpected: ['serviceCheck_YARN', 'ambariMetricsCheck']
+          errorsExpected: ['serviceCheck_YARN', 'ambariMetricsCheck' , 
'smartSenseCheck']
         },
         {
           services: ['HDFS', 'ZOOKEEPER', 'FALCON'],
-          errorsExpected: ['serviceCheck_OOZIE', 'ambariMetricsCheck']
+          errorsExpected: ['serviceCheck_OOZIE', 'ambariMetricsCheck' , 
'smartSenseCheck']
         },
         {
           services: ['HDFS', 'ZOOKEEPER', 'GANGLIA', 'HIVE'],
-          errorsExpected: ['serviceCheck_YARN', 'ambariMetricsCheck']
+          errorsExpected: ['serviceCheck_YARN', 'ambariMetricsCheck' , 
'smartSenseCheck']
         },
         {
           services: ['HDFS', 'GLUSTERFS', 'ZOOKEEPER', 'HIVE'],
-          errorsExpected: ['serviceCheck_YARN', 'multipleDFS', 
'ambariMetricsCheck']
+          errorsExpected: ['serviceCheck_YARN', 'multipleDFS', 
'ambariMetricsCheck', 'smartSenseCheck']
         },
         {
           services: ['HDFS','ZOOKEEPER', 'GANGLIA'],
-          errorsExpected: ['ambariMetricsCheck']
+          errorsExpected: ['ambariMetricsCheck', 'smartSenseCheck']
         },
         {
           services: ['HDFS','ZOOKEEPER', 'AMBARI_METRICS'],
-          errorsExpected: []
+          errorsExpected: ['smartSenseCheck']
         },
         {
           services: ['ZOOKEEPER', 'AMBARI_METRICS'],
-          errorsExpected: []
+          errorsExpected: ['smartSenseCheck']
         },
         {
           services: ['HDFS', 'AMBARI_METRICS'],
-          errorsExpected: ['serviceCheck_ZOOKEEPER']
+          errorsExpected: ['serviceCheck_ZOOKEEPER', 'smartSenseCheck']
         },
         {
           services: ['HDFS', 'TEZ', 'ZOOKEEPER', 'AMBARI_METRICS'],
-          errorsExpected: ['serviceCheck_YARN']
+          errorsExpected: ['serviceCheck_YARN', 'smartSenseCheck']
         },
         {
           services: ['HDFS', 'ZOOKEEPER', 'FALCON', 'AMBARI_METRICS'],
-          errorsExpected: ['serviceCheck_OOZIE']
+          errorsExpected: ['serviceCheck_OOZIE', 'smartSenseCheck']
         },
         {
           services: ['HDFS', 'ZOOKEEPER', 'GANGLIA', 'HIVE', 'AMBARI_METRICS'],
-          errorsExpected: ['serviceCheck_YARN']
+          errorsExpected: ['serviceCheck_YARN', 'smartSenseCheck']
         },
         {
           services: ['HDFS', 'GLUSTERFS', 'ZOOKEEPER', 'HIVE', 
'AMBARI_METRICS'],
-          errorsExpected: ['serviceCheck_YARN', 'multipleDFS']
+          errorsExpected: ['serviceCheck_YARN', 'multipleDFS', 
'smartSenseCheck']
         },
         {
           services: ['HDFS','ZOOKEEPER', 'GANGLIA', 'AMBARI_METRICS'],
-          errorsExpected: []
+          errorsExpected: ['smartSenseCheck']
         },
         {
           services: ['RANGER'],
-          errorsExpected: ['ambariMetricsCheck', 'rangerRequirements']
+          errorsExpected: ['ambariMetricsCheck', 'smartSenseCheck', 
'rangerRequirements']
+        },
+        {
+          services: ['SMARTSENSE'],
+          errorsExpected: ['ambariMetricsCheck']
         }
       ],
       controllerNames = ['installerController', 'addServiceController'],
@@ -350,7 +354,7 @@ describe('App.WizardStep4Controller', function () {
       tests.forEach(function(test) {
         var errorsExpected = test.errorsExpected;
         if (name !== 'installerController') {
-          errorsExpected = test.errorsExpected.without('ambariMetricsCheck');
+          errorsExpected = 
test.errorsExpected.without('ambariMetricsCheck').without('smartSenseCheck');
         }
         var message = '{0}, {1} selected validation should be {2}, errors: {3}'
           .format(wizardNames[name], test.services.join(','), 
errorsExpected.length ? 'passed' : 'failed',
@@ -673,7 +677,7 @@ describe('App.WizardStep4Controller', function () {
     });
   });
 
-  describe('#ambariMetricsValidation', function () {
+  describe('#serviceValidation', function () {
 
     var cases = [
       {
@@ -709,7 +713,7 @@ describe('App.WizardStep4Controller', function () {
         } else {
           controller.removeObject(ams);
         }
-        controller.ambariMetricsValidation();
+        controller.serviceValidation(Em.K, 'AMBARI_METRICS', 
'ambariMetricsCheck');
         
expect(controller.get('errorStack').mapProperty('id').contains('ambariMetricsCheck')).to.equal(item.isAmbariMetricsWarning);
       });
     });
@@ -967,7 +971,7 @@ describe('App.WizardStep4Controller', function () {
     });
 
     Em.A([
-      'ambariMetricsCheckPopup',
+      'serviceCheckPopup',
       'rangerRequirementsPopup',
       'sparkWarningPopup'
     ]).forEach(function (methodName) {

Reply via email to