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:23:07 UTC
svn commit: r1419009 [1/4] - in
/incubator/ambari/branches/AMBARI-666/ambari-web/app: ./ assets/data/apps/
assets/data/wizard/bootstrap/ assets/img/ controllers/ controllers/global/
controllers/main/host/ controllers/main/service/ controllers/wizard/ d...
Author: yusaku
Date: Sun Dec 9 15:23:01 2012
New Revision: 1419009
URL: http://svn.apache.org/viewvc?rev=1419009&view=rev
Log:
AMBARI-1059. Refactor cluster management. (yusaku)
Added:
incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/img/spinner.gif (with props)
Modified:
incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/apps/runs.json
incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/application.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/slave_component_groups_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step10_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step7_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/config_mapping.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/config_properties.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/service_components.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/service_configs.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/models/hosts.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/application.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/login.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/background_operations_popup.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hive.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/oozie.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/zookeeper.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/configs.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step2.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step3.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step7.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/data_table.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/db.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/graph.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/modal_popup.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/login.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host/metrics/cpu.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/metrics/mapreduce/jvm_heap.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/metrics/mapreduce/jvm_threads.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/item.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step1_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step2_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step9_view.js
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/apps/runs.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/apps/runs.json?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/apps/runs.json (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/apps/runs.json Sun Dec 9 15:23:01 2012
@@ -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
}
]}
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json Sun Dec 9 15:23:01 2012
@@ -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"
+ }
+ ]
}
}
]
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/img/spinner.gif
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/img/spinner.gif?rev=1419009&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/img/spinner.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/application.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/application.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/application.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/application.js Sun Dec 9 15:23:01 2012
@@ -23,12 +23,12 @@ App.ApplicationController = Em.Controlle
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'),
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js Sun Dec 9 15:23:01 2012
@@ -28,6 +28,11 @@ App.BackgroundOperationsController = Em.
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.
}.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){
- return a.id - b.id;
- });
-
- var currentTasks = this.get('allOperations');
+ 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');
+ },
- runningTasks.forEach(function(item){
- var task = currentTasks.findProperty('id', item.id);
- if(task){
- currentTasks[currentTasks.indexOf(task)] = item;
- } else {
- currentTasks.pushObject(item);
+ statusCode: require('data/statusCodes')
+ });
}
+ }
+ ;
+ var currentTasks;
+ currentTasks = runningTasks.concat(executeTasks);
+ currentTasks = currentTasks.sort(function (a, b) {
+ return a.id - b.id;
});
- for(var i = currentTasks.length-1; i>=0; i--){
- var isTaskFinished = !runningTasks.someProperty('id', currentTasks[i].id);
- if(isTaskFinished){
- currentTasks.removeAt(i);
+ this.get('allOperations').filterProperty('isOpen').mapProperty('id').forEach(function(id){
+ if (currentTasks.someProperty('id', id)) {
+ currentTasks.findProperty('id', id).isOpen = true;
}
- }
+ });
- 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.
* Onclick handler for background operations number located right to logo
*/
showPopup: function(){
+ this.set('executeTasks', []);
this.loadOperations();
App.ModalPopup.show({
headerClass: Ember.View.extend({
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js Sun Dec 9 15:23:01 2012
@@ -38,38 +38,8 @@ App.InstallerController = App.WizardCont
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.WizardCont
//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.WizardCont
//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.WizardCont
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.WizardCont
_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.WizardCont
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.WizardCont
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.WizardCont
case '2':
this.loadInstallOptions();
case '1':
- this.loadClusterInfo();
+ this.load('cluster');
}
},
@@ -609,49 +587,20 @@ App.InstallerController = App.WizardCont
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);
}
-})
-;
+});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js Sun Dec 9 15:23:01 2012
@@ -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.exten
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();
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js Sun Dec 9 15:23:01 2012
@@ -54,24 +54,10 @@ App.AddHostController = App.WizardContro
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.WizardContro
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.WizardContro
hostsInfo.localRepoPath = '';
}
+ hostsInfo.bootRequestId = App.db.getBootRequestId() || null;
hostsInfo.sshKey = '';
hostsInfo.passphrase = '';
hostsInfo.confirmPassphrase = '';
@@ -180,7 +167,9 @@ App.AddHostController = App.WizardContro
//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.WizardContro
case '1':
this.loadInstallOptions();
case '0':
- this.loadClusterInfo();
+ this.load('cluster');
}
},
@@ -625,12 +614,12 @@ App.AddHostController = App.WizardContro
* 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();
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js Sun Dec 9 15:23:01 2012
@@ -54,21 +54,10 @@ App.AddServiceController = App.WizardCon
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.WizardCon
case '7':
case '6':
case '5':
- this.loadClusterInfo();
+ this.load('cluster');
case '4':
this.loadServiceConfigProperties();
case '3':
@@ -539,12 +528,12 @@ App.AddServiceController = App.WizardCon
* 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);
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard.js Sun Dec 9 15:23:01 2012
@@ -220,15 +220,29 @@ App.WizardController = Em.Controller.ext
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.ext
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.ext
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.ext
},
+ /*
+ 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: []
}
})
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/slave_component_groups_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/slave_component_groups_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/slave_component_groups_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/slave_component_groups_controller.js Sun Dec 9 15:23:01 2012
@@ -47,10 +47,14 @@ App.SlaveComponentGroupsController = Em.
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.
}, 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.
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);
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step10_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step10_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step10_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step10_controller.js Sun Dec 9 15:23:01 2012
@@ -115,11 +115,11 @@ App.WizardStep10Controller = Em.Controll
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);
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js Sun Dec 9 15:23:01 2012
@@ -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.Controlle
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');
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js Sun Dec 9 15:23:01 2012
@@ -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.Controlle
hostInfo[hostNameArr[i]] = {
name: hostNameArr[i],
installType: this.get('installType'),
- bootStatus: 'pending'
+ bootStatus: 'PENDING'
};
}
@@ -117,6 +118,45 @@ App.WizardStep2Controller = Em.Controlle
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.Controlle
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'),
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js Sun Dec 9 15:23:01 2012
@@ -23,10 +23,47 @@ App.WizardStep3Controller = Em.Controlle
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.Controlle
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.Controlle
}
} 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.Controlle
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.Controlle
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.Controlle
/* 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.Controlle
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.Controlle
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.Controlle
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.Controlle
},
- 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.Controlle
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.Controlle
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);
}
});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js Sun Dec 9 15:23:01 2012
@@ -64,6 +64,7 @@ App.WizardStep5Controller = Em.Controlle
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
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step7_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step7_controller.js?rev=1419009&r1=1419008&r2=1419009&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step7_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step7_controller.js Sun Dec 9 15:23:01 2012
@@ -52,7 +52,7 @@ App.WizardStep7Controller = Em.Controlle
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.Controlle
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.Controlle
_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.Controlle
}
}
}, 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() {
- }
},