You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/09/23 10:45:09 UTC

[1/2] ambari git commit: AMBARI-13199 addHostNamesToConfigs shouldn't be run on Kerberos. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk e24e3c8b7 -> 4f4959d21


AMBARI-13199 addHostNamesToConfigs shouldn't be run on Kerberos. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 4f4959d2113ea9e2f579b4719ef7be39fb2450b8
Parents: f7e29cd
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Sep 23 11:42:58 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Sep 23 11:45:00 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 99 +++++++++++++++++++-
 ambari-web/app/utils/config.js                  | 93 ------------------
 .../test/controllers/wizard/step7_test.js       | 14 +--
 3 files changed, 104 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4f4959d2/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 f6fa238..bedd164 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -17,6 +17,7 @@
  */
 
 var App = require('app');
+var configPropertyHelper = require('utils/configs/config_property_helper');
 /**
  * By Step 7, we have the following information stored in App.db and set on this
  * controller by the router.
@@ -727,7 +728,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
       masterComponentHosts: this.get('wizardController.content.masterComponentHosts'),
       slaveComponentHosts: this.get('wizardController.content.slaveComponentHosts')
     };
-    var serviceConfigs = App.config.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'), localDB);
+    var serviceConfigs = this.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'), localDB);
     if (this.get('wizardController.name') === 'addServiceController') {
       serviceConfigs.setEach('showConfig', true);
       serviceConfigs.setEach('selected', false);
@@ -767,6 +768,100 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
   },
 
   /**
+   * render configs, distribute them by service
+   * and wrap each in ServiceConfigProperty object
+   * @param configs
+   * @param storedConfigs
+   * @param allSelectedServiceNames
+   * @param installedServiceNames
+   * @param localDB
+   * @return {App.ServiceConfig[]}
+   */
+  renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames, localDB) {
+    var renderedServiceConfigs = [];
+    var services = [];
+
+    App.config.get('preDefinedServiceConfigs').forEach(function (serviceConfig) {
+      var serviceName = serviceConfig.get('serviceName');
+      if (allSelectedServiceNames.contains(serviceName) || serviceName === 'MISC') {
+        if (!installedServiceNames.contains(serviceName) || serviceName === 'MISC') {
+          serviceConfig.set('showConfig', true);
+        }
+        services.push(serviceConfig);
+      }
+    });
+    services.forEach(function (service) {
+      var configsByService = [];
+      var serviceConfigs = configs.filterProperty('serviceName', service.get('serviceName'));
+      serviceConfigs.forEach(function (_config) {
+        var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
+        this.updateHostOverrides(serviceConfigProperty, _config);
+        if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
+          configPropertyHelper.initialValue(serviceConfigProperty, localDB, configs);
+        }
+        serviceConfigProperty.validate();
+        configsByService.pushObject(serviceConfigProperty);
+      }, this);
+      var serviceConfig = App.config.createServiceConfig(service.get('serviceName'));
+      serviceConfig.set('showConfig', service.get('showConfig'));
+      serviceConfig.set('configs', configsByService);
+      if (['addServiceController', 'installerController'].contains(this.get('wizardController.name'))) {
+        this.addHostNamesToConfigs(serviceConfig, localDB.masterComponentHosts, localDB.slaveComponentHosts);
+      }
+      renderedServiceConfigs.push(serviceConfig);
+    }, this);
+    return renderedServiceConfigs;
+  },
+
+  /**
+   * Add host name properties to appropriate categories (for installer only)
+   * @param serviceConfig
+   * @param masterComponents
+   * @param slaveComponents
+   */
+  addHostNamesToConfigs: function(serviceConfig, masterComponents, slaveComponents) {
+    serviceConfig.get('configCategories').forEach(function(c) {
+      if (c.showHost) {
+        var value = [];
+        var componentName = c.name;
+        var masters = masterComponents.filterProperty('component', componentName);
+        if (masters.length) {
+          value = masters.mapProperty('hostName');
+        } else {
+          var slaves = slaveComponents.findProperty('componentName', componentName);
+          if (slaves) {
+            value = slaves.hosts.mapProperty('hostName');
+          }
+        }
+        var stackComponent = App.StackServiceComponent.find(componentName);
+        var hProperty = App.config.createHostNameProperty(serviceConfig.get('serviceName'), componentName, value, stackComponent);
+        serviceConfig.get('configs').push(App.ServiceConfigProperty.create(hProperty));
+      }
+    }, this);
+  },
+
+  /**
+   * create new child configs from overrides, attach them to parent config
+   * override - value of config, related to particular host(s)
+   * @param configProperty
+   * @param storedConfigProperty
+   */
+  updateHostOverrides: function (configProperty, storedConfigProperty) {
+    if (storedConfigProperty.overrides != null && storedConfigProperty.overrides.length > 0) {
+      var overrides = [];
+      storedConfigProperty.overrides.forEach(function (overrideEntry) {
+        // create new override with new value
+        var newSCP = App.ServiceConfigProperty.create(configProperty);
+        newSCP.set('value', overrideEntry.value);
+        newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
+        newSCP.set('parentSCP', configProperty);
+        overrides.pushObject(newSCP);
+      });
+      configProperty.set('overrides', overrides);
+    }
+  },
+
+  /**
    * When NameNode HA is enabled some configs based on <code>dfs.nameservices</code> should be changed
    * This happens only if service is added AFTER NN HA is enabled
    *
@@ -891,7 +986,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
     Em.keys(configsMap).forEach(function (filename) {
       Em.keys(configsMap[filename]).forEach(function (propertyName) {
         configs.push(configMixin.createDefaultConfig(propertyName,
-          configMixin.getServiceByConfigType(filename).get('serviceName'),
+          configMixin.getServiceByConfigType(filename) ? configMixin.getServiceByConfigType(filename).get('serviceName') : 'MISC',
           configMixin.getOriginalFileName(filename),
           false, {
             value: configsMap[filename][propertyName],

http://git-wip-us.apache.org/repos/asf/ambari/blob/4f4959d2/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 5344fcb..51dfd8c 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -18,7 +18,6 @@
 
 var App = require('app');
 var stringUtils = require('utils/string_utils');
-var configPropertyHelper = require('utils/configs/config_property_helper');
 
 App.config = Em.Object.create({
 
@@ -581,98 +580,6 @@ App.config = Em.Object.create({
   },
 
   /**
-   * render configs, distribute them by service
-   * and wrap each in ServiceConfigProperty object
-   * @param configs
-   * @param storedConfigs
-   * @param allSelectedServiceNames
-   * @param installedServiceNames
-   * @param localDB
-   * @return {App.ServiceConfig[]}
-   */
-  renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames, localDB) {
-    var renderedServiceConfigs = [];
-    var services = [];
-
-    this.get('preDefinedServiceConfigs').forEach(function (serviceConfig) {
-      var serviceName = serviceConfig.get('serviceName');
-      if (allSelectedServiceNames.contains(serviceName) || serviceName === 'MISC') {
-        if (!installedServiceNames.contains(serviceName) || serviceName === 'MISC') {
-          serviceConfig.set('showConfig', true);
-        }
-        services.push(serviceConfig);
-      }
-    });
-    services.forEach(function (service) {
-      var configsByService = [];
-      var serviceConfigs = configs.filterProperty('serviceName', service.get('serviceName'));
-      serviceConfigs.forEach(function (_config) {
-        var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
-        this.updateHostOverrides(serviceConfigProperty, _config);
-        if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
-          configPropertyHelper.initialValue(serviceConfigProperty, localDB, configs);
-        }
-        serviceConfigProperty.validate();
-        configsByService.pushObject(serviceConfigProperty);
-      }, this);
-      var serviceConfig = this.createServiceConfig(service.get('serviceName'));
-      serviceConfig.set('showConfig', service.get('showConfig'));
-      serviceConfig.set('configs', configsByService);
-      this.addHostNamesToConfigs(serviceConfig, localDB.masterComponentHosts, localDB.slaveComponentHosts);
-      renderedServiceConfigs.push(serviceConfig);
-    }, this);
-    return renderedServiceConfigs;
-  },
-
-  /**
-   * Add host name properties to appropriate categories (for installer only)
-   * @param serviceConfig
-   * @param masterComponents
-   * @param slaveComponents
-   */
-  addHostNamesToConfigs: function(serviceConfig, masterComponents, slaveComponents) {
-    serviceConfig.get('configCategories').forEach(function(c) {
-      if (c.showHost) {
-        var value = [];
-        var componentName = c.name;
-        var masters = masterComponents.filterProperty('component', componentName);
-        if (masters.length) {
-          value = masters.mapProperty('hostName');
-        } else {
-          var slaves = slaveComponents.findProperty('componentName', componentName);
-          if (slaves) {
-            value = slaves.hosts.mapProperty('hostName');
-          }
-        }
-        var stackComponent = App.StackServiceComponent.find(componentName);
-        var hProperty = this.createHostNameProperty(serviceConfig.get('serviceName'), componentName, value, stackComponent);
-        serviceConfig.get('configs').push(App.ServiceConfigProperty.create(hProperty));
-      }
-    }, this);
-  },
-
-  /**
-   * create new child configs from overrides, attach them to parent config
-   * override - value of config, related to particular host(s)
-   * @param configProperty
-   * @param storedConfigProperty
-   */
-  updateHostOverrides: function (configProperty, storedConfigProperty) {
-    if (storedConfigProperty.overrides != null && storedConfigProperty.overrides.length > 0) {
-      var overrides = [];
-      storedConfigProperty.overrides.forEach(function (overrideEntry) {
-        // create new override with new value
-        var newSCP = App.ServiceConfigProperty.create(configProperty);
-        newSCP.set('value', overrideEntry.value);
-        newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
-        newSCP.set('parentSCP', configProperty);
-        overrides.pushObject(newSCP);
-      });
-      configProperty.set('overrides', overrides);
-    }
-  },
-
-  /**
    * create new ServiceConfig object by service name
    * @param {string} serviceName
    * @param {App.ServiceConfigGroup[]} configGroups

http://git-wip-us.apache.org/repos/asf/ambari/blob/4f4959d2/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 6fd8e03..f59398f 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1145,15 +1145,15 @@ describe('App.InstallerStep7Controller', function () {
     });
 
     afterEach(function () {
-      App.config.renderConfigs.restore();
+      installerStep7Controller.renderConfigs.restore();
     });
 
-    it('if wizard isn\'t addService, should set output of App.config.renderConfigs', function () {
+    it('if wizard isn\'t addService, should set output of installerStep7Controller.renderConfigs', function () {
       var serviceConfigs = Em.A([
         {serviceName:'HDFS', configs: []},
         {}
       ]);
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.set('wizardController.name', 'installerController');
@@ -1165,7 +1165,7 @@ describe('App.InstallerStep7Controller', function () {
       var serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.reopen({selectedServiceNames: ['s2']});
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);
@@ -1195,7 +1195,7 @@ describe('App.InstallerStep7Controller', function () {
       );
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);
@@ -1223,7 +1223,7 @@ describe('App.InstallerStep7Controller', function () {
       );
 
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);
@@ -1253,7 +1253,7 @@ describe('App.InstallerStep7Controller', function () {
 
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
       installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);


[2/2] ambari git commit: AMBARI-13198 Unneeded buttons on the Service Configs page. (ababiichuk)

Posted by ab...@apache.org.
AMBARI-13198 Unneeded buttons on the Service Configs page. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: f7e29cd78e004fb13aeb20283bbc950369ddb0d5
Parents: e24e3c8
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Sep 23 11:39:13 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Sep 23 11:45:00 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/info/configs.js |  2 --
 .../app/templates/common/configs/service_config.hbs     |  2 +-
 ambari-web/app/templates/main/service/info/configs.hbs  | 12 +-----------
 .../app/views/common/configs/service_config_view.js     |  2 --
 4 files changed, 2 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f7e29cd7/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 05d66c7..db5f1ed 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -125,8 +125,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
     return App.config.get('preDefinedServiceConfigs');
   }.property('App.config.preDefinedServiceConfigs'),
 
-  showConfigHistoryFeature: true,
-
   /**
    * Number of errors in the configs in the selected service (only for AdvancedTab if App supports Enhanced Configs)
    * @type {number}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7e29cd7/ambari-web/app/templates/common/configs/service_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs
index f819fe0..72c7c35 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -84,7 +84,7 @@
   </div>
 {{/if}}
 
-{{#if view.showConfigHistoryFeature}}
+{{#if view.isOnTheServicePage}}
   {{#if allVersionsLoaded}}
     {{view App.ConfigHistoryFlowView serviceBinding="selectedService"}}
   {{else}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7e29cd7/ambari-web/app/templates/main/service/info/configs.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/configs.hbs b/ambari-web/app/templates/main/service/info/configs.hbs
index 5a60f91..0ffad28 100644
--- a/ambari-web/app/templates/main/service/info/configs.hbs
+++ b/ambari-web/app/templates/main/service/info/configs.hbs
@@ -48,17 +48,7 @@
       {{/isAccessible}}
     {{/if}}
     <div class="clearfix"></div>
-    {{view App.ServiceConfigView filterBinding="controller.filter" columnsBinding="controller.filterColumns" canEditBinding="controller.canEdit" showConfigHistoryFeatureBinding="controller.showConfigHistoryFeature"}}
-    {{#isAccessible ADMIN}}
-      {{#unless showConfigHistoryFeature}}
-          <p class="pull-right">
-              <!--<input class="btn btn-primary" type="button" value="Save" {{!bindAttr disabled="isSubmitDisabled"}} />-->
-              <a class="btn" {{action doCancel target="controller"}}>{{t common.cancel}}</a>
-              <a class="btn btn-primary" {{bindAttr disabled="isSubmitDisabled"}}
-                {{action saveStepConfigs target="controller"}}>{{t common.save}}</a>
-          </p>
-      {{/unless}}
-    {{/isAccessible}}
+    {{view App.ServiceConfigView filterBinding="controller.filter" columnsBinding="controller.filterColumns" canEditBinding="controller.canEdit"}}
   {{else}}
     <div class="spinner"></div>
   {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7e29cd7/ambari-web/app/views/common/configs/service_config_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js
index 016b546..5ad5c2e 100644
--- a/ambari-web/app/views/common/configs/service_config_view.js
+++ b/ambari-web/app/views/common/configs/service_config_view.js
@@ -114,8 +114,6 @@ App.ServiceConfigView = Em.View.extend({
     }
   }.property('controller.name', 'controller.selectedService'),
 
-  showConfigHistoryFeature: false,
-
   toggleRestartMessageView: function () {
     this.$('.service-body').toggle('blind', 200);
     this.set('isRestartMessageCollapsed', !this.get('isRestartMessageCollapsed'));