Repository: ambari
Updated Branches:
  refs/heads/trunk badef3dcc -> e371ac5c0


AMBARI-15826 Move generating advanced tabs to theme mapper. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: e371ac5c0b9d8734301edab1dcd2c90f6325492b
Parents: badef3d
Author: ababiichuk <ababiic...@hortonworks.com>
Authored: Tue Apr 12 11:55:16 2016 +0300
Committer: ababiichuk <ababiic...@hortonworks.com>
Committed: Tue Apr 12 19:16:30 2016 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 21 +++++++++-----------
 ambari-web/app/controllers/wizard.js            |  1 -
 .../app/controllers/wizard/step7_controller.js  |  6 ++----
 ambari-web/app/data/HDP2/site_properties.js     |  2 --
 ambari-web/app/mappers/configs/themes_mapper.js | 10 ++++++++--
 .../app/mixins/main/service/themes_mapping.js   | 12 +++++++----
 ambari-web/app/models/stack_service.js          |  8 ++------
 .../test/mappers/configs/themes_mapper_test.js  |  2 +-
 8 files changed, 30 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/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 abe1469..1e996d9 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -289,16 +289,10 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend(App.ConfigsLoader, A
    * @method loadStep
    */
   loadStep: function () {
-    var self = this;
     var serviceName = this.get('content.serviceName');
     this.clearStep();
     this.set('dependentServiceNames', 
App.StackService.find(serviceName).get('dependentServiceNames'));
-    this.loadConfigTheme(serviceName).always(function() {
-      if (!$.mocho) { App.themesMapper.generateAdvancedTabs([serviceName]); }
-      // Theme mapper has UI only configs that needs to be merged with current 
service version configs
-      // This requires calling  `loadCurrentVersions` after theme has loaded
-      self.loadCurrentVersions();
-    });
+    
this.loadConfigTheme(serviceName).always(this.loadCurrentVersions.bind(this));
     this.loadServiceConfigVersions();
   },
 
@@ -358,6 +352,12 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend(App.ConfigsLoader, A
       configs = App.config.addYarnCapacityScheduler(configs);
     }
 
+    this.setPropertyIsVisible(configs);
+    this.setPropertyIsEditable(configs);
+    this.set('allConfigs', configs);
+  },
+
+  setPropertyIsVisible: function (configs) {
     if (this.get('content.serviceName') === 'KERBEROS') {
       var kdc_type = configs.findProperty('name', 'kdc_type');
       if (kdc_type.get('value') === 'none') {
@@ -369,15 +369,12 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend(App.ConfigsLoader, A
         configs.findProperty('name', 'ldap_url').set('isVisible', true);
       } else if (kdc_type.get('value') === 'ipa') {
         configs.findProperty('name', 'group').set('isVisible', true);
-        configs.findProperty('name', 'manage_krb5_conf').set('value', false);
-        configs.findProperty('name', 'install_packages').set('value', false);
+        configs.findProperty('name', 'manage_krb5_conf').set('value', 
false);//TODO
+        configs.findProperty('name', 'install_packages').set('value', 
false);//TODO
         configs.findProperty('name', 'admin_server_host').set('isVisible', 
false);
         configs.findProperty('name', 'domains').set('isVisible', false);
       }
     }
-
-    this.setPropertyIsEditable(configs);
-    this.set('allConfigs', configs);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js 
b/ambari-web/app/controllers/wizard.js
index 81f9609..c3d7f08 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1270,7 +1270,6 @@ App.WizardController = 
Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
         App.config.loadConfigsFromStack(serviceNames).done(function () {
           self.loadConfigThemeForServices(serviceNames).always(function () {
             self.set('stackConfigsLoaded', true);
-            App.themesMapper.generateAdvancedTabs(serviceNames);
             dfd.resolve();
           });
         });

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/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 786b990..029ca20 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -214,16 +214,14 @@ App.WizardStep7Controller = 
Em.Controller.extend(App.ServerValidatorMixin, App.E
    * @type {Object}
    */
   configDependencies: function() {
-    var dependencies = {
-      'sliderSelected': this.get('allSelectedServiceNames').contains('SLIDER')
-    };
+    var dependencies = {};
     var hiveMetastore = 
App.configsCollection.getConfigByName('hive.metastore.uris', 'hive-site.xml');
     var clientPort = App.configsCollection.getConfigByName('clientPort', 
'zoo.cfg.xml');
 
     if (hiveMetastore) dependencies['hive.metastore.uris'] = 
hiveMetastore.recommendedValue;
     if (clientPort) dependencies['clientPort']  = clientPort.recommendedValue;
     return dependencies
-  }.property('allSelectedServiceNames'),
+  }.property(),
 
   /**
    * List of filters for config properties to populate filter combobox

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js 
b/ambari-web/app/data/HDP2/site_properties.js
index 07062f7..2de8823 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -1498,7 +1498,6 @@ var hdp2properties = [
     "index" : 14
   },
   {
-    "id": "puppet var",
     "name": "group",
     "serviceName": "KERBEROS",
     "filename": "kerberos-env.xml",
@@ -1513,7 +1512,6 @@ var hdp2properties = [
     "index": 0
   },
   {
-    "id": "puppet var",
     "name": "manage_krb5_conf",
     "dependentConfigPattern": "CATEGORY",
     "serviceName": "KERBEROS",

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/ambari-web/app/mappers/configs/themes_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/themes_mapper.js 
b/ambari-web/app/mappers/configs/themes_mapper.js
index 6cba017..a2bfd99 100644
--- a/ambari-web/app/mappers/configs/themes_mapper.js
+++ b/ambari-web/app/mappers/configs/themes_mapper.js
@@ -70,7 +70,13 @@ App.themesMapper = App.QuickDataMapper.create({
     "sub_section_id": "sub_section_id"
   },
 
-  map: function (json) {
+  /**
+   * Mapper function for tabs
+   *
+   * @param json
+   * @param [serviceNames]
+   */
+  map: function (json, serviceNames) {
     console.time('App.themesMapper execution time');
     var tabs = [];
     json.items.forEach(function(item) {
@@ -81,7 +87,7 @@ App.themesMapper = App.QuickDataMapper.create({
 
     App.store.commit();
     App.store.loadMany(this.get("tabModel"), tabs);
-    App.store.commit();
+    this.generateAdvancedTabs(serviceNames);
     console.timeEnd('App.themesMapper execution time');
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/ambari-web/app/mixins/main/service/themes_mapping.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/themes_mapping.js 
b/ambari-web/app/mixins/main/service/themes_mapping.js
index 51a9aa5..2dc2698 100644
--- a/ambari-web/app/mixins/main/service/themes_mapping.js
+++ b/ambari-web/app/mixins/main/service/themes_mapping.js
@@ -47,11 +47,13 @@ App.ThemesMappingMixin = Em.Mixin.create({
    * Success-callback for <code>loadConfigTheme</code>
    * runs <code>themeMapper<code>
    * @param {object} data
+   * @param opt
+   * @param params
    * @private
    * @method saveThemeToModel
    */
-  _saveThemeToModel: function(data) {
-    App.themesMapper.map(data);
+  _saveThemeToModel: function(data, opt, params) {
+    App.themesMapper.map(data, [params.serviceName]);
   },
 
   /**
@@ -77,16 +79,18 @@ App.ThemesMappingMixin = Em.Mixin.create({
   /**
    * Success-callback for <code>loadConfigThemeForServices</code>
    * @param {object} data
+   * @param opt
+   * @param params
    * @private
    * @method _loadConfigThemeForServicesSuccess
    */
-  _loadConfigThemeForServicesSuccess: function(data) {
+  _loadConfigThemeForServicesSuccess: function(data, opt, params) {
     if (!data.items.length) return;
     App.themesMapper.map({
       items: data.items.mapProperty('themes').reduce(function(p,c) {
         return p.concat(c);
       })
-    });
+    }, params.serviceNames.split(','));
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js 
b/ambari-web/app/models/stack_service.js
index 73e9970..649bf89 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -65,12 +65,8 @@ App.StackService = DS.Model.extend({
 
   // Is the service a distributed filesystem
   isDFS: function () {
-    var dfsServices = ['HDFS', 'GLUSTERFS'];
-    if( this.get('serviceType') == 'HCFS' || 
dfsServices.contains(this.get('serviceName')) )
-       return true;
-    else
-       return false;
-  }.property('serviceName'),
+    return this.get('serviceType') === 'HCFS' || ['HDFS', 
'GLUSTERFS'].contains(this.get('serviceName'));
+  }.property('serviceName', 'serviceType'),
 
   // Primary DFS. used if there is more than one DFS in a stack.
   // Only one service in the stack should be tagged as primary DFS.

http://git-wip-us.apache.org/repos/asf/ambari/blob/e371ac5c/ambari-web/test/mappers/configs/themes_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js 
b/ambari-web/test/mappers/configs/themes_mapper_test.js
index bc25d1d..faf4900 100644
--- a/ambari-web/test/mappers/configs/themes_mapper_test.js
+++ b/ambari-web/test/mappers/configs/themes_mapper_test.js
@@ -142,7 +142,7 @@ describe('App.themeMapper', function () {
     describe('should map theme data', function () {
 
       beforeEach(function () {
-        App.themesMapper.map(json);
+        App.themesMapper.map(json, []);
       });
 
       it('1 Tab is mapped', function () {

Reply via email to