You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by xi...@apache.org on 2014/06/13 23:58:30 UTC

git commit: AMBARI-6122. Explicitly tell the user to set up JDBC driver if an existing db option is selected for Hive / Oozie. (xiwang)

Repository: ambari
Updated Branches:
  refs/heads/trunk fbd5235e2 -> effb34ff8


AMBARI-6122. Explicitly tell the user to set up JDBC driver if an existing db option is selected for Hive / Oozie. (xiwang)


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

Branch: refs/heads/trunk
Commit: effb34ff844636fab186f91344c91fe07780f227
Parents: fbd5235
Author: Xi Wang <xi...@apache.org>
Authored: Fri Jun 13 14:27:31 2014 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Fri Jun 13 14:57:44 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/messages.js                   |  3 +++
 ambari-web/app/views/wizard/controls_view.js | 32 +++++++++++++++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/effb34ff/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index e5be25b..ec3641d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1298,6 +1298,9 @@ Em.I18n.translations = {
   'services.service.config.database.connection.failed': 'Connection Failed',
   'services.service.config.database.btn.idle': 'Test Connection',
   'services.service.config.database.btn.connecting': 'Connecting...',
+  'services.service.config.database.msg.jdbcSetup': 'Be sure you have run:<br/>' +
+    '<b>ambari-server setup --jdbc-db={0} --jdbc-driver=/path/to/{1}/driver.jar</b> ' +
+    'on the Ambari Server host to make the JDBC driver available and to enable testing the database connection.',
 
   'services.add.header':'Add Service Wizard',
   'services.reassign.header':'Move Master Wizard',

http://git-wip-us.apache.org/repos/asf/ambari/blob/effb34ff/ambari-web/app/views/wizard/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/controls_view.js b/ambari-web/app/views/wizard/controls_view.js
index aa4aff2..b867701 100644
--- a/ambari-web/app/views/wizard/controls_view.js
+++ b/ambari-web/app/views/wizard/controls_view.js
@@ -337,25 +337,47 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
 
   /**
    * `Observer` that add <code>additionalView</code> to <code>App.ServiceConfigProperty</code>
-   * that responsible for checking database connection.
+   * that responsible for (if existing db selected)
+   * 1. checking database connection
+   * 2. showing jdbc driver setup warning msg.
    *
    * @method handleDBConnectionProperty
    **/
   handleDBConnectionProperty: function() {
-    if (!App.supports.databaseConnection) return;
     if (!['addServiceController', 'installerController'].contains(App.clusterStatus.wizardControllerName)) return;
     var handledProperties = ['oozie_database', 'hive_database'];
     var currentValue = this.get('serviceConfig.value');
     var databases = /MySQL|PostgreSQL|Oracle|Derby/gi;
     var currentDB = currentValue.match(databases)[0];
+    var databasesTypes = /MySQL|PostgreS|Oracle|Derby/gi;
+    var currentDBType = currentValue.match(databasesTypes)[0];
     var existingDatabase = /existing/gi.test(currentValue);
-    var propertyAppendTo = this.get('categoryConfigsAll').findProperty('displayName', 'Database URL');
+    // db connection check button show up if existed db selected
+    if (App.supports.databaseConnection) {
+      var propertyAppendTo1 = this.get('categoryConfigsAll').findProperty('displayName', 'Database URL');
+      if (currentDB && existingDatabase) {
+        if (handledProperties.contains(this.get('serviceConfig.name'))) {
+          if (propertyAppendTo1) propertyAppendTo1.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
+        }
+      } else {
+        propertyAppendTo1.set('additionalView', null);
+      }
+    }
+    // warning msg under database type radio buttons, to warn the user to setup jdbc driver if existed db selected
+    var propertyHive = this.get('categoryConfigsAll').findProperty('displayName', 'Hive Database');
+    var propertyOozie = this.get('categoryConfigsAll').findProperty('displayName', 'Oozie Database');
+    var propertyAppendTo2 = propertyHive ? propertyHive : propertyOozie;
     if (currentDB && existingDatabase) {
       if (handledProperties.contains(this.get('serviceConfig.name'))) {
-        if (propertyAppendTo) propertyAppendTo.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
+        if (propertyAppendTo2) {
+          propertyAppendTo2.set('additionalView', Ember.View.extend({
+            template: Ember.Handlebars.compile('<div class="alert">{{{view.message}}}</div>'),
+            message: Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(currentDBType.toLowerCase(), currentDBType.toLowerCase())
+          }));
+        }
       }
     } else {
-      propertyAppendTo.set('additionalView', null);
+      propertyAppendTo2.set('additionalView', null);
     }
   }.observes('serviceConfig.value', 'configs.@each.value'),