ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-14080. Test connection for Ranger from ambari takes the DB flavor selected before. (jaimin)
Date Thu, 26 Nov 2015 01:21:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 677e4e306 -> 3c1944c18


AMBARI-14080. Test connection for Ranger from ambari takes the DB flavor selected before.
(jaimin)


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

Branch: refs/heads/trunk
Commit: 3c1944c187ee429a0a87ac1ddd135d7109d724c2
Parents: 677e4e3
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Wed Nov 25 17:20:12 2015 -0800
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Wed Nov 25 17:20:52 2015 -0800

----------------------------------------------------------------------
 .../widgets/test_db_connection_widget_view.js       | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c1944c1/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
b/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
index 5105e9a..b5073cf 100644
--- a/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
@@ -23,6 +23,7 @@ var App = require('app');
 App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
   templateName: require('templates/common/configs/widgets/test_db_connection_widget'),
   classNames: ['widget'],
+  dbInfo: require('data/db_properties_info'),
 
   /** @property {string} btnCaption - text for button **/
   btnCaption: Em.computed.alias('config.stackConfigProperty.widget.display-name'),
@@ -94,10 +95,9 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
 
   /**
    *  This function is used to set Database name and master host name
-   * @param requiredProperties
+   * @param requiredProperties: `config.stackConfigProperty.widget.required-properties` as
stated in the theme
    */
   setDbProperties: function(requiredProperties) {
-    var dbInfo = require('data/db_properties_info');
     var dbProperties = {
       'db.connection.source.host' : 'masterHostName',
       'db.type' : 'db_type',
@@ -112,9 +112,6 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
       var fileName =  split[0] + '.xml';
       var configName =  split[1];
       var dbConfig = this.get('requiredProperties').filterProperty('filename',fileName).findProperty('name',
configName);
-      if (key === 'db.type') {
-        dbConfig = dbInfo.dpPropertiesMap[dbConfig.value].db_type.toUpperCase();
-      }
       this.set(dbProperties[key], dbConfig);
     }
   },
@@ -193,13 +190,14 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
    **/
   createCustomAction: function () {
     var connectionProperties = this.getProperties('db_connection_url','user_name', 'user_passwd');
+    var db_name = this.dbInfo.dpPropertiesMap[this.get('db_type').value].db_type;
     var isServiceInstalled = App.Service.find(this.get('config.serviceName')).get('isLoaded');
     for (var key in connectionProperties) {
       if (connectionProperties.hasOwnProperty(key)) {
         connectionProperties[key] = connectionProperties[key].value;
       }
     }
-    var params = $.extend(true, {}, {db_name: this.get('db_type').toLowerCase()}, connectionProperties,
this.get('ambariProperties'));
+    var params = $.extend(true, {}, {db_name: db_name}, connectionProperties, this.get('ambariProperties'));
     var filteredHosts =  Array.isArray(this.get('masterHostName.value')) ? this.get('masterHostName.value')
: [this.get('masterHostName.value')];
     App.ajax.send({
       name: (isServiceInstalled) ? 'cluster.custom_action.create' : 'custom_action.create',
@@ -289,6 +287,7 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
   },
 
   setResponseStatus: function (isSuccess) {
+    var db_type = this.dbInfo.dpPropertiesMap[this.get('db_type').value].db_type.toUpperCase();
     var isSuccess = isSuccess == 'success';
     this.setConnectingStatus(false);
     this.set('responseCaption', isSuccess ? Em.I18n.t('services.service.config.database.connection.success')
: Em.I18n.t('services.service.config.database.connection.failed'));
@@ -296,7 +295,7 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
     this.set('isRequestResolved', true);
     if (this.get('logsPopup')) {
       var statusString = isSuccess ? 'common.success' : 'common.error';
-      this.set('logsPopup.header', Em.I18n.t('services.service.config.connection.logsPopup.header').format(this.get('db_type'),
Em.I18n.t(statusString)));
+      this.set('logsPopup.header', Em.I18n.t('services.service.config.connection.logsPopup.header').format(db_type,
Em.I18n.t(statusString)));
     }
   },
   /**
@@ -336,8 +335,9 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
   showLogsPopup: function () {
     if (this.get('isConnectionSuccess')) return;
     var _this = this;
+    var db_type = this.dbInfo.dpPropertiesMap[this.get('db_type').value].db_type.toUpperCase();
     var statusString = this.get('isRequestResolved') ? 'common.error' : 'common.testing';
-    var popup = App.showAlertPopup(Em.I18n.t('services.service.config.connection.logsPopup.header').format(this.get('db_type'),
Em.I18n.t(statusString)), null, function () {
+    var popup = App.showAlertPopup(Em.I18n.t('services.service.config.connection.logsPopup.header').format(db_type,
Em.I18n.t(statusString)), null, function () {
       _this.set('logsPopup', null);
     });
     popup.reopen({


Mime
View raw message