ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [4/4] ambari git commit: AMBARI-13142 UI configs clean up. (ababiichuk)
Date Fri, 18 Sep 2015 11:28:11 GMT
AMBARI-13142 UI configs clean up. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 8867b3685820b2f293b749de919766137f230f23
Parents: 1ad65df
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Fri Sep 18 14:24:46 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Fri Sep 18 14:24:46 2015 +0300

----------------------------------------------------------------------
 .../main/admin/serviceAccounts_controller.js    |  19 -
 .../controllers/main/service/info/configs.js    |  63 +---
 .../app/controllers/wizard/step7_controller.js  |  51 +--
 .../app/controllers/wizard/step8_controller.js  | 214 +----------
 ambari-web/app/data/BIGTOP/site_properties.js   | 315 -----------------
 ambari-web/app/data/HDP2.2/site_properties.js   | 135 -------
 ambari-web/app/data/HDP2/config_mapping.js      | 158 ---------
 ambari-web/app/data/HDP2/ha_properties.js       |  19 -
 ambari-web/app/data/HDP2/rm_ha_properties.js    |  13 -
 ambari-web/app/data/HDP2/site_properties.js     | 201 -----------
 .../mixins/common/configs/configs_comparator.js |   3 +-
 .../app/mixins/common/configs/configs_saver.js  | 105 ------
 .../configs/objects/service_config_property.js  |   1 -
 ambari-web/app/utils/config.js                  | 351 +------------------
 .../app/utils/configs/config_property_helper.js |   9 +-
 .../configs/service_configs_by_category_view.js |  15 +-
 .../admin/serviceAccounts_controller_test.js    |   9 -
 .../main/service/info/config_test.js            | 214 -----------
 .../test/controllers/wizard/step7_test.js       |  43 ---
 .../test/controllers/wizard/step8_test.js       | 342 ------------------
 .../test/mock_data_setup/configs_mock_data.js   |   8 -
 .../objects/service_config_property_test.js     |   1 -
 ambari-web/test/utils/config_test.js            | 211 -----------
 .../configs/config_property_helper_test.js      |  20 +-
 .../service_configs_by_category_view_test.js    |   4 +-
 25 files changed, 46 insertions(+), 2478 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8867b368/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js b/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
index 645d7f4..8f7f48c 100644
--- a/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
+++ b/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
@@ -158,24 +158,5 @@ App.MainAdminServiceAccountsController = App.MainServiceInfoConfigsController.ex
     } else {
       return arrayToSort;
     }
