Browse Source

AMBARI-1145. Cluster Management refactoring. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431791 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
5e3da1fd91

+ 21 - 3
ambari-web/app/controllers/main/service/info/configs.js

@@ -306,6 +306,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
             serviceConfigObj.serviceName = this.get('configs').someProperty('name', index) ? this.get('configs').findProperty('name', index).serviceName : null;
             serviceConfigObj.displayName = this.get('configs').someProperty('name', index) ? this.get('configs').findProperty('name', index).displayName : null;
             serviceConfigObj.category = this.get('configs').someProperty('name', index) ? this.get('configs').findProperty('name', index).category : null;
+            serviceConfigObj.options = this.get('configs').someProperty('name', index) ? this.get('configs').findProperty('name', index).options : null;
             globalConfigs.pushObject(serviceConfigObj);
           } else if (!this.get('configMapping').someProperty('name', index)) {
             if (advancedConfig.someProperty('name', index)) {
@@ -548,9 +549,29 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         });
       }
     }, this);
+
+    this.setHiveHostName(globalConfigs);
     this.set('globalConfigs', globalConfigs);
   },
 
+  setHiveHostName: function(globals) {
+    if (globals.someProperty('name', 'hive_database')) {
+      //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgres is not the default db
+      var hiveDb = globals.findProperty('name', 'hive_database');
+      if (hiveDb.value === 'New MySQL Database') {
+        if (globals.someProperty('name', 'hive_ambari_host')) {
+          globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_hostname';
+        }
+        globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
+      } else {
+        globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_hostname';
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
+      }
+    }
+  },
+
   saveSiteConfigs: function (configs) {
     var storedConfigs = configs.filterProperty('id', 'site property').filterProperty('value');
     var uiConfigs = this.loadUiSideConfigs();
@@ -923,9 +944,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         var hiveMetastoreHost = serviceConfigs.findProperty('name', 'hivemetastore_host');
         hiveMetastoreHost.defaultValue = this.get('content.components').findProperty('componentName', 'HIVE_SERVER').get('host.hostName');
         globalConfigs.push(hiveMetastoreHost);
-        var hiveDbHost = serviceConfigs.findProperty('name', 'hive_mysql_hostname');
-        hiveDbHost.defaultValue = this.get('content.components').findProperty('componentName', 'HIVE_SERVER').get('host.hostName');
-        globalConfigs.push(hiveDbHost);
         break;
       case 'OOZIE':
         var oozieServerHost = serviceConfigs.findProperty('name', 'oozieserver_host');

+ 1 - 1
ambari-web/app/data/config_mapping.js

@@ -333,7 +333,7 @@ module.exports = [
    */
   {
     "name": "javax.jdo.option.ConnectionURL",
-    "templateName": ["hive_mysql_host", "hive_database_name"],
+    "templateName": ["hive_mysql_hostname", "hive_database_name"],
     "foreignKey": null,
     "value": "jdbc:mysql://<templateName[0]>\/<templateName[1]>?createDatabaseIfNotExist=true",
     "filename": "hive-site.xml"

+ 2 - 0
ambari-web/app/data/config_properties.js

@@ -867,6 +867,7 @@ module.exports =
       ],
       "description": "MySQL will be installed by Ambari",
       "displayType": "radio button",
+      "isReconfigurable": false,
       "radioName": "hive-database",
       "isVisible": true,
       "domain": "global",
@@ -882,6 +883,7 @@ module.exports =
       "description": "Using an existing database for Hive Metastore",
       "displayType": "masterHost",
       "isVisible": false,
+      "isReconfigurable": false,
       "domain": "global",
       "serviceName": "HIVE",
       "category": "Hive Metastore"

+ 12 - 3
ambari-web/app/views/wizard/controls_view.js

@@ -161,7 +161,10 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
   serviceConfig: null,
   categoryConfigs: null,
   nameBinding: 'serviceConfig.radioName',
-  optionsBinding: 'serviceConfig.options'
+  optionsBinding: 'serviceConfig.options',
+  disabled: function () {
+    return !this.get('serviceConfig.isEditable');
+  }.property('serviceConfig.isEditable')
 });
 
 App.ServiceConfigRadioButton = Ember.Checkbox.extend({
@@ -196,13 +199,19 @@ App.ServiceConfigRadioButton = Ember.Checkbox.extend({
         }
       }, this);
     }, this);
-  }.observes('checked')
+  }.observes('checked'),
+  disabled: function () {
+    return !this.get('serviceConfig.isEditable');
+  }.property('serviceConfig.isEditable')
 });
 
 App.ServiceConfigComboBox = Ember.Select.extend(App.ServiceConfigPopoverSupport, {
   contentBinding: 'serviceConfig.options',
   selectionBinding: 'serviceConfig.value',
-  classNames: [ 'span3' ]
+  classNames: [ 'span3' ],
+  disabled: function () {
+    return !this.get('serviceConfig.isEditable');
+  }.property('serviceConfig.isEditable')
 });