You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/12/09 16:14:23 UTC

svn commit: r1419005 - in /incubator/ambari/branches/AMBARI-666/ambari-web/app: controllers/wizard/step8_controller.js templates/main/host.hbs templates/main/service/info/summary.hbs

Author: yusaku
Date: Sun Dec  9 15:14:23 2012
New Revision: 1419005

URL: http://svn.apache.org/viewvc?rev=1419005&view=rev
Log:
AMBARI-1059. Refactor cluster management. (yusaku)

Modified:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js?rev=1419005&r1=1419004&r2=1419005&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js Sun Dec  9 15:14:23 2012
@@ -726,8 +726,8 @@ App.WizardStep8Controller = Em.Controlle
       timeout: App.timeout,
       success: function (data) {
         var jsonData = jQuery.parseJSON(data);
-        console.log("TRACE: STep8 -> In success function for createCluster call");
-        console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+        console.log("TRACE: Step8 -> In success function for createCluster call");
+        console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
       },
 
       error: function (request, ajaxOptions, error) {
@@ -755,9 +755,9 @@ App.WizardStep8Controller = Em.Controlle
       timeout: App.timeout,
       success: function (data) {
         var jsonData = jQuery.parseJSON(data);
-        console.log("TRACE: STep8 -> In success function for the createService call");
-        console.log("TRACE: STep8 -> value of the url is: " + url);
-        console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+        console.log("TRACE: Step8 -> In success function for the createSelectedServices call");
+        console.log("TRACE: Step8 -> value of the url is: " + url);
+        console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
 
       },
 
@@ -804,9 +804,9 @@ App.WizardStep8Controller = Em.Controlle
         timeout: App.timeout,
         success: function (data) {
           var jsonData = jQuery.parseJSON(data);
-          console.log("TRACE: STep8 -> In success function for createComponent");
-          console.log("TRACE: STep8 -> value of the url is: " + url);
-          console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+          console.log("TRACE: Step8 -> In success function for createComponents");
+          console.log("TRACE: Step8 -> value of the url is: " + url);
+          console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
         },
 
         error: function (request, ajaxOptions, error) {
@@ -838,9 +838,9 @@ App.WizardStep8Controller = Em.Controlle
       timeout: App.timeout,
       success: function (data) {
         var jsonData = jQuery.parseJSON(data);
-        console.log("TRACE: STep8 -> In success function for registerHostToCluster");
-        console.log("TRACE: STep8 -> value of the url is: " + url);
-        console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+        console.log("TRACE: Step8 -> In success function for registerHostsToCluster");
+        console.log("TRACE: Step8 -> value of the url is: " + url);
+        console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
 
       },
 
@@ -926,42 +926,62 @@ App.WizardStep8Controller = Em.Controlle
     }
     console.log('registering ' + componentName + ' to ' + JSON.stringify(hostNames));
 
-    var hostsPredicate = hostNames.map(function (hostName) {
-      return 'Hosts/host_name=' + hostName;
-    }).join('|');
-
-    var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + hostsPredicate;
-    var data = {
-      "host_components": [
-        {
-          "HostRoles": {
-            "component_name": componentName
+    // currently we are specifying the predicate as a query string.
+    // this can hit a ~4000-character limit in Jetty server.
+    // chunk to multiple calls if needed
+    // var hostsPredicate = hostNames.map(function (hostName) {
+    //   return 'Hosts/host_name=' + hostName;
+    // }).join('|');
+
+    var queryStrArr = []
+    var queryStr = '';
+    hostNames.forEach(function (hostName) {
+      queryStr += 'Hosts/host_name=' + hostName + '|';
+      if (queryStr.length > 3500) {
+        queryStrArr.push(queryStr.slice(0, -1));
+        queryStr = '';
+      }
+    });
+
+    if (queryStr.length > 0) {
+      queryStrArr.push(queryStr.slice(0, -1));
+    }
+
+    queryStrArr.forEach(function (queryStr) {
+      // console.log('creating host components for ' + queryStr);
+      var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + queryStr;
+      var data = {
+        "host_components": [
+          {
+            "HostRoles": {
+              "component_name": componentName
+            }
           }
-        }
-      ]
-    };
+        ]
+      };
 
-    $.ajax({
-      type: 'POST',
-      url: url,
-      async: false,
-      dataType: 'text',
-      timeout: App.timeout,
-      data: JSON.stringify(data),
-      success: function (data) {
-        var jsonData = jQuery.parseJSON(data);
-        console.log("TRACE: STep8 -> In success function for the createComponent with new host call");
-        console.log("TRACE: STep8 -> value of the url is: " + url);
-        console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
-      },
+      $.ajax({
+        type: 'POST',
+        url: url,
+        async: false,
+        dataType: 'text',
+        timeout: App.timeout,
+        data: JSON.stringify(data),
+        success: function (data) {
+          var jsonData = jQuery.parseJSON(data);
+          console.log("TRACE: Step8 -> In success function for the registerHostsToComponent");
+          console.log("TRACE: Step8 -> value of the url is: " + url);
+          console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
+        },
 
-      error: function (request, ajaxOptions, error) {
-        console.log('Step8: In Error ');
-        console.log('Step8: Error message is: ' + request.responseText);
-      },
+        error: function (request, ajaxOptions, error) {
+          console.log('Step8: In Error ');
+          console.log('Step8: Error message is: ' + request.responseText);
+        },
 
-      statusCode: require('data/statusCodes')
-    });
+        statusCode: require('data/statusCodes')
+      });
+    }, this);
   },
 
   createConfigurations: function () {

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs?rev=1419005&r1=1419004&r2=1419005&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs Sun Dec  9 15:14:23 2012
@@ -31,7 +31,7 @@
     <thead>
     <tr>
       <th>Name</th>
-      <th>Ip</th>
+      <th>IP Address</th>
       <th>CPU</th>
       <th>RAM</th>
       <th>Disk Usage</th>

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs?rev=1419005&r1=1419004&r2=1419005&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs Sun Dec  9 15:14:23 2012
@@ -133,7 +133,7 @@
 <div class="span6">
 	<div class="box">
 		<div class="box-header">
-			<h4>Alerts</h4>
+			<h4>Alerts and Health Checks</h4>
 			<div class="btn-group">
         <a class="btn" target="_blank" rel="tooltip" title="Go to Nagios" {{bindAttr href="controller.nagiosUrl"}}><i class="icon-link"></i></a>
 			</div>