diff options
author | Yusaku Sako <yusaku@apache.org> | 2012-12-09 15:14:23 +0000 |
---|---|---|
committer | Yusaku Sako <yusaku@apache.org> | 2012-12-09 15:14:23 +0000 |
commit | ee1801a10bdf1a74de65b377a5b18efbd89a0df0 (patch) | |
tree | 5caac72e716315eb55fbcea65b295c7ee836d504 /ambari-web | |
parent | 2f2ad380560a41f8241605ffc15a262795e76f57 (diff) |
AMBARI-1059. Refactor cluster management. (yusaku)
git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1419005 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'ambari-web')
-rw-r--r-- | ambari-web/app/controllers/wizard/step8_controller.js | 104 | ||||
-rw-r--r-- | ambari-web/app/templates/main/host.hbs | 2 | ||||
-rw-r--r-- | ambari-web/app/templates/main/service/info/summary.hbs | 2 |
3 files changed, 64 insertions, 44 deletions
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index e5f1fd5cfa..bd42bba22c 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -726,8 +726,8 @@ App.WizardStep8Controller = Em.Controller.extend({ 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.Controller.extend({ 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.Controller.extend({ 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.Controller.extend({ 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.Controller.extend({ } console.log('registering ' + componentName + ' to ' + JSON.stringify(hostNames)); - var hostsPredicate = hostNames.map(function (hostName) { - return 'Hosts/host_name=' + hostName; - }).join('|'); + // 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 = ''; + } + }); - var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + hostsPredicate; - var data = { - "host_components": [ - { - "HostRoles": { - "component_name": componentName + 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 () { diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs index 524f3e15c3..8b8b1cc2fc 100644 --- a/ambari-web/app/templates/main/host.hbs +++ b/ambari-web/app/templates/main/host.hbs @@ -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> diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs index 820ba01c27..3f2a3cf359 100644 --- a/ambari-web/app/templates/main/service/info/summary.hbs +++ b/ambari-web/app/templates/main/service/info/summary.hbs @@ -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> |