-  },
-  /**
-   * set displayName of "proxyuser_group" depending on stack version
-   * @param misc_configs
-   */
-  setProxyUserGroupLabel: function (misc_configs) {
-    var proxyUserGroup = misc_configs.findProperty('name', 'proxyuser_group');
-    //stack, with version lower than 2.1, doesn't have Falcon service
-    if (proxyUserGroup) {
-      var proxyServices = ['HIVE', 'OOZIE', 'FALCON'];
-      var services = Em.A([]);
-      proxyServices.forEach(function (serviceName) {
-        var stackService = App.StackService.find(serviceName);
-        if (stackService) {
-          services.push(stackService.get('displayName'));
-        }
-      }, this);
-      proxyUserGroup.set('displayName', "Proxy group for " + stringUtils.getFormattedStringFromArray(services));
-    }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8867b368/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 6e31216..a560767 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -449,7 +449,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader,
A
           for (var prop in config.properties) {
             var fileName = App.config.getOriginalFileName(config.type);
             var serviceConfig = allConfigs.filterProperty('name', prop).findProperty('filename',
fileName);
-            var value = App.config.formatOverrideValue(serviceConfig, config.properties[prop]);
+            var value = App.config.formatPropertyValue(serviceConfig, config.properties[prop]);
             var isFinal = !!(config.properties_attributes && config.properties_attributes.final
&& config.properties_attributes.final[prop]);
 
             if (serviceConfig) {
@@ -474,66 +474,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader,
A
   },
 
   /**
-   * @param serviceConfig
-   * @private
-   * @method checkDatabaseProperties
-   */
-  checkDatabaseProperties: function (serviceConfig) {
-    this.hideHiveDatabaseProperties(serviceConfig.configs);
-    this.hideOozieDatabaseProperties(serviceConfig.configs);
-  },
-
-  /**
-   * @param configs
-   * @private
-   * @method hideHiveDatabaseProperties
-   */
-  hideHiveDatabaseProperties: function (configs) {
-    if (!['HIVE'].contains(this.get('content.serviceName'))) return;
-    var property = configs.findProperty('name', 'hive_hostname');
-    if (property) property.set('isVisible', false);
-
-    if (configs.someProperty('name', 'hive_database')) {
-      var hiveDb = configs.findProperty('name', 'hive_database');
-      if (hiveDb.value === 'Existing MSSQL Server database with integrated authentication')
{
-        configs.findProperty('name', 'javax.jdo.option.ConnectionUserName').setProperties({
-          isVisible: false,
-          isRequired: false
-        });
-        configs.findProperty('name', 'javax.jdo.option.ConnectionPassword').setProperties({
-          isVisible: false,
-          isRequired: false
-        });
-      }
-    }
-  },
-
-  /**
-   * @param configs
-   * @private
-   * @method hideOozieDatabaseProperties
-   */
-  hideOozieDatabaseProperties: function (configs) {
-    if (!['OOZIE'].contains(this.get('content.serviceName'))) return;
-    var property = configs.findProperty('name', 'oozie_hostname');
-    if (property) property.set('isVisible', false);
-
-    if (configs.someProperty('name', 'oozie_database')) {
-      var oozieDb = configs.findProperty('name', 'oozie_database');
-      if (oozieDb.value === 'Existing MSSQL Server database with integrated authentication')
{
-        configs.findProperty('name', 'oozie.service.JPAService.jdbc.username').setProperties({
-          isVisible: false,
-          isRequired: false
-        });
-        configs.findProperty('name', 'oozie.service.JPAService.jdbc.password').setProperties({
-          isVisible: false,
-          isRequired: false
-        });
-      }
-    }
-  },
-
-  /**
    * @param allConfigs
    * @private
    * @method onLoadOverrides
@@ -569,7 +509,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader,
A
     }
     this.set('selectedService', selectedService);
     this.checkOverrideProperty(selectedService);
-    //this.checkDatabaseProperties(selectedService);
     if (!App.Service.find().someProperty('serviceName', 'RANGER')) {
       App.config.removeRangerConfigs(this.get('stepConfigs'));
     } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8867b368/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 90bef77..47f272e 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -676,31 +676,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     }
     this.set('hash', this.getHash());
   },
-  /**
-   * After user navigates back to step7, values for depended configs should be set to values
set by user and not to default values
-   * @method restoreRecommendedConfigs
-   */
-  restoreRecommendedConfigs: function () {
-    var recommendationsConfigs = this.get('recommendationsConfigs') || {};
-    var serviceConfigProperties = this.get('content.serviceConfigProperties') || [];
-    var stepConfigs = this.get('stepConfigs');
-    Em.keys(recommendationsConfigs).forEach(function (file) {
-      (Em.keys(recommendationsConfigs[file].properties).concat(Em.keys(recommendationsConfigs[file].property_attributes
|| {}))).forEach(function (configName) {
-        stepConfigs.forEach(function (stepConfig) {
-          stepConfig.get('configs').filterProperty('name', configName).forEach(function (configProperty)
{
-            if (Em.get(configProperty, 'filename').contains(file)) {
-              var scps = serviceConfigProperties.filterProperty('name', configName).filter(function
(cp) {
-                return Em.get(cp, 'filename').contains(file);
-              });
-              if (scps.length) {
-                Em.set(configProperty, 'value', Em.get(scps[0], 'value'));
-              }
-            }
-          });
-        });
-      });
-    });
-  },
 
   /**
    * Mark descriptor properties in configuration object.
@@ -913,25 +888,16 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
       }
     });
     //add user properties
-
     Em.keys(configsMap).forEach(function (filename) {
       Em.keys(configsMap[filename]).forEach(function (propertyName) {
-        configs.push(configMixin.addUserProperty({
-          id: 'site property',
-          name: propertyName,
-          serviceName: configMixin.getServiceNameByConfigType(filename),
-          value: configsMap[filename][propertyName],
-          savedValue: configsMap[filename][propertyName],
-          filename: configMixin.get('filenameExceptions').contains(filename) ? filename :
filename + '.xml',
-          category: 'Advanced',
-          hasInitialValue: true,
-          isUserProperty: true,
-          isOverridable: true,
-          overrides: [],
-          isRequired: true,
-          isVisible: true,
-          showLabel: true
-        }, false, []));
+        configs.push(configMixin.createDefaultConfig(propertyName,
+          configMixin.getServiceByConfigType(filename).get('serviceName'),
+          configMixin.getOriginalFileName(filename),
+          false, {
+            value: configsMap[filename][propertyName],
+            savedValue: configsMap[filename][propertyName],
+            hasInitialValue: true
+        }));
       });
     });
   },
@@ -1044,7 +1010,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
       this._setEditableValue(config);
       this._setOverrides(config, overrides);
     }, this);
-    //this.getRecommendationsForDependencies(null, true, Em.K);
   }.observes('selectedConfigGroup'),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/8867b368/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index deb436e..be0404c 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -80,18 +80,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
     return !!App.get('router.mainAdminKerberosController.kdc_type')
   }.property('App.router.mainAdminKerberosController.kdc_type'),
 
-  /**
-   * All configs
-   * @type {Array}
-   */
-  configMapping: function () {
-    return App.config.get('configMapping').all(true);
-  }.property('App.config.configMapping'),
-
-  /**
-   *
-   */
-  slaveComponentConfig: null,
 
   /**
    * Should Submit button be disabled
@@ -231,114 +219,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
   },
 
   /**
-   * Remove unused Hive configs
-   * @param {Ember.Enumerable} configs
-   * @returns {Ember.Enumerable}
-   * @method removeHiveConfigs
-   */
-  removeHiveConfigs: function (configs) {
-    var hiveDb = configs.findProperty('name', 'hive_database');
-    var hiveDbType = configs.findProperty('name', 'hive_database_type');
-    if (hiveDbType) {
-      var hive_properties = Em.A([]);
-
-      switch (hiveDb.value) {
-        case 'New MySQL Database':
-          if (configs.someProperty('name', 'hive_ambari_host')) {
-            configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_ambari_host').value;
-          }
-          hive_properties = Em.A(['hive_existing_mysql_database', 'hive_existing_oracle_database',
'hive_existing_postgresql_database',
-            'hive_existing_mssql_server_database', 'hive_existing_mssql_server_2_database']);
-          break;
-        case 'New PostgreSQL Database':
-          if (configs.someProperty('name', 'hive_ambari_host')) {
-            configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_ambari_host').value;
-          }
-          hive_properties = Em.A(['hive_existing_mysql_database', 'hive_existing_oracle_database',
'hive_existing_postgresql_database']);
-          break;
-        case 'Existing MySQL Database':
-          configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_existing_mysql_host').value;
-          hive_properties = Em.A(['hive_ambari_database', 'hive_existing_oracle_database',
'hive_existing_postgresql_database',
-            'hive_existing_mssql_server_database', 'hive_existing_mssql_server_2_database']);
-          break;
-        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-          configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_existing_postgresql_host').value;
-          hive_properties = Em.A(['hive_ambari_database', 'hive_existing_oracle_database',
'hive_existing_mysql_database',
-            'hive_existing_mssql_server_database', 'hive_existing_mssql_server_2_database']);
-          break;
-        case 'Existing MSSQL Server database with SQL authentication':
-          configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_existing_mssql_server_host').value;
-          hive_properties = Em.A(['hive_ambari_database', 'hive_existing_oracle_database',
'hive_existing_postgresql_database',
-            'hive_existing_mysql_database', 'hive_existing_mssql_server_database', 'hive_existing_mssql_server_database']);
-          break;
-        case 'Existing MSSQL Server database with integrated authentication':
-          configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_existing_mssql_server_2_host').value;
-          hive_properties = Em.A(['hive_ambari_database', 'hive_existing_oracle_database',
'hive_existing_postgresql_database',
-            'hive_existing_mysql_database', 'hive_existing_mssql_server_database', 'hive_existing_mssql_server_2_database']);
-          break;
-        default:
-          configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name',
'hive_existing_oracle_host').value;
-          hive_properties = Em.A(['hive_ambari_database',  'hive_existing_mysql_database',
'hive_existing_postgresql_database',
-            'hive_existing_mssql_server_database', 'hive_existing_mssql_server_2_database']);
-          break;
-      }
-
-      hive_properties.push('hive_master_hosts');
-      configs = dataManipulationUtils.rejectPropertyValues(configs, 'name', hive_properties);
-    }
-    return configs;
-  },
-
-  /**
-   * Remove unused Oozie configs
-   * @param {Ember.Enumerable} configs
-   * @returns {Ember.Enumerable}
-   * @method removeOozieConfigs
-   */
-  removeOozieConfigs: function (configs) {
-    var oozieDb = configs.findProperty('name', 'oozie_database');
-    if (oozieDb) {
-      var oozie_properties = Em.A(['oozie_ambari_database']);
-
-      switch (oozieDb.value) {
-        case 'New Derby Database':
-          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name',
'oozie_ambari_host').value;
-          oozie_properties = Em.A(['oozie_ambari_database', 'oozie_existing_mysql_database',
'oozie_existing_oracle_database',
-            'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_2_database']);
-          break;
-        case 'Existing MySQL Database':
-          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name',
'oozie_existing_mysql_host').value;
-          oozie_properties = Em.A(['oozie_ambari_database', 'oozie_existing_oracle_database',
'oozie_derby_database',
-            'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_2_database']);
-          break;
-        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
-          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name',
'oozie_existing_postgresql_host').value;
-          oozie_properties = Em.A(['oozie_ambari_database', 'oozie_existing_oracle_database',
'oozie_existing_mysql_database',
-            'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_2_database']);
-          break;
-        case 'Existing MSSQL Server database with SQL authentication':
-          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name',
'oozie_existing_mssql_server_host').value;
-          oozie_properties = Em.A(['oozie_existing_oracle_database', 'oozie_existing_postgresql_database',
-            'oozie_existing_mysql_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_2_database']);
-          break;
-        case 'Existing MSSQL Server database with integrated authentication':
-          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name',
'oozie_existing_mssql_server_2_host').value;
-          oozie_properties = Em.A(['oozie_existing_oracle_database', 'oozie_existing_postgresql_database',
-            'oozie_existing_mysql_database', 'oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_database']);
-          break;
-        default:
-          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name',
'oozie_existing_oracle_host').value;
-          oozie_properties = Em.A(['oozie_ambari_database', 'oozie_existing_mysql_database',
'oozie_derby_database',
-            'oozie_existing_postgresql_database', 'oozie_existing_mssql_server_database',
'oozie_existing_mssql_server_2_database']);
-          break;
-      }
-
-      configs = dataManipulationUtils.rejectPropertyValues(configs, 'name', oozie_properties);
-    }
-    return configs;
-  },
-
-  /**
    * Load all site properties
    * @method loadConfigs
    */
