You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/05 23:50:32 UTC

svn commit: r1346620 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/db/schema.dump hmc/js/configureServicesUtils.js hmc/php/frontend/fetchClusterServices.php

Author: vikram
Date: Tue Jun  5 21:50:31 2012
New Revision: 1346620

URL: http://svn.apache.org/viewvc?rev=1346620&view=rev
Log:
AMBARI-346. user should not be allowed to change the paths to various directories on the advance config page (Contributed by Hitesh)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/db/schema.dump
    incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js
    incubator/ambari/branches/ambari-186/hmc/php/frontend/fetchClusterServices.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1346620&r1=1346619&r2=1346620&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Tue Jun  5 21:50:31 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-346. user should not be allowed to change the paths to various directories on the advance config page (Hitesh via Vikram)
+
   AMBARI-316. Grid mount points page doesn't let one pass with only a custom mount point (Vinod via Vikram)
 
   AMBARI-343. add option to enable webhdfs (Hitesh via Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/db/schema.dump
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/db/schema.dump?rev=1346620&r1=1346619&r2=1346620&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/db/schema.dump (original)
+++ incubator/ambari/branches/ambari-186/hmc/db/schema.dump Tue Jun  5 21:50:31 2012
@@ -205,16 +205,17 @@ CREATE TABLE  ConfigProperties (
                    --     "reconfigurable": whether the value can be edited during reconfiguration
                    --     "displayType": checkbox, multi-button checkbox, etc
                    --     "displayValues": possible values in case of multi-value selection ( not required for single value which is covered by the default value
-                   --     "unit": unit to show.  if not used, leave it undefined	
+                   --     "unit": unit to show.  if not used, leave it undefined
+                   --     "editable": if editable on configurations page
   PRIMARY KEY (key) ,
   FOREIGN KEY (service_name) REFERENCES Services(service_name)
 );
 
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_name_dir", "", "NameNode directories", "NameNode directories for HDFS to store the file system image", "HDFS", "TEXT", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_data_dir", "",  "DataNode directories", "DataNode directories for HDFS to store the data blocks", "HDFS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_local_dir", "", "MapReduce local directories", "Directories for MapReduce to store intermediate data files", "MAPREDUCE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "oozie_data_dir", "", "Oozie DB directory", "Data directory in which the Oozie DB exists", "OOZIE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
-INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "zk_data_dir", "", "ZooKeeper directory", "Data directory for ZooKeeper", "ZOOKEEPER", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_name_dir", "", "NameNode directories", "NameNode directories for HDFS to store the file system image", "HDFS", "TEXT", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text", "editable": false }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_data_dir", "",  "DataNode directories", "DataNode directories for HDFS to store the data blocks", "HDFS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text", "editable": false }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_local_dir", "", "MapReduce local directories", "Directories for MapReduce to store intermediate data files", "MAPREDUCE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text", "editable": false }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "oozie_data_dir", "", "Oozie DB directory", "Data directory in which the Oozie DB exists", "OOZIE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text", "editable": false }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "zk_data_dir", "", "ZooKeeper directory", "Data directory for ZooKeeper", "ZOOKEEPER", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text", "editable": false }' );
 INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_mysql_host", "", "MySQL host", "MySQL host on which the Hive Metastore is hosted", "HIVE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
 INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_database_name", "hive", "MySQL Database Name", "MySQL Database name used as the Hive Metastore", "HIVE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
 INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_metastore_user_name", "dbusername", "MySQL user", "MySQL username to use to connect to the MySQL database", "HIVE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );

Modified: incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js?rev=1346620&r1=1346619&r2=1346620&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/configureServicesUtils.js Tue Jun  5 21:50:31 2012
@@ -3,15 +3,26 @@
 
 var globalPasswordsArray = [];
 
