Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

AMBARI-1059. Refactor cluster management. (yusaku)

  • Loading branch information...
commit 9b15091e8f0ebae95f513fc27a4bf075bd052eda 1 parent 750bc81
Yusaku Sako authored
Showing with 1,799 additions and 786 deletions.
  1. +42 −14 ambari-web/app/assets/data/apps/runs.json
  2. +65 −7 ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
  3. BIN  ambari-web/app/assets/img/spinner.gif
  4. +3 −3 ambari-web/app/controllers/application.js
  5. +52 −22 ambari-web/app/controllers/global/background_operations_controller.js
  6. +20 −71 ambari-web/app/controllers/installer.js
  7. +15 −4 ambari-web/app/controllers/main.js
  8. +12 −23 ambari-web/app/controllers/main/host/add_controller.js
  9. +7 −18 ambari-web/app/controllers/main/service/add_controller.js
  10. +79 −8 ambari-web/app/controllers/wizard.js
  11. +14 −0 ambari-web/app/controllers/wizard/slave_component_groups_controller.js
  12. +2 −2 ambari-web/app/controllers/wizard/step10_controller.js
  13. +3 −19 ambari-web/app/controllers/wizard/step1_controller.js
  14. +71 −16 ambari-web/app/controllers/wizard/step2_controller.js
  15. +137 −68 ambari-web/app/controllers/wizard/step3_controller.js
  16. +1 −0  ambari-web/app/controllers/wizard/step5_controller.js
  17. +41 −21 ambari-web/app/controllers/wizard/step7_controller.js
  18. +379 −217 ambari-web/app/controllers/wizard/step8_controller.js
  19. +25 −32 ambari-web/app/controllers/wizard/step9_controller.js
  20. +2 −1  ambari-web/app/data/config_mapping.js
  21. +226 −11 ambari-web/app/data/config_properties.js
  22. +9 −1 ambari-web/app/data/service_components.js
  23. +1 −1  ambari-web/app/data/service_configs.js
  24. +11 −11 ambari-web/app/messages.js
  25. +6 −3 ambari-web/app/models/hosts.js
  26. +106 −0 ambari-web/app/models/service_config.js
  27. +37 −2 ambari-web/app/router.js
  28. +14 −10 ambari-web/app/routes/add_host_routes.js
  29. +8 −7 ambari-web/app/routes/add_service_routes.js
  30. +13 −15 ambari-web/app/routes/installer.js
  31. +2 −2 ambari-web/app/routes/main.js
  32. +128 −14 ambari-web/app/styles/application.less
  33. +5 −9 ambari-web/app/templates/application.hbs
  34. +1 −1  ambari-web/app/templates/login.hbs
  35. +6 −10 ambari-web/app/templates/main.hbs
  36. +29 −23 ambari-web/app/templates/main/background_operations_popup.hbs
  37. +6 −2 ambari-web/app/templates/main/charts/linear_time.hbs
  38. +1 −1  ambari-web/app/templates/main/dashboard/service/hive.hbs
  39. +2 −1  ambari-web/app/templates/main/dashboard/service/oozie.hbs
  40. +2 −1  ambari-web/app/templates/main/dashboard/service/zookeeper.hbs
  41. +2 −2 ambari-web/app/templates/main/service/info/configs.hbs
  42. +2 −0  ambari-web/app/templates/main/service/info/summary.hbs
  43. +13 −12 ambari-web/app/templates/wizard/step2.hbs
  44. +14 −11 ambari-web/app/templates/wizard/step3.hbs
  45. +2 −2 ambari-web/app/templates/wizard/step7.hbs
  46. +6 −3 ambari-web/app/utils/data_table.js
  47. +15 −17 ambari-web/app/utils/db.js
  48. +2 −1  ambari-web/app/utils/graph.js
  49. +24 −16 ambari-web/app/utils/helper.js
  50. +60 −26 ambari-web/app/views/common/chart/linear_time.js
  51. +10 −1 ambari-web/app/views/common/modal_popup.js
  52. +6 −0 ambari-web/app/views/login.js
  53. +19 −2 ambari-web/app/views/main.js
  54. +8 −1 ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
  55. +2 −5 ambari-web/app/views/main/host.js
  56. +9 −1 ambari-web/app/views/main/host/metrics/cpu.js
  57. +1 −1  ambari-web/app/views/main/menu.js
  58. +1 −1  ambari-web/app/views/main/service/info/metrics/mapreduce/jvm_heap.js
  59. +1 −1  ambari-web/app/views/main/service/info/metrics/mapreduce/jvm_threads.js
  60. +7 −1 ambari-web/app/views/main/service/info/summary.js
  61. +3 −3 ambari-web/app/views/main/service/item.js
  62. +2 −1  ambari-web/app/views/wizard/step1_view.js
  63. +6 −6 ambari-web/app/views/wizard/step2_view.js
  64. +1 −1  ambari-web/app/views/wizard/step9_view.js