@@ -362,37 +242,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
   },
 
   /**
-   * Load UI configs
-   * @param {Array} configMapping
-   * @return {Array}
-   * @method loadUiSideConfigs
-   */
-  loadUiSideConfigs: function (configMapping) {
-    var uiConfig = [];
-    var dependentConfig = $.extend(true, [], configMapping.filterProperty('foreignKey'));
-    dependentConfig.forEach(function (_config) {
-      App.config.setConfigValue(uiConfig, this.get('content.serviceConfigProperties'), _config);
-      // generated config name using template for example `hadoop.proxyuser.hive.hosts`
-      var configName = _config._name || _config.name;
-      // property from <code>content.serviceConfigProperties</code>. This property
can be added in custom-site.xml
-      // with the same name as propety from defined config mapping. In this case property
from config mapping
-      // object should be ignored.
-      var isPropertyDefined = this.get('content.serviceConfigProperties')
-            .filterProperty('filename', _config.filename).someProperty('name', configName);
-      // ignore config mapping property if no matches for template was found or property
already added by user
-      if(!_config.noMatchSoSkipThisConfig && !isPropertyDefined) {
-        uiConfig.pushObject({
-          "id": "site property",
-          "name": configName,
-          "value": _config.value,
-          "filename": _config.filename
-        });
-      }
-    }, this);
-    return uiConfig;
-  },
-
-  /**
    * Format <code>content.hosts</code> from Object to Array
    * @returns {Array}
    * @method getRegisteredHosts
@@ -1020,10 +869,10 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
         if (App.get('isKerberosEnabled') && !this.get('isManualKerberos')) {
           this.updateKerberosDescriptor();
         }
-      }
-      var fileNamesToUpdate = this.get('wizardController').getDBProperty('fileNamesToUpdate');
-      if (fileNamesToUpdate && fileNamesToUpdate.length) {
-        this.updateConfigurations(fileNamesToUpdate);
+        var fileNamesToUpdate = this.get('wizardController').getDBProperty('fileNamesToUpdate');
+        if (fileNamesToUpdate && fileNamesToUpdate.length) {
+          this.updateConfigurations(fileNamesToUpdate);
+        }
       }
       this.createConfigurations();
       this.applyConfigurationsToCluster(this.get('serviceConfigTags'));
@@ -1692,61 +1541,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
   },
 
   /**
-   * proxyuser configs which depend on service
-   * @type {{serviceName: string, user: string}[]}
-   */
-  optionalCoreSiteConfigs: [
-    {
-      serviceName: 'OOZIE',
-      user: 'oozie_user'
-    },
-    {
-      serviceName: 'HIVE',
-      user: 'hive_user'
-    },
-    {
-      serviceName: 'HIVE',
-      user: 'hcat_user'
-    },
-    {
-      serviceName: 'FALCON',
-      user: 'falcon_user'
-    }
-  ],
-
-  /**
-   * push proxyuser properties to core-site if they required by dependencies
-   * @param coreSiteObj
-   * @param installedAndSelectedServices
-   * @return {Object}
-   */
-  resolveProxyuserDependecies: function (coreSiteObj, installedAndSelectedServices) {
-    var coreSiteProperties = {};
-    var optionalCoreSiteConfigs = this.get('optionalCoreSiteConfigs');
-    var proxyuserGroup = this.get('configs').findProperty('name', 'proxyuser_group');
-
-    coreSiteObj.forEach(function (_coreSiteObj) {
-      //proxyuser_group property should be added only if proxyuser properties are used
-      if (proxyuserGroup && _coreSiteObj.name === proxyuserGroup.name) return;
-
-      // exclude some configs if service wasn't selected
-      var addProperty = optionalCoreSiteConfigs.every(function (config) {
-        var userValue = this.get('configs').someProperty('name', config.user) ? this.get('configs').findProperty('name',
config.user).value : null;
-        return (installedAndSelectedServices.someProperty('serviceName', config.serviceName)
||
-          (_coreSiteObj.name != 'hadoop.proxyuser.' + userValue + '.hosts' && _coreSiteObj.name
!= 'hadoop.proxyuser.' + userValue + '.groups'))
-      }, this);
-      if (addProperty) {
-        coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
-      }
-    }, this);
-
-    if (!App.isEmptyObject(coreSiteProperties) && proxyuserGroup) {
-      coreSiteProperties[proxyuserGroup.name] = proxyuserGroup.value;
-    }
-    return coreSiteProperties;
-  },
-
-  /**
    * Create Core Site object
    * @returns {{type: string, tag: string, properties: {}}}
    * @method createCoreSiteObj


Mime
View raw message