-function generateDivForService (option, type, service, property, unit) { 
+function generateDivForService (option, type, service, property, unit, displayAttributes) {
 	
   var unitString = (unit != null) ? unit : '';
+  var readOnlyFlag= false;
+  if (displayAttributes != null && displayAttributes.editable != null
+      && !displayAttributes.editable) {
+    readOnlyFlag = true;
+  }
+
   var retString = '<div class="formElement">' +
     '<label for="' + service + '">' + option['displayName'] + '</label>' +
     //((unitString != '') ? '<div class="input-append">' : '') +
-    '<input class="unit-' + unit + '" type="' + type + '" id="' + property + '" name="' + service + '" value="' + option['value'] + '"> ' + unitString + 
+    '<input class="unit-' + unit + '" type="' + type + '" id="' + property + '" name="' + service + '" value="' + option['value'] + '"';
+  if (readOnlyFlag) {
+    retString += ' readonly="readonly" ';
+  }
+
+  retString += '> ' + unitString +
     '<div class="contextualHelp">' + option['description'] + '</div>' +
-    //((unitString != '') ? '</div>' : '') + 
+    //((unitString != '') ? '</div>' : '') +
     '<div class="formInputErrorReason" id="' + property + 'ErrorReason' + '"></div>' +
     '</div>';
   if (type == "password") {
@@ -24,7 +35,7 @@ function generateDivForService (option, 
 
     /// Put it in the global passwd array
     globalPasswordsArray[globalPasswordsArray.length] = {
-      "passwordDivId"     : property, 
+      "passwordDivId"     : property,
       "verificationDivId" : property + 'SecretService'
     };
     globalYui.log("Global Passwords Array: " + globalYui.Lang.dump(globalPasswordsArray));
@@ -34,10 +45,10 @@ function generateDivForService (option, 
 }
 
 function constructDOM(optionsInfo) {
-  /* Reset globalPasswordsArray at the beginning of each render cycle to 
+  /* Reset globalPasswordsArray at the beginning of each render cycle to
    * avoid using stale data from the last run - this isn't a problem on the
-   * Configure Services page, but it bites us on the Manage Services page 
-   * there is re-use of this module of code within the same JS memory. 
+   * Configure Services page, but it bites us on the Manage Services page
+   * there is re-use of this module of code within the same JS memory.
    */
   globalPasswordsArray = [];
   var optionsSummary = "";
@@ -54,7 +65,12 @@ function constructDOM(optionsInfo) {
         }
         serviceNeedsRender = true;
         var unit = optionsInfo['services'][servicesKey]['properties'][property]['unit'];
-        propertiesRendering += generateDivForService(optionsInfo['services'][servicesKey]["properties"][property], type, servicesKey, property, unit);
+        var displayAttributes = null;
+        if (optionsInfo['services'][servicesKey]['properties'][property]['displayAttributes']) {
+           displayAttributes = optionsInfo['services'][servicesKey]['properties'][property]['displayAttributes'];
+        }
+
+        propertiesRendering += generateDivForService(optionsInfo['services'][servicesKey]["properties"][property], type, servicesKey, property, unit, displayAttributes);
       }
       if (serviceNeedsRender) {
         optionsSummary += "<fieldset> <legend>" + servicesKey + "</legend>";
@@ -138,7 +154,7 @@ function checkPasswordCorrectness () {
   errString += "</ul>";
 
   retArray = {
-    "passwdMatched" : passwdMatch, 
+    "passwdMatched" : passwdMatch,
     "focusOn"       : focusId,
     "errorCount"    : errCount,
     "errorString"   : errString
@@ -156,7 +172,7 @@ function generateUserOpts () {
     return {};
   }
   cleanupClassesForPasswordErrors();
- 
+
   var desiredOptions = {};
 
   var temp = globalYui.all("#configureClusterAdvancedDynamicRenderDivId div[name=configureClusterAdvancedPerServiceDiv]");
@@ -183,11 +199,11 @@ function generateUserOpts () {
     };
 
   });
-  
+
 //  globalYui.log("Final Options: " + globalYui.Lang.dump(desiredOptions));
-  
+
   clearFormStatus();
-  clearErrorReasons(desiredOptions); 
+  clearErrorReasons(desiredOptions);
 
   return desiredOptions;
 }
@@ -202,7 +218,7 @@ function handleConfigureServiceErrors(er
     globalYui.log('Setting content ' + errorReason + ' for div ' + elemReason);
     globalYui.one('#' + elemReason).setContent(errorReason);
   }
-  document.getElementById('formStatusDivId').scrollIntoView()    
+  document.getElementById('formStatusDivId').scrollIntoView()
 }
 
 /////////////////// End of submitting related functions /////////////////////////////

Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/fetchClusterServices.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/fetchClusterServices.php?rev=1346620&r1=1346619&r2=1346620&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/fetchClusterServices.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/fetchClusterServices.php Tue Jun  5 21:50:31 2012
@@ -176,6 +176,7 @@ if ($getConfigs == "true") {
             "type" => $propInfo["displayType"],
         	"unit" => $propInfo["displayAttributes"]["unit"],
             "value" => $value,
+            "displayAttributes" => $propInfo["displayAttributes"]
           );
       }
     }