View
56 ambari-web/app/assets/data/apps/runs.json
@@ -53,7 +53,9 @@
}
},
"workflowId": "hive_7c779523-6bca-416e-89b3-b01b73a60174",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 473423,
+ "outputBytes": 82434
},
{
"elapsedTime": 910360,
@@ -84,7 +86,9 @@
}
},
"workflowId": "pig_5750f4cf-f0d2-4e3d-a7ce-90912b309c12",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 923423,
+ "outputBytes": 32434
},
{
"elapsedTime": 920579,
@@ -115,7 +119,9 @@
}
},
"workflowId": "mr_25547729-88f9-4287-a45a-64901a82f22b",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 623423,
+ "outputBytes": 42434
},
{
"elapsedTime": 687631,
@@ -138,7 +144,9 @@
}
},
"workflowId": "hive_a5b9c06f-96d2-4ea8-80e0-3c063ae831d4",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 483423,
+ "outputBytes": 82434
},
{
"elapsedTime": 905375,
@@ -169,7 +177,9 @@
}
},
"workflowId": "pig_90ac94ff-20c4-4637-8b1c-51379cfe10df",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 428423,
+ "outputBytes": 32434
},
{
"elapsedTime": 683055,
@@ -192,7 +202,9 @@
}
},
"workflowId": "hive_c832f923-9bd4-421f-9a51-8f45991d91de",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 723423,
+ "outputBytes": 62434
},
{
"elapsedTime": 35150977,
@@ -223,7 +235,9 @@
}
},
"workflowId": "mr_a0aade31-47f8-475b-b887-60a79bcea5c4",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 463423,
+ "outputBytes": 57434
},
{
"elapsedTime": 888790,
@@ -254,7 +268,9 @@
}
},
"workflowId": "pig_b4365f79-18da-4db6-bbfd-e8a850d6c6e8",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 723423,
+ "outputBytes": 82434
},
{
"elapsedTime": 902653,
@@ -285,7 +301,9 @@
}
},
"workflowId": "hive_b6bf29a4-324f-4435-8ed3-bee10622ea48",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 923423,
+ "outputBytes": 52434
},
{
"elapsedTime": 884834,
@@ -316,7 +334,9 @@
}
},
"workflowId": "pig_a6a6fb32-b3fd-4427-ab54-449d0895fbb2",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 403423,
+ "outputBytes": 82434
},
{
"elapsedTime": 674392,
@@ -339,7 +359,9 @@
}
},
"workflowId": "pig_f69499b1-a504-433e-8904-0760deb5a183",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 423123,
+ "outputBytes": 52434
},
{
"elapsedTime": 926853,
@@ -370,7 +392,9 @@
}
},
"workflowId": "mr_73e04732-ea7f-43b8-9a2f-0f5a30e665da",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 523423,
+ "outputBytes": 92434
},
{
"elapsedTime": 0,
@@ -401,7 +425,9 @@
}
},
"workflowId": "pig_31b2111b-cc2e-4024-a8db-d181855a463f",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 443423,
+ "outputBytes": 32434
},
{
"elapsedTime": 670929,
@@ -424,6 +450,8 @@
}
},
"workflowId": "hive_097d0698-3620-4232-9c79-4deccbf6c98a",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 428423,
+ "outputBytes": 18434
}
]}
View
72 ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
@@ -1,12 +1,70 @@
{
- "href" : "http://localhost:8080/api/v1/hosts?fields=Hosts/total_mem,Hosts/cpu_count",
- "items" : [
+ "href": "http://localhost:8080/api/v1/hosts?fields=Hosts/total_mem,Hosts/cpu_count",
+ "items": [
{
- "href" : "http://localhost:8080/api/v1/hosts/localhost.localdomain",
- "Hosts" : {
- "cpu_count" : 1,
- "total_mem" : 4057989,
- "host_name" : "localhost.localdomain"
+ "href": "http://localhost:8080/api/v1/hosts/localhost.localdomain",
+ "Hosts": {
+ "cpu_count": 1,
+ "total_mem": 4057989,
+ "host_name": "localhost.localdomain",
+ "disk_info": [
+ {
+ "available": "47574176",
+ "used": "3507828",
+ "percent": "7%",
+ "size": "51606140",
+ "type": "ext4",
+ "mountpoint": "/"
+ },
+ {
+ "available": "47574176",
+ "used": "3507828",
+ "percent": "7%",
+ "size": "51606140",
+ "type": "ext4",
+ "mountpoint": "/grid/0"
+ },
+ {
+ "available": "1027204",
+ "used": "260",
+ "percent": "1%",
+ "size": "1027464",
+ "type": "tmpfs",
+ "mountpoint": "/dev/shm"
+ },
+ {
+ "available": "432210",
+ "used": "38034",
+ "percent": "9%",
+ "size": "495844",
+ "type": "ext4",
+ "mountpoint": "/boot"
+ },
+ {
+ "available": "44459872",
+ "used": "184220",
+ "percent": "1%",
+ "size": "47033288",
+ "type": "ext4",
+ "mountpoint": "/home"
+ },
+ {
+ "available": "450200708",
+ "used": "281534268",
+ "percent": "39%",
+ "size": "731734976",
+ "type": "vboxsf",
+ "mountpoint": "/media/sf_ambari"
+ },
+ {
+ "available": "450200708",
+ "used": "281534268",
+ "percent": "39%",
+ "size": "731734976",
+ "type": "vboxsf",
+ "mountpoint": "/host"
+ }
+ ]
}
}
]
View
BIN  ambari-web/app/assets/img/spinner.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 ambari-web/app/controllers/application.js
@@ -23,12 +23,12 @@ App.ApplicationController = Em.Controller.extend({
name: 'applicationController',
clusterName: function () {
- var name = App.db.getClusterName();
+ var name = App.router.get('clusterController.clusterName');
if (name) {
return name.capitalize();
}
- return '';
- }.property(),
+ return Em.I18n.t('installer.header');
+ }.property('App.router.clusterController.clusterName'),
isClusterDataLoaded: function() {
return App.router.get('clusterController.isLoaded');
}.property('App.router.clusterController.isLoaded'),
View
74 ambari-web/app/controllers/global/background_operations_controller.js
@@ -28,6 +28,11 @@ App.BackgroundOperationsController = Em.Controller.extend({
allOperations: [],
allOperationsCount : 0,
+ executeTasks: [],
+
+ getTasksByRole: function (role) {
+ return this.get('allOperations').filterProperty('role', role);
+ },
getOperationsForRequestId: function(requestId){
return this.get('allOperations').filterProperty('request_id', requestId);
@@ -129,45 +134,69 @@ App.BackgroundOperationsController = Em.Controller.extend({
}.observes('isWorking'),
/**
- * Add new operations to <code>this.allOperations</code> variable
+ * Update info about background operations
+ * Put all tasks with command 'EXECUTE' into <code>executeTasks</code>, other tasks with it they are still running put into <code>runningTasks</code>
+ * Put all task that should be shown in popup modal window into <code>this.allOperations</code>
* @param data json loaded from server
*/
- updateBackgroundOperations : function(data){
+ updateBackgroundOperations: function (data) {
var runningTasks = [];
+ var executeTasks = this.get('executeTasks');
data.items.forEach(function (item) {
item.tasks.forEach(function (task) {
- if (task.Tasks.status == 'QUEUED' || task.Tasks.status == 'PENDING') {
- runningTasks.push(task.Tasks);
+ if (task.Tasks.command == 'EXECUTE') {
+ if (!executeTasks.someProperty('id', task.Tasks.id)) {
+ executeTasks.push(task.Tasks);
+ }
+ } else {
+ if (task.Tasks.status == 'QUEUED' || task.Tasks.status == 'PENDING' || task.Tasks.status == 'IN_PROGRESS') {
+ runningTasks.push(task.Tasks);
+ }
}
});
});
- runningTasks = runningTasks.sort(function(a,b){
+ for (var i = 0; i < executeTasks.length; i++) {
+ if (executeTasks[i].status == 'QUEUED' || executeTasks[i].status == 'PENDING' || executeTasks[i].status == 'IN_PROGRESS') {
+ var url = App.testMode ? '/data/background_operations/list_on_start.json' :
+ App.apiPrefix + '/clusters/' + App.router.getClusterName() + '/requests/' + executeTasks[i].request_id + '/tasks/' + executeTasks[i].id;
+ var j = i;
+ $.ajax({
+ type: "GET",
+ url: url,
+ dataType: 'json',
+ timeout: App.timeout,
+ success: function (data) {
+ if (data) {
+ executeTasks[j] = data.Tasks;
+ }
+ },
+ error: function () {
+ console.log('ERROR: error during executeTask update');
+ },
+
+ statusCode: require('data/statusCodes')
+ });
+ }
+ }
+ ;
+ var currentTasks;
+ currentTasks = runningTasks.concat(executeTasks);
+ currentTasks = currentTasks.sort(function (a, b) {
return a.id - b.id;
});
- var currentTasks = this.get('allOperations');
-
- runningTasks.forEach(function(item){
- var task = currentTasks.findProperty('id', item.id);
- if(task){
- currentTasks[currentTasks.indexOf(task)] = item;
- } else {
- currentTasks.pushObject(item);
+ this.get('allOperations').filterProperty('isOpen').mapProperty('id').forEach(function(id){
+ if (currentTasks.someProperty('id', id)) {
+ currentTasks.findProperty('id', id).isOpen = true;
}
});
- for(var i = currentTasks.length-1; i>=0; i--){
- var isTaskFinished = !runningTasks.someProperty('id', currentTasks[i].id);
- if(isTaskFinished){
- currentTasks.removeAt(i);
- }
- }
-
- this.set('allOperationsCount', currentTasks.length);
+ this.set('allOperations', currentTasks);
+ this.set('allOperationsCount', runningTasks.length + executeTasks.filterProperty('status', 'PENDING').length + executeTasks.filterProperty('status', 'QUEUED').length + executeTasks.filterProperty('status', 'IN_PROGRESS').length);
var eventsArray = this.get('eventsArray');
- if(eventsArray.length){
+ if (eventsArray.length) {
var itemsToRemove = [];
eventsArray.forEach(function(item){
@@ -190,6 +219,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
* Onclick handler for background operations number located right to logo
*/
showPopup: function(){
+ this.set('executeTasks', []);
this.loadOperations();
App.ModalPopup.show({
headerClass: Ember.View.extend({
View
91 ambari-web/app/controllers/installer.js
@@ -38,38 +38,8 @@ App.InstallerController = App.WizardController.extend({
controllerName: 'installerController'
}),
- /**
- * Load clusterInfo(step1) to model
- */
- loadClusterInfo: function () {
- var cStatus = App.db.getClusterStatus() || {status: "", isCompleted: false};
- var cluster = {
- name: App.db.getClusterName() || "",
- status: cStatus.status,
- isCompleted: cStatus.isCompleted,
- requestId: cStatus.requestId,
- installStartTime: cStatus.installStartTime,
- installTime: cStatus.installTime
- };
- this.set('content.cluster', cluster);
-
- console.log("InstallerController:loadClusterInfo: loaded data ", cluster);
- },
-
- /**
- * Save all info about cluster to model
- * @param stepController Step1WizardController
- */
- saveClusterInfo: function (stepController) {
- var cluster = stepController.get('content.cluster');
- var clusterStatus = {
- status: cluster.status,
- isCompleted: cluster.isCompleted
- };
- App.db.setClusterName(cluster.name);
- App.db.setClusterStatus(clusterStatus);
-
- console.log("InstallerController:saveClusterInfo: saved data ", cluster);
+ getCluster: function(){
+ return jQuery.extend(this.get('clusterStatusTemplate'), {});
},
/**
@@ -95,7 +65,7 @@ App.InstallerController = App.WizardController.extend({
//TODO : rewire it as model. or not :)
var hostsInfo = Em.Object.create();
- hostsInfo.hostNames = App.db.getAllHostNames() || ''; //empty string if undefined
+ hostsInfo.hostNames = App.db.getAllHostNamesPattern() || ''; //empty string if undefined
//TODO : should we check installType for add host wizard????
var installType = App.db.getInstallType();
@@ -128,7 +98,8 @@ App.InstallerController = App.WizardController.extend({
//TODO: put data to content.hosts and only then save it)
//App.db.setBootStatus(false);
- App.db.setAllHostNames(stepController.get('hostNames'));
+ App.db.setAllHostNames(stepController.get('hostNameArr').join("\n"));
+ App.db.setAllHostNamesPattern(stepController.get('hostNames'));
App.db.setBootRequestId(stepController.get('bootRequestId'));
App.db.setHosts(stepController.getHostInfo());
if (stepController.get('manualInstall') === false) {
@@ -164,6 +135,7 @@ App.InstallerController = App.WizardController.extend({
name: _host.name,
cpu: _host.cpu,
memory: _host.memory,
+ disk_info: _host.disk_info,
bootStatus: _host.bootStatus,
isInstalled: false
};
@@ -361,7 +333,7 @@ App.InstallerController = App.WizardController.extend({
_content.get('configs').forEach(function (_configProperties) {
var displayType = _configProperties.get('displayType');
if (displayType === 'directories' || displayType === 'directory') {
- var value = _configProperties.get('value').split(/\s+/g).join(',');
+ var value = _configProperties.get('value').trim().split(/\s+/g).join(',');
_configProperties.set('value', value);
}
var configProperty = {
@@ -370,6 +342,7 @@ App.InstallerController = App.WizardController.extend({
value: _configProperties.get('value'),
defaultValue: _configProperties.get('defaultValue'),
service: _configProperties.get('serviceName'),
+ domain: _configProperties.get('domain'),
filename: _configProperties.get('filename')
};
serviceConfigProperties.push(configProperty);
@@ -386,12 +359,17 @@ App.InstallerController = App.WizardController.extend({
var slaveCategory = _content.get('configCategories').findProperty('isForSlaveComponent', true);
slaveCategory.get('slaveConfigs.groups').forEach(function (_group) {
_group.get('properties').forEach(function (_property) {
+ var displayType = _property.get('displayType');
+ if (displayType === 'directories' || displayType === 'directory') {
+ var value = _property.get('value').trim().split(/\s+/g).join(',');
+ _property.set('value', value);
+ }
_property.set('storeValue', _property.get('value'));
}, this);
}, this);
slaveConfigProperties.pushObject(slaveCategory.get('slaveConfigs'));
}
- }, this)
+ }, this);
App.db.setSlaveProperties(slaveConfigProperties);
this.set('content.slaveGroupProperties', slaveConfigProperties);
},
@@ -492,7 +470,7 @@ App.InstallerController = App.WizardController.extend({
case '2':
this.loadInstallOptions();
case '1':
- this.loadClusterInfo();
+ this.load('cluster');
}
},
@@ -609,49 +587,20 @@ App.InstallerController = App.WizardController.extend({
return serviceComponents;
},
-
- /*
- Bootstrap selected hosts.
- */
- launchBootstrap: function (bootStrapData) {
- var self = this;
- var requestId = null;
- var method = App.testMode ? 'GET' : 'POST';
- var url = App.testMode ? '/data/wizard/bootstrap/bootstrap.json' : App.apiPrefix + '/bootstrap';
- $.ajax({
- type: method,
- url: url,
- async: false,
- data: bootStrapData,
- timeout: App.timeout,
- contentType: 'application/json',
- success: function (data) {
- console.log("TRACE: POST bootstrap succeeded");
- requestId = data.requestId;
- },
- error: function () {
- console.log("ERROR: POST bootstrap failed");
- alert('Bootstrap call failed. Please try again.');
- },
- statusCode: require('data/statusCodes')
- });
- return requestId;
- },
-
-
/**
* Clear all temporary data
*/
finish: function () {
- this.setCurrentStep('1', false);
+ this.setCurrentStep('1');
App.db.setService(undefined); //not to use this data at AddService page
App.db.setHosts(undefined);
App.db.setMasterComponentHosts(undefined);
App.db.setSlaveComponentHosts(undefined);
- App.db.setClusterStatus(undefined);
+ App.db.setCluster(undefined);
App.db.setAllHostNames(undefined);
+ App.db.setSlaveProperties(undefined);
+ App.db.setSshKey(undefined);
}
-})
-;
+});
View
19 ambari-web/app/controllers/main.js
@@ -22,13 +22,25 @@ require('models/background_operation');
App.MainController = Em.Controller.extend({
name: 'mainController',
clusterName: function () {
- var name = App.db.getClusterName();
+ var name = App.router.get('clusterController.clusterName');
if (name) {
var displayName = name.length > 13 ? name.substr(0, 10) + "..." : name;
return displayName.capitalize();
}
- return '';
- }.property(),
+ return 'My Cluster';
+ }.property('App.router.clusterController.clusterName'),
+
+ updateTitle: function(){
+ var name = App.router.get('clusterController.clusterName');
+ if (name) {
+ name = name.length > 13 ? name.substr(0, 10) + "..." : name;
+ name = name.capitalize();
+ } else{
+ name = 'Loading';
+ }
+ $('title').text('Ambari - ' + name);
+ }.observes('App.router.clusterController.clusterName'),
+
isClusterDataLoaded: function(){
return App.router.get('clusterController.isLoaded');
}.property('App.router.clusterController.isLoaded'),
@@ -40,7 +52,6 @@ App.MainController = Em.Controller.extend({
App.router.get('clusterController').loadClusterData();
App.router.get('updateController').updateServiceMetric();
setInterval( this.updateAll , App.contentUpdateInterval);
- $('title').text('Ambari - ' + this.get('clusterName'));
},
updateAll: function(){
App.router.get('updateController').updateAll();
View
35 ambari-web/app/controllers/main/host/add_controller.js
@@ -54,24 +54,10 @@ App.AddHostController = App.WizardController.extend({
isWizard: true
}),
- /**
- * Load clusterInfo(step1) to model
- */
- loadClusterInfo: function () {
- var cluster = App.db.getClusterStatus();
- if (!cluster) {
- cluster = {
- name: App.router.getClusterName(),
- status: undefined,
- isCompleted: false,
- requestId: undefined,
- installStartTime: undefined,
- installTime: undefined
- };
- App.db.setClusterStatus(cluster);
- }
- this.set('content.cluster', cluster);
- console.log("AddHostController:loadClusterInfo: loaded data ", cluster);
+ getCluster: function(){
+ return jQuery.extend(this.get('clusterStatusTemplate'), {
+ name: App.router.getClusterName()
+ });
},
showMoreHosts: function () {
@@ -149,7 +135,7 @@ App.AddHostController = App.WizardController.extend({
hostsInfo.showMoreHostsText = "...and %@ more".fmt(moreHostNames.length);
}
- hostsInfo.hostNames = App.db.getAllHostNames() || ''; //empty string if undefined
+ hostsInfo.hostNames = App.db.getAllHostNamesPattern() || ''; //empty string if undefined
var installType = App.db.getInstallType();
//false if installType not equals 'manual'
@@ -164,6 +150,7 @@ App.AddHostController = App.WizardController.extend({
hostsInfo.localRepoPath = '';
}
+ hostsInfo.bootRequestId = App.db.getBootRequestId() || null;
hostsInfo.sshKey = '';
hostsInfo.passphrase = '';
hostsInfo.confirmPassphrase = '';
@@ -180,7 +167,9 @@ App.AddHostController = App.WizardController.extend({
//TODO: put data to content.hosts and only then save it)
//App.db.setBootStatus(false);
- App.db.setAllHostNames(stepController.get('hostNames'));
+ App.db.setAllHostNames(stepController.get('hostNameArr').join("\n"));
+ App.db.setAllHostNamesPattern(stepController.get('hostNames'));
+ App.db.setBootRequestId(stepController.get('bootRequestId'));
App.db.setHosts(stepController.getHostInfo());
if (stepController.get('manualInstall') === false) {
App.db.setInstallType({installType: 'ambari' });
@@ -559,7 +548,7 @@ App.AddHostController = App.WizardController.extend({
case '1':
this.loadInstallOptions();
case '0':
- this.loadClusterInfo();
+ this.load('cluster');
}
},
@@ -625,12 +614,12 @@ App.AddHostController = App.WizardController.extend({
* Clear all temporary data
*/
finish: function () {
- this.setCurrentStep('1', false);
+ this.setCurrentStep('1');
App.db.setService(undefined); //not to use this data at AddService page
App.db.setHosts(undefined);
App.db.setMasterComponentHosts(undefined);
App.db.setSlaveComponentHosts(undefined);
- App.db.setClusterStatus(undefined);
+ App.db.setCluster(undefined);
App.router.get('updateController').updateAll();
}
View
25 ambari-web/app/controllers/main/service/add_controller.js
@@ -54,21 +54,10 @@ App.AddServiceController = App.WizardController.extend({
isWizard: true
}),
- /**
- * Load clusterInfo(step1) to model
- */
- loadClusterInfo: function(){
- var cluster = App.db.getClusterStatus();
- if(!cluster){
- cluster = {
- name: App.router.getClusterName(),
- status: "",
- isCompleted: false
- };
- App.db.setClusterStatus(cluster);
- }
- this.set('content.cluster', cluster);
- console.log("AddServiceController:loadClusterInfo: loaded data ", cluster);
+ getCluster: function(){
+ return jQuery.extend(this.get('clusterStatusTemplate'), {
+ name: App.router.getClusterName()
+ });
},
/**
@@ -462,7 +451,7 @@ App.AddServiceController = App.WizardController.extend({
case '7':
case '6':
case '5':
- this.loadClusterInfo();
+ this.load('cluster');
case '4':
this.loadServiceConfigProperties();
case '3':
@@ -539,12 +528,12 @@ App.AddServiceController = App.WizardController.extend({
* Clear all temporary data
*/
finish: function(){
- this.setCurrentStep('1', false);
+ this.setCurrentStep('1');
App.db.setService(undefined); //not to use this data at AddService page
App.db.setHosts(undefined);
App.db.setMasterComponentHosts(undefined);
App.db.setSlaveComponentHosts(undefined);
- App.db.setClusterStatus(undefined);
+ App.db.setCluster(undefined);
App.db.setAllHostNames(undefined);
}
View
87 ambari-web/app/controllers/wizard.js
@@ -220,15 +220,29 @@ App.WizardController = Em.Controller.extend({
App.db.setAllHostNames(null);
},
+ toObject: function(object){
+ var result = {};
+ for(var i in object){
+ if(object.hasOwnProperty(i)){
+ result[i] = object[i];
+ }
+ }
+ return result;
+ },
+
/**
* save status of the cluster. This is called from step8 and step9 to persist install and start requestId
* @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
*/
saveClusterStatus: function (clusterStatus) {
- clusterStatus.name = this.get('content.cluster.name');
+ var oldStatus = this.toObject(this.get('content.cluster'));
+ clusterStatus = jQuery.extend(oldStatus, clusterStatus);
+ if(clusterStatus.requestId &&
+ clusterStatus.oldRequestsId.indexOf(clusterStatus.requestId) === -1){
+ clusterStatus.oldRequestsId.push(clusterStatus.requestId);
+ }
this.set('content.cluster', clusterStatus);
- console.log(this.get('name') + '.saveClusterStatus: ' + JSON.stringify(clusterStatus));
- App.db.setClusterStatus(clusterStatus);
+ this.save('cluster');
},
/**
@@ -242,7 +256,7 @@ App.WizardController = Em.Controller.extend({
var self = this;
var clusterName = this.get('content.cluster.name');
- var url = (App.testMode) ? '/data/wizard/deploy/poll_1.json' : App.apiPrefix + '/clusters/' + clusterName + '/services?ServiceInfo/state=INIT';
+ var url = (App.testMode) ? '/data/wizard/deploy/2_hosts/poll_1.json' : App.apiPrefix + '/clusters/' + clusterName + '/services?ServiceInfo/state=INIT';
var method = (App.testMode) ? 'GET' : 'PUT';
var data = '{"ServiceInfo": {"state": "INSTALLED"}}';
$.ajax({
@@ -258,7 +272,7 @@ App.WizardController = Em.Controller.extend({
console.log("TRACE: In success function for the installService call");
console.log("TRACE: value of the url is: " + url);
if (jsonData) {
- var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
+ var requestId = jsonData.Requests.id;
console.log('requestId is: ' + requestId);
var clusterStatus = {
status: 'PENDING',
@@ -292,13 +306,70 @@ App.WizardController = Em.Controller.extend({
},
+ /*
+ Bootstrap selected hosts.
+ */
+ launchBootstrap: function (bootStrapData) {
+ var self = this;
+ var requestId = null;
+ var method = App.testMode ? 'GET' : 'POST';
+ var url = App.testMode ? '/data/wizard/bootstrap/bootstrap.json' : App.apiPrefix + '/bootstrap';
+ $.ajax({
+ type: method,
+ url: url,
+ async: false,
+ data: bootStrapData,
+ timeout: App.timeout,
+ contentType: 'application/json',
+ success: function (data) {
+ console.log("TRACE: POST bootstrap succeeded");
+ requestId = data.requestId;
+ },
+ error: function () {
+ console.log("ERROR: POST bootstrap failed");
+ alert('Bootstrap call failed. Please try again.');
+ },
+ statusCode: require('data/statusCodes')
+ });
+ return requestId;
+ },
+
+ /**
+ * Load <code>content.<name></code> variable from localStorage, if wasn't loaded before.
+ * If you specify <code>reload</code> to true - it will reload it.
+ * @param name
+ * @param reload
+ * @return {Boolean}
+ */
load: function (name, reload) {
if (this.get('content.' + name) && !reload) {
return false;
}
- var result = App.db['get' + name.capitalize()];
- if (!result) result = this['get' + name.capitalize()];
+ var result = App.db['get' + name.capitalize()]();
+ if (!result){
+ result = this['get' + name.capitalize()]();
+ App.db['set' + name.capitalize()](result);
+ console.log(this.get('name') + ": created " + name, result);
+ }
this.set('content.' + name, result);
- console.log("Installer controller: loaded" + name, result);
+ console.log(this.get('name') + ": loaded " + name, result);
+ },
+
+ save: function(name){
+ var value = this.toObject(this.get('content.' + name));
+ App.db['set' + name.capitalize()](value);
+ console.log(this.get('name') + ": saved " + name, value);
+ },
+
+ clusterStatusTemplate : {
+ name: "",
+ status: "PENDING",
+ isCompleted: false,
+ requestId: null,
+ installStartTime: null,
+ installTime: null,
+ isInstallError: false,
+ isStartError: false,
+ oldRequestsId: []
}
})
View
14 ambari-web/app/controllers/wizard/slave_component_groups_controller.js
@@ -47,10 +47,14 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
var categoryConfig = _serviceConfig.get('configCategories');
if (categoryConfig.someProperty('isForSlaveComponent', true)) {
var slaveCategory = categoryConfig.findProperty('isForSlaveComponent', true);
+ // this.get('content') -> Output of Step 6: Mapping of each slave component and set of hosts it runs on
if (this.get('content')) {
if (this.get('content').someProperty('componentName', slaveCategory.get('primaryName'))) {
+ // component --> each column in Step 6 is a component ( slave component )
var component = this.get('content').findProperty('componentName', slaveCategory.get('primaryName'));
+ // slaveConfigs --> originally set as null in the class App.SlaveCategory in model/service_config.js
var slaveConfigs = slaveCategory.get('slaveConfigs');
+
slaveCategory.set('slaveConfigs', App.SlaveConfigs.create(component));
var slaveGroups = [];
if (component.groups) {
@@ -77,6 +81,7 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
}, this);
},
+ // returns key-value pairs i.e. all fields for slave component for this specific service.
componentProperties: function (serviceName) {
var serviceConfigs = require('data/service_configs').findProperty('serviceName', serviceName);
@@ -96,6 +101,15 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
var slaveConfigs = serviceConfigs.configs.filterProperty('category', componentName);
slaveConfigs.forEach(function (_serviceConfigProperty) {
var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
+
+ switch(serviceConfigProperty.name){
+ case 'dfs_data_dir' :
+ serviceConfigProperty.initialValue();
+ break;
+ case 'mapred_local_dir' :
+ serviceConfigProperty.initialValue();
+ break;
+ }
configs.pushObject(serviceConfigProperty);
serviceConfigProperty.validate();
}, this);
View
4 ambari-web/app/controllers/wizard/step10_controller.js
@@ -115,11 +115,11 @@ App.WizardStep10Controller = Em.Controller.extend({
var timedOutTasks = _host.tasks.filterProperty('Tasks.status', 'TIMEDOUT');
timedOutTasks.forEach(function (_task) {
- var abortStatement = clusterState + App.format.role(_task.Tasks.role) + ' timed out on ' + _host.name;
+ var timedOutStatement = clusterState + App.format.role(_task.Tasks.role) + ' timed out on ' + _host.name;
this.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', 2).get('statements').pushObject(Ember.Object.create({
status: 'timedout',
color: 'text-info',
- displayStatement: timedOutTasks
+ displayStatement: timedOutStatement
}));
}, this);
}, this);
View
22 ambari-web/app/controllers/wizard/step1_controller.js
@@ -21,31 +21,15 @@ var App = require('app');
App.WizardStep1Controller = Em.Controller.extend({
name: 'wizardStep1Controller',
- clusterName: function(){
- return this.get('content.cluster.name');
- }.property('content.cluster.name'),
-
-
hasSubmitted : false,
- clearStep: function() {
- this.set('content.cluster.name','');
- },
-
loadStep: function () {
- var clusterName;
this.set('hasSubmitted',false);
- console.log('The value of the cluster name is: ' + App.db.getClusterName());
- if (App.db.getClusterName() !== undefined) {
- this.set('clusterName', App.db.getClusterName());
- } else {
- this.set('clusterNameError','');
- this.set('invalidClusterName',true);
- }
},
invalidClusterName : function(){
if(!this.get('hasSubmitted')){
+ this.set('clusterNameError', '');
return false;
}
@@ -76,8 +60,8 @@ App.WizardStep1Controller = Em.Controller.extend({
submit: function () {
this.set('hasSubmitted', true);
if (!this.get('invalidClusterName')) {
- this.set('content.cluster',{name: this.get('clusterName'), status: 'PENDING', isCompleted: false});
- // App.router.get('installerController').saveClusterStatus({status: 'PENDING', isCompleted: false});
+ this.set('content.cluster.status', 'PENDING');
+ this.set('content.cluster.isCompleted', false);
App.router.send('next');
}
}
View
87 ambari-web/app/controllers/wizard/step2_controller.js
@@ -21,32 +21,33 @@ var App = require('app');
App.WizardStep2Controller = Em.Controller.extend({
name: 'wizardStep2Controller',
hostNameArr: [],
+ isPattern: false,
bootRequestId: null,
hasSubmitted: false,
hostNames: function () {
- return this.get('content.hostNames');
- }.property('content.hostNames'),
+ return this.get('content.hosts.hostNames');
+ }.property('content.hosts.hostNames'),
manualInstall: function () {
- return this.get('content.manualInstall');
- }.property('content.manualInstall'),
+ return this.get('content.hosts.manualInstall');
+ }.property('content.hosts.manualInstall'),
localRepo: function () {
- return this.get('content.localRepo');
- }.property('content.localRepo'),
+ return this.get('content.hosts.localRepo');
+ }.property('content.hosts.localRepo'),
sshKey: function () {
- return this.get('content.sshKey');
- }.property('content.sshKey'),
+ return this.get('content.hosts.sshKey');
+ }.property('content.hosts.sshKey'),
passphrase: function () {
- return this.get('content.passphrase');
- }.property('content.passphrase'),
+ return this.get('content.hosts.passphrase');
+ }.property('content.hosts.passphrase'),
confirmPassphrase: function () {
- return this.get('content.confirmPassphrase');
- }.property('content.confirmPassphrase'),
+ return this.get('content.hosts.confirmPassphrase');
+ }.property('content.hosts.confirmPassphrase'),
installType: function () {
if (this.get('manualInstall') === true) {
@@ -98,7 +99,7 @@ App.WizardStep2Controller = Em.Controller.extend({
hostInfo[hostNameArr[i]] = {
name: hostNameArr[i],
installType: this.get('installType'),
- bootStatus: 'pending'
+ bootStatus: 'PENDING'
};
}
@@ -117,6 +118,45 @@ App.WizardStep2Controller = Em.Controller.extend({
return false;
}
+ if(this.isPattern)
+ {
+ this.hostNamePatternPopup(this.hostNameArr);
+ return false;
+ }
+
+ this.proceedNext();
+
+ },
+
+ patternExpression: function(){
+ var self = this;
+ var hostNames = [];
+ $.each(this.hostNameArr, function(e,a){
+ var start, end, extra = "";
+ if(/\[\d*\-\d*\]/.test(a)){
+ start=a.match(/\[\d*/);
+ end=a.match(/\-\d*/);
+ start=start[0].substr(1);
+ end=end[0].substr(1);
+
+ if(parseInt(start) <= parseInt(end) && parseInt(start) >= 0){
+ self.isPattern = true;
+ if(start[0] == "0" && start.length > 1)
+ {
+ extra = start[0];
+ }
+ for (var i = parseInt(start); i < parseInt(end) + 1; i++) {
+ hostNames.push(a.replace(/\[\d*\-\d*\]/, extra+i ))
+ }
+ }
+ }else{
+ hostNames.push(a);
+ }
+ });
+ this.hostNameArr = hostNames;
+ },
+
+ proceedNext: function(){
if (this.get('manualInstall') === true) {
this.manualInstallPopup();
return false;
@@ -129,13 +169,28 @@ App.WizardStep2Controller = Em.Controller.extend({
return true;
}
- var requestId = App.get('router.installerController').launchBootstrap(bootStrapData);
+ var requestId = App.router.get(this.get('content.controllerName')).launchBootstrap(bootStrapData);
if(requestId) {
- this.set('bootRequestId',requestId);
- App.router.send('next');
+ this.set('bootRequestId',requestId);
+ App.router.send('next');
}
},
+ hostNamePatternPopup: function (hostNames) {
+ var self = this;
+ App.ModalPopup.show({
+ header: Em.I18n.t('installer.step2.hostName.pattern.header'),
+ onPrimary: function () {
+ self.proceedNext();
+ this.hide();
+ },
+ bodyClass: Ember.View.extend({
+ template: Ember.Handlebars.compile(['{{#each host in view.hostNames}}<p>{{host}}</p>{{/each}}'].join('\n')),
+ hostNames: hostNames
+ })
+ });
+ },
+
manualInstallPopup: function (event) {
App.ModalPopup.show({
header: Em.I18n.t('installer.step2.manualInstall.popup.header'),
View
205 ambari-web/app/controllers/wizard/step3_controller.js
@@ -23,10 +23,47 @@ App.WizardStep3Controller = Em.Controller.extend({
hosts: [],
content: [],
bootHosts: [],
- maxRegistrationAttempts: 20,
- registrationAttempts: null,
+ registrationStartedAt: null,
+ registrationTimeoutSecs: 120,
isSubmitDisabled: true,
- categories: ['All Hosts', 'Success', 'Installing', 'Registering', 'Failed'],
+ hostStatusString: Em.I18n.t('installer.step3.hosts.summary'),
+ hostStatusSummary: function () {
+ var self = this;
+ return this.get('hostStatusString').fmt(self.getCategory('value', 'Installing').get('hostsCount'),
+ self.getCategory('value', 'Registering').get('hostsCount'),
+ self.getCategory('value', 'Success').get('hostsCount'),
+ self.getCategory('value', 'Failed').get('hostsCount'));
+
+ }.property('categories.@each.hostsCount'),
+ categoryObject: Em.Object.extend({
+ hostsCount: function () {
+ var category = this;
+ var hosts = this.get('controller.hosts').filterProperty('bootStatus', category.get('hostsBootStatus'));
+ return hosts.get('length');
+ }.property('controller.hosts.@each.bootStatus'), // 'hosts.@each.bootStatus'
+ label: function () {
+ return "%@ (%@)".fmt(this.get('value'), this.get('hostsCount'));
+ }.property('value', 'hostsCount')
+ }),
+ getCategory: function(field, value){
+ return this.get('categories').find(function(item){
+ return item.get(field) == value;
+ });
+ },
+ categories: function () {
+ var self = this;
+ self.categoryObject.reopen({
+ controller: self
+ });
+
+ return [
+ self.categoryObject.create({value: 'All Hosts', hostsCount: function () { return this.get('controller.hosts.length'); }.property('controller.hosts.length') }),
+ self.categoryObject.create({value: 'Success', hostsBootStatus: 'REGISTERED' }),
+ self.categoryObject.create({value: 'Installing', hostsBootStatus: 'RUNNING'}),
+ self.categoryObject.create({value: 'Registering', hostsBootStatus: 'REGISTERING'}),
+ self.categoryObject.create({value: 'Failed', hostsBootStatus: 'FAILED' })
+ ]
+ }.property(),
category: 'All Hosts',
allChecked: false,
@@ -41,7 +78,7 @@ App.WizardStep3Controller = Em.Controller.extend({
isRetryDisabled: function () {
return !(this.get('bootHosts').someProperty('bootStatus', 'FAILED') && !this.get('isSubmitDisabled'));
- }.property('bootHosts.@each.bootStatus','isSubmitDisabled'),
+ }.property('bootHosts.@each.bootStatus', 'isSubmitDisabled'),
mockData: require('data/mock/step3_hosts'),
mockRetryData: require('data/mock/step3_pollData'),
@@ -54,13 +91,15 @@ App.WizardStep3Controller = Em.Controller.extend({
}
} else {
this.set('bootHosts', this.get('hosts'));
- if (App.testMode && App.skipBootstrap) {
+ if (App.testMode) {
this.get('bootHosts').setEach('bootStatus', 'REGISTERED');
this.get('bootHosts').setEach('cpu', '2');
this.get('bootHosts').setEach('memory', '2000000');
this.getHostInfo();
} else {
- this.isHostsRegistered();
+ this.set('registrationStartedAt', null);
+ this.get('bootHosts').setEach('bootStatus', 'DONE');
+ this.startRegistration();
}
}
},
@@ -69,17 +108,18 @@ App.WizardStep3Controller = Em.Controller.extend({
this.hosts.clear();
this.bootHosts.clear();
this.set('isSubmitDisabled', true);
- this.set('registrationAttempts', 1);
},
loadStep: function () {
console.log("TRACE: Loading step3: Confirm Hosts");
- if (!this.get('hosts').length) {
- this.clearStep();
- var hosts = this.loadHosts();
- // hosts.setEach('bootStatus', 'RUNNING');
- this.renderHosts(hosts);
- } else {
+ this.set('registrationStartedAt', null);
+
+ this.clearStep();
+ var hosts = this.loadHosts();
+ // hosts.setEach('bootStatus', 'RUNNING');
+ this.renderHosts(hosts);
+
+ if(this.get('hosts').length) {
this.set('isSubmitDisabled', false);
}
},
@@ -119,7 +159,10 @@ App.WizardStep3Controller = Em.Controller.extend({
parseHostInfo: function (hostsStatusFromServer) {
hostsStatusFromServer.forEach(function (_hostStatus) {
var host = this.get('bootHosts').findProperty('name', _hostStatus.hostName);
- if (host !== null && host !== undefined) { // check if hostname extracted from REST API data matches any hostname in content
+ // check if hostname extracted from REST API data matches any hostname in content
+ // also, make sure that bootStatus modified by isHostsRegistered call does not get overwritten
+ // since these calls are being made in parallel
+ if (host && !['REGISTERED', 'REGISTERING'].contains(host.get('bootStatus'))) {
host.set('bootStatus', _hostStatus.status);
host.set('bootLog', _hostStatus.log);
}
@@ -130,16 +173,9 @@ App.WizardStep3Controller = Em.Controller.extend({
/* Returns the current set of visible hosts on view (All, Succeeded, Failed) */
visibleHosts: function () {
- if (this.get('category') === 'Success') {
- return (this.hosts.filterProperty('bootStatus', 'REGISTERED'));
- } else if (this.get('category') === 'Installing') {
- return (this.hosts.filterProperty('bootStatus', 'RUNNING'));
- } else if (this.get('category') === 'Registering') {
- return (this.hosts.filter(function(host) {
- return host.bootStatus == 'DONE' || host.bootStatus == 'REGISTERING';
- }));
- } else if (this.get('category') === 'Failed') {
- return (this.hosts.filterProperty('bootStatus', 'FAILED'));
+ var self = this;
+ if (this.get('category.hostsBootStatus')) {
+ return this.hosts.filterProperty('bootStatus', self.get('category.hostsBootStatus'));
} else { // if (this.get('category') === 'All Hosts')
return this.hosts;
}
@@ -185,13 +221,15 @@ App.WizardStep3Controller = Em.Controller.extend({
retryHosts: function (hosts) {
var bootStrapData = JSON.stringify({'verbose': true, 'sshKey': this.get('content.hosts.sshKey'), hosts: hosts.mapProperty('name')});
this.numPolls = 0;
- this.set('registrationAttempts', null);
if (this.get('content.hosts.manualInstall') !== true) {
var requestId = App.router.get('installerController').launchBootstrap(bootStrapData);
this.set('content.hosts.bootRequestId', requestId);
+ this.set('registrationStartedAt', null);
this.doBootstrap();
} else {
- this.isHostsRegistered();
+ this.set('registrationStartedAt', null);
+ this.get('bootHosts').setEach('bootStatus', 'DONE');
+ this.startRegistration();
}
},
@@ -211,7 +249,9 @@ App.WizardStep3Controller = Em.Controller.extend({
startBootstrap: function () {
//this.set('isSubmitDisabled', true); //TODO: uncomment after actual hookup
this.numPolls = 0;
+ this.set('registrationStartedAt', null);
this.set('bootHosts', this.get('hosts'));
+ this.get('bootHosts').setEach('bootStatus', 'PENDING');
this.doBootstrap();
},
@@ -225,26 +265,28 @@ App.WizardStep3Controller = Em.Controller.extend({
timeout: App.timeout,
success: function (data) {
if (data.hostsStatus !== null) {
- // in case of bootstrapping just one host, the server returns an object rather than an array...
+ // in case of bootstrapping just one host, the server returns an object rather than an array, so
+ // force into an array
if (!(data.hostsStatus instanceof Array)) {
data.hostsStatus = [ data.hostsStatus ];
}
console.log("TRACE: In success function for the GET bootstrap call");
- var result = self.parseHostInfo(data.hostsStatus);
- if (result) {
+ var keepPolling = self.parseHostInfo(data.hostsStatus);
+ if (data.hostsStatus.someProperty('status', 'DONE') || data.hostsStatus.someProperty('status', 'FAILED')) {
+ // kicking off registration polls after at least one host has succeeded
+ self.startRegistration();
+ }
+ if (keepPolling) {
window.setTimeout(function () {
self.doBootstrap()
}, 3000);
return;
}
}
- console.log('Bootstrap failed');
- self.stopBootstrap();
},
error: function () {
console.log('Bootstrap failed');
- self.stopBootstrap();
},
statusCode: require('data/statusCodes')
@@ -252,72 +294,93 @@ App.WizardStep3Controller = Em.Controller.extend({
},
- stopBootstrap: function () {
- //TODO: uncomment following line after the hook up with the API call
- console.log('stopBootstrap() called');
- // this.set('isSubmitDisabled',false);
- Ember.run.later(this, function () {
- this.startRegistration();
- }, 1000);
- },
+ /*
+ stopBootstrap: function () {
+ console.log('stopBootstrap() called');
+ Ember.run.later(this, function () {
+ this.startRegistration();
+ }, 1000);
+ },
+ */
startRegistration: function () {
- this.isHostsRegistered();
+ if (this.get('registrationStartedAt') == null) {
+ this.set('registrationStartedAt', new Date().getTime());
+ console.log('registration started at ' + this.get('registrationStartedAt'));
+ this.isHostsRegistered();
+ }
},
isHostsRegistered: function () {
var self = this;
var hosts = this.get('bootHosts');
var url = App.testMode ? '/data/wizard/bootstrap/single_host_registration.json' : App.apiPrefix + '/hosts';
- var method = 'GET';
+
$.ajax({
type: 'GET',
url: url,
timeout: App.timeout,
success: function (data) {
- console.log('registration attempt #' + self.get('registrationAttempts'));
+ console.log('registration attempt...');
var jsonData = App.testMode ? data : jQuery.parseJSON(data);
if (!jsonData) {
console.log("Error: jsonData is null");
return;
}
- // keep polling until all hosts are registered
- var allRegistered = true;
+ // keep polling until all hosts have registered/failed, or registrationTimeout seconds after the last host finished bootstrapping
+ var stopPolling = true;
hosts.forEach(function (_host, index) {
// Change name of first host for test mode.
- if (App.testMode === true) {
+ if (App.testMode) {
if (index == 0) {
_host.set('name', 'localhost.localdomain');
}
}
- if (jsonData.items.someProperty('Hosts.host_name', _host.name)) {
- if (_host.get('bootStatus') != 'REGISTERED') {
- _host.set('bootStatus', 'REGISTERED');
- _host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + '\nRegistration with the server succeeded.');
- }
- } else if (_host.get('bootStatus') == 'FAILED') {
- // ignore FAILED hosts
- } else {
- // there are some hosts that are not REGISTERED or FAILED
- // we need to keep polling
- allRegistered = false;
- if (_host.get('bootStatus') != 'REGISTERING') {
+ // actions to take depending on the host's current bootStatus
+ // RUNNING - bootstrap is running; leave it alone
+ // DONE - bootstrap is done; transition to REGISTERING
+ // REGISTERING - bootstrap is done but has not registered; transition to REGISTERED if host found in polling API result
+ // REGISTERED - bootstrap and registration is done; leave it alone
+ // FAILED - either bootstrap or registration failed; leave it alone
+ console.log(_host.name + ' bootStatus=' + _host.get('bootStatus'));
+ switch (_host.get('bootStatus')) {
+ case 'DONE':
_host.set('bootStatus', 'REGISTERING');
- currentBootLog = _host.get('bootLog') != null ? _host.get('bootLog') : '';
_host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + '\nRegistering with the server...');
- }
+ // update registration timestamp so that the timeout is computed from the last host that finished bootstrapping
+ self.get('registrationStartedAt', new Date().getTime());
+ stopPolling = false;
+ break;
+ case 'REGISTERING':
+ if (jsonData.items.someProperty('Hosts.host_name', _host.name)) {
+ console.log(_host.name + ' has been registered');
+ _host.set('bootStatus', 'REGISTERED');
+ _host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + '\nRegistration with the server succeeded.');
+ } else {
+ console.log(_host.name + ' is registering...');
+ stopPolling = false;
+ }
+ break;
+ case 'RUNNING':
+ stopPolling = false;
+ break;
+ case 'REGISTERED':
+ case 'FAILED':
+ default:
+ break;
}
}, this);
- if (allRegistered) {
+
+ if (stopPolling) {
self.getHostInfo();
- } else if (self.get('maxRegistrationAttempts') - self.get('registrationAttempts') >= 0) {
- self.set('registrationAttempts', self.get('registrationAttempts') + 1);
+ } else if (new Date().getTime() - self.get('registrationStartedAt') < self.get('registrationTimeoutSecs') * 1000) {
window.setTimeout(function () {
self.isHostsRegistered();
}, 3000);
} else {
- // maxed out on registration attempts. mark all REGISTERING hosts to FAILED
+ // registration timed out. mark all REGISTERING hosts to FAILED
+ console.log('registration timed out');
hosts.filterProperty('bootStatus', 'REGISTERING').forEach(function (_host) {
_host.set('bootStatus', 'FAILED');
_host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + '\nRegistration with the server failed.');
@@ -353,7 +416,7 @@ App.WizardStep3Controller = Em.Controller.extend({
var self = this;
var kbPerGb = 1024;
var hosts = this.get('bootHosts');
- var url = App.testMode ? '/data/wizard/bootstrap/single_host_information.json' : App.apiPrefix + '/hosts?fields=Hosts/total_mem,Hosts/cpu_count';
+ var url = App.testMode ? '/data/wizard/bootstrap/single_host_information.json' : App.apiPrefix + '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info';
var method = 'GET';
$.ajax({
type: 'GET',
@@ -361,12 +424,18 @@ App.WizardStep3Controller = Em.Controller.extend({
contentType: 'application/json',
timeout: App.timeout,
success: function (data) {
- var jsonData = App.testMode ? data : jQuery.parseJSON(data);
+ var jsonData = (App.testMode) ? data : jQuery.parseJSON(data);
hosts.forEach(function (_host) {
- var host = jsonData.items.findProperty('Hosts.host_name', _host.name);
- if (host) {
+ var host = (App.testMode) ? jsonData.items[0] : jsonData.items.findProperty('Hosts.host_name', _host.name);
+ if (App.skipBootstrap) {
+ _host.cpu = 2;
+ _host.memory = ((parseInt(2000000))).toFixed(2);
+ _host.disk_info = [{"mountpoint": "/", "type":"ext4"},{"mountpoint": "/grid/0", "type":"ext4"}, {"mountpoint": "/grid/1", "type":"ext4"}, {"mountpoint": "/grid/2", "type":"ext4"}];
+ } else if (host) {
_host.cpu = host.Hosts.cpu_count;
_host.memory = ((parseInt(host.Hosts.total_mem))).toFixed(2);
+ _host.disk_info = host.Hosts.disk_info;
+
console.log("The value of memory is: " + _host.memory);
}
});
View
1  ambari-web/app/controllers/wizard/step5_controller.js
@@ -64,6 +64,7 @@ App.WizardStep5Controller = Em.Controller.extend({
cpu:_host.cpu,
memory:_host.memory,
+ disk_info:_host.disk_info,
host_info:"%@ (%@, %@ cores)".fmt(_host.name, (_host.memory * 1024).bytesToSize(1, 'parseFloat'), _host.cpu)
// Uncomment to test sorting with random cpu, memory, host_info
View
62 ambari-web/app/controllers/wizard/step7_controller.js
@@ -52,7 +52,7 @@ App.WizardStep7Controller = Em.Controller.extend({
slaveComponentHosts: function () {
return this.get('content.slaveGroupProperties');
- }.property('content.slaveGroupProperties','content.slaveComponentHosts'),
+ }.property('content.slaveGroupProperties', 'content.slaveComponentHosts'),
serviceConfigs: require('data/service_configs'),
configMapping: require('data/config_mapping'),
@@ -71,6 +71,37 @@ App.WizardStep7Controller = Em.Controller.extend({
this.clearStep();
var serviceConfigs = this.get('serviceConfigs');
var advancedConfig = this.get('content.advancedServiceConfig') || [];
+ this.loadAdvancedConfig(serviceConfigs,advancedConfig);
+ this.loadHostConfigs();
+ this.loadCustomConfig();
+ this.renderServiceConfigs(serviceConfigs);
+ var storedServices = this.get('content.serviceConfigProperties');
+ if (storedServices) {
+ var configs = new Ember.Set();
+
+ // for all services`
+ this.get('stepConfigs').forEach(function (_content) {
+ //for all components
+ _content.get('configs').forEach(function (_config) {
+
+ var componentVal = storedServices.findProperty('name', _config.get('name'));
+ //if we have config for specified component
+ if (componentVal) {
+ //set it
+ _config.set('value', componentVal.value)
+ }
+
+ }, this);
+ }, this);
+
+ }
+ },
+
+ /*
+ Loads the advanced configs fetched from the server metadata libarary
+ */
+
+ loadAdvancedConfig: function (serviceConfigs,advancedConfig) {
advancedConfig.forEach(function (_config) {
if (_config) {
var service = serviceConfigs.findProperty('serviceName', _config.serviceName);
@@ -81,12 +112,16 @@ App.WizardStep7Controller = Em.Controller.extend({
_config.category = 'Advanced';
_config.displayName = _config.name;
_config.defaultValue = _config.value;
+ // make all advanced configs optional and populated by default
+ /*
if (/\${.*}/.test(_config.value) || (service.serviceName !== 'OOZIE' && service.serviceName !== 'HBASE')) {
_config.isRequired = false;
_config.value = '';
} else if (/^\s+$/.test(_config.value)) {
_config.isRequired = false;
}
+ */
+ _config.isRequired = false;
_config.isVisible = true;
_config.displayType = 'advanced';
service.configs.pushObject(_config);
@@ -94,28 +129,13 @@ App.WizardStep7Controller = Em.Controller.extend({
}
}
}, this);
- this.loadCustomConfig();
- this.renderServiceConfigs(serviceConfigs);
- var storedServices = this.get('content.serviceConfigProperties');
- if (storedServices) {
- var configs = new Ember.Set();
-
- // for all services`
- this.get('stepConfigs').forEach(function (_content) {
- //for all components
- _content.get('configs').forEach(function (_config) {
-
- var componentVal = storedServices.findProperty('name', _config.get('name'));
- //if we have config for specified component
- if (componentVal) {
- //set it
- _config.set('value', componentVal.value)
- }
+ },
- }, this);
- }, this);
+ /*
+ loads host related configs obtained from server.
+ */
+ loadHostConfigs: function() {
- }
},
View
596 ambari-web/app/controllers/wizard/step8_controller.js
@@ -48,66 +48,15 @@ App.WizardStep8Controller = Em.Controller.extend({
this.loadGlobals();
this.loadConfigs();
this.setCustomConfigs();
- this.loadClusterInfo();
this.loadSlaveConfiguration();
+ this.loadClusterInfo();
this.loadServices();
},
- loadSlaveConfiguration: function () {
- var slaveComponentConfig = this.convertSlaveConfig(this.get('content.slaveGroupProperties'));
- this.set("slaveComponentConfig", slaveComponentConfig);
- },
-
- convertSlaveConfig: function (slaveContent) {
- var dest = {
- "version": "1.0",
- "components": [
- ]
- };
-
- slaveContent.forEach(function (_slaveContent) {
- var newComponent = {};
- newComponent.componentName = _slaveContent.componentName;
- newComponent.serviceName = this.getServiceName(newComponent.componentName);
- newComponent.groups = [];
- _slaveContent.groups.forEach(function (_group) {
- var newGroup = {};
- newGroup.groupName = _group.name;
- newGroup.configVersion = "1.0"; // TODO : every time a new version should be generated
- newGroup.hostNames = _slaveContent.hosts.filterProperty("group", newGroup.groupName);
- newGroup.properties = _group.properties;
- if (!Ember.empty(newGroup.hostNames)) {
- newComponent.groups.push(newGroup);
- }
- }, this);
- dest.components.push(newComponent);
- }, this);
- return dest;
-
- },
-
- getServiceName: function (componentName) {
- var serviceName = null
- switch (componentName) {
- case 'DATANODE':
- serviceName = 'HDFS';
- break;
- case 'TASKTRACKER':
- serviceName = 'MAPREDUCE';
- break;
- case 'HBASE_REGIONSERVER':
- serviceName = 'HBASE';
- break;
- default:
- serviceName = null;
- }
- return serviceName;
- },
-
loadGlobals: function () {
var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
if (globals.someProperty('name', 'hive_database')) {
- //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgress is not the default db
+ //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 PostgreSQL Database') {
globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_host';
@@ -284,6 +233,100 @@ App.WizardStep8Controller = Em.Controller.extend({
}
},
+ loadSlaveConfiguration: function () {
+
+ var slaveComponentConfig = this.convertSlaveConfig(this.get('content.slaveGroupProperties'));
+ this.set("slaveComponentConfig", slaveComponentConfig);
+ },
+
+ convertSlaveConfig: function (slaveContent) {
+ var dest = {
+ "version": "1.0",
+ "components": [
+ ],
+ "slaveHostComponents": []
+ };
+
+ slaveContent.forEach(function (_slaveContent) {
+ var newComponent = {};
+ newComponent.componentName = _slaveContent.componentName;
+ newComponent.serviceName = this.getServiceInfo(newComponent.componentName).name;
+ newComponent.groups = [];
+ var index = 2;
+ _slaveContent.groups.forEach(function (_group) {
+ var newGroup = {};
+ newGroup.groupName = _group.name;
+ newGroup.configVersion = {config: {'global': 'version1', 'core-site': 'version1'}}; // TODO : every time a new version should be generated
+ if (this.getServiceInfo(_slaveContent.componentName)) {
+ newGroup.configVersion.config[this.getServiceInfo(_slaveContent.componentName).domain] = 'version' + index;
+ newGroup.configVersion.config[this.getServiceInfo(_slaveContent.componentName).siteName] = 'version' + index;
+ }
+ newGroup.siteVersion = 'version' + index;
+ newGroup.hostNames = _slaveContent.hosts.filterProperty("group", newGroup.groupName).mapProperty('hostName');
+ newGroup.properties = _group.properties;
+ if (!Ember.empty(newGroup.hostNames)) {
+ newComponent.groups.push(newGroup);
+ }
+ index++;
+ }, this);
+ dest.components.push(newComponent);
+ }, this);
+ var hostsInfo = this.get('content.hostsInfo');
+
+ for (var index in hostsInfo) {
+ var hostIndex = 2;
+ var slaveHost = {name: null, configVersion: null, slaveComponents: []};
+ dest.components.forEach(function (_component) {
+ _component.groups.forEach(function (_group) {
+ if (_group.hostNames.contains(hostsInfo[index].name)) {
+ var slaveComponent = {};
+ slaveHost.name = hostsInfo[index].name;
+ slaveComponent.componentName = _component.componentName;
+ slaveComponent.groupName = _group.groupName;
+ slaveComponent.properties = _group.properties;
+ slaveHost.slaveComponents.pushObject(slaveComponent);
+ }
+ }, this);
+ }, this);
+ hostIndex++;
+ if (!Ember.none(slaveHost.name)) {
+ dest.slaveHostComponents.pushObject(slaveHost);
+ }
+
+ }
+ return dest;
+ },
+
+ getServiceInfo: function (componentName) {
+ var serviceConfig;
+ switch (componentName) {
+ case 'DATANODE':
+ serviceConfig = {
+ name: 'HDFS',
+ siteName: 'hdfs-site',
+ domain: 'datanode-global'
+ };
+ break;
+ case 'TASKTRACKER':
+ serviceConfig = {
+ name: 'MAPREDUCE',
+ siteName: 'mapred-site',
+ domain: 'tasktracker-global'
+ };
+ break;
+ case 'HBASE_REGIONSERVER':
+ serviceConfig = {
+ name: 'HBASE',
+ siteName: 'hbase-site',
+ domain: 'regionserver-global'
+ };
+ break;
+ default:
+ serviceConfig = null;
+ }
+ return serviceConfig;
+ },
+
/**
* Load all info about cluster to <code>clusterInfo</code> variable
*/
@@ -406,7 +449,7 @@ App.WizardStep8Controller = Em.Controller.extend({
loadDnValue: function (dnComponent) {
var dnHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'DataNode');
var totalDnHosts = dnHosts.hosts.length;
- var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName','DATANODE').groups.length;
+ var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName', 'DATANODE').groups.length;
var groupLabel;
if (totalGroups == 1) {
groupLabel = 'group';
@@ -444,7 +487,7 @@ App.WizardStep8Controller = Em.Controller.extend({
loadTtValue: function (ttComponent) {
var ttHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'TaskTracker');
var totalTtHosts = ttHosts.hosts.length;
- var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName','TASKTRACKER').groups.length;
+ var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName', 'TASKTRACKER').groups.length;
var groupLabel;
if (totalGroups == 1) {
groupLabel = 'group';
@@ -522,7 +565,7 @@ App.WizardStep8Controller = Em.Controller.extend({
loadRegionServerValue: function (rsComponent) {
var rsHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'RegionServer');
var totalRsHosts = rsHosts.hosts.length;
- var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName','HBASE_REGIONSERVER').groups.length;
+ var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName', 'HBASE_REGIONSERVER').groups.length;
var groupLabel;
if (totalGroups == 1) {
groupLabel = 'group';
@@ -667,33 +710,35 @@ App.WizardStep8Controller = Em.Controller.extend({
this.createComponents();
this.registerHostsToCluster();
this.createAllHostComponents();
+ this.applyCreatedConfToSlaveGroups();
+ this.ajaxQueueFinished = function(){
+ console.log('everything is loaded')
+ App.router.send('next');
+ };
+ this.doNextAjaxCall();
+ } else {
+ App.router.send('next');
}
-
- App.router.send('next');
},
setAmbariUIDb: function () {
+ var dbContent = this.get('content.slaveGroupProperties');
var slaveComponentConfig = this.get("slaveComponentConfig");
- this.persistKeyValues(slaveComponentConfig.version, slaveComponentConfig);
+ this.persistKeyValues(slaveComponentConfig.version, dbContent);
+ this.persistKeyValues('current_version',slaveComponentConfig.version);
},
persistKeyValues: function (key, value) {
var str = "{ '" + key + "' : '" + JSON.stringify(value) + "'}";
var obj = eval("(" + str + ")");
- $.ajax({
+
+ this.ajax({
type: "POST",
url: App.apiPrefix + '/persist',
data: JSON.stringify(obj),
- async: false,
- dataType: 'text',
- timeout: App.timeout,
- success: function (data) {
- console.debug('success...ajax call returned');
- },
-
- error: function (request, ajaxOptions, error) {
- console.log('Step8: Error message is: ' + request.responseText);
+ beforeSend: function () {
+ console.log('BeforeSend: persistKeyValues', obj);
}
});
},
@@ -712,61 +757,35 @@ App.WizardStep8Controller = Em.Controller.extend({
return false;
}
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName');
+ var clusterName = this.get('clusterName');
+ var url = App.apiPrefix + '/clusters/' + clusterName;
var stackVersion = (App.db.getSoftRepo().repoType == 'local') ? App.defaultLocalStackVersion : App.defaultStackVersion;
- $.ajax({
+ this.ajax({
type: 'POST',
url: url,
- async: false,
- //accepts: 'text',
- dataType: 'text',
data: JSON.stringify({ "Clusters": {"version": stackVersion }}),
- 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);
- },
-
- error: function (request, ajaxOptions, error) {
- console.log('Step8: In Error ');
- console.log('Step8: Error message is: ' + request.responseText);
- },
-
- statusCode: require('data/statusCodes')
+ beforeSend: function () {
+ console.log("BeforeSend: createCluster for " + clusterName);
+ }
});
- console.log("Exiting createCluster");
},
- createSelectedServices: function (service, httpMethod) {
+ createSelectedServices: function () {
var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services';
var data = this.createServiceData();
var httpMethod = 'POST';
- $.ajax({
+
+ this.ajax({
type: httpMethod,
url: url,
data: JSON.stringify(data),
- async: false,
- dataType: 'text',
- timeout: App.timeout,
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- 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);
-
- },
-
- error: function (request, ajaxOptions, error) {
- console.log('Step8: In Error ');
- console.log('Step8: Error message is: ' + request.responseText);
- },
-
- statusCode: require('data/statusCodes')
+ beforeSend: function () {
+ console.log('BeforeSend: createSelectedServices ', data);
+ }
});
},
@@ -795,26 +814,14 @@ App.WizardStep8Controller = Em.Controller.extend({
var data = {
"components": componentsData
}
- $.ajax({
+
+ this.ajax({
type: 'POST',
url: url,
- async: false,
- dataType: 'text',
data: JSON.stringify(data),
- timeout: App.timeout,
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- 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) {
- console.log('Step8: In Error ');
- console.log('Step8: Error message is: ' + request.responseText);
- },
-
- statusCode: require('data/statusCodes')
+ beforeSend: function () {
+ console.log('BeforeSend: createComponents for ' + _service, componentsData);
+ }
});
}, this);
@@ -829,27 +836,13 @@ App.WizardStep8Controller = Em.Controller.extend({
return;
}
- $.ajax({
+ this.ajax({
type: 'POST',
url: url,
data: JSON.stringify(data),
- async: false,
- dataType: 'text',
- timeout: App.timeout,
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- 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);
-
- },
-
- error: function (request, ajaxOptions, error) {
- console.log('Step8: In Error ');
- console.log('Step8: Error message is: ' + request.responseText);
- },
-
- statusCode: require('data/statusCodes')
+ beforeSend: function () {
+ console.log('BeforeSend: registerHostsToCluster', data);
+ }
});
},
@@ -933,7 +926,7 @@ App.WizardStep8Controller = Em.Controller.extend({
// return 'Hosts/host_name=' + hostName;
// }).join('|');
- var queryStrArr = []
+ var queryStrArr = [];
var queryStr = '';
hostNames.forEach(function (hostName) {
queryStr += 'Hosts/host_name=' + hostName + '|';
@@ -960,26 +953,13 @@ App.WizardStep8Controller = Em.Controller.extend({
]
};
- $.ajax({
+ this.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);
- },
-
- statusCode: require('data/statusCodes')
+ beforeSend: function () {
+ console.log('BeforeSend: registerHostsToComponent for ' + queryStr + ' and component ' + componentName);
+ }
});
}, this);
},
@@ -987,64 +967,56 @@ App.WizardStep8Controller = Em.Controller.extend({
createConfigurations: function () {
var selectedServices = this.get('selectedServices');
if (!this.get('content.isWizard')) {
- this.createConfigSite(this.createGlobalSiteObj());
- this.createConfigSite(this.createCoreSiteObj());
- this.createConfigSite(this.createHdfsSiteObj('HDFS'));
+ this.createConfigSiteForService(this.createGlobalSiteObj());
+ this.createGlobalSitePerSlaveGroup();
+ this.createConfigSiteForService(this.createCoreSiteObj());
+ this.createConfigSiteForService(this.createHdfsSiteObj());
+ this.createHdfsSitePerSlaveGroup('HDFS');
}
if (selectedServices.someProperty('serviceName', 'MAPREDUCE')) {
- this.createConfigSite(this.createMrSiteObj('MAPREDUCE'));
+ this.createConfigSiteForService(this.createMrSiteObj());
+ this.createMrSitePerSlaveGroup('MAPREDUCE');
}
if (selectedServices.someProperty('serviceName', 'HBASE')) {
- this.createConfigSite(this.createHbaseSiteObj('HBASE'));
+ this.createConfigSiteForService(this.createHbaseSiteObj());
+ this.createHbaseSitePerSlaveGroup('HBASE');
}
if (selectedServices.someProperty('serviceName', 'OOZIE')) {
- this.createConfigSite(this.createOozieSiteObj('OOZIE'));
+ this.createConfigSiteForService(this.createOozieSiteObj('OOZIE'));
}
if (selectedServices.someProperty('serviceName', 'HIVE')) {
- // TODO
- // this.createConfigSite(this.createHiveSiteObj('HIVE'));
+ this.createConfigSiteForService(this.createHiveSiteObj('HIVE'));
}
},
- createConfigSite: function (data) {
- console.log("Inside createConfigSite");
+ createConfigSiteForService: function (data) {
+ console.log("Inside createConfigSiteForService");
var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/configurations';
- $.ajax({
+
+ this.ajax({
type: 'POST',
url: url,
data: JSON.stringify(data),
- async: false,
- dataType: 'text',
- timeout: App.timeout,
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function for the createConfigSite");
- 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);
- console.log("TRACE: STep8 -> value of the url is: " + url);
- },
-
- statusCode: require('data/statusCodes')
+ beforeSend: function () {
+ console.log("BeforeSend: createConfigSiteForService for " + data.type);
+ }
});
- console.log("Exiting createConfigSite");
},
createGlobalSiteObj: function () {
var globalSiteProperties = {};
- this.get('globals').forEach(function (_globalSiteObj) {
+ this.get('globals').filterProperty('domain', 'global').forEach(function (_globalSiteObj) {
// do not pass any globals whose name ends with _host or _hosts