You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/03/27 16:55:31 UTC
git commit: AMBARI-5242. Move wizard freezes on step "Configure
component",
operation "Install (component name)". (Denys Buzhor via akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 1eec850c7 -> 4be37e9b0
AMBARI-5242. Move wizard freezes on step "Configure component", operation "Install (component name)". (Denys Buzhor via akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4be37e9b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4be37e9b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4be37e9b
Branch: refs/heads/trunk
Commit: 4be37e9b0a0c3d002c6fd24298a48c8f9b5bbda9
Parents: 1eec850
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Mar 27 17:54:12 2014 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Mar 27 17:54:12 2014 +0200
----------------------------------------------------------------------
.../highAvailability/progress_controller.js | 42 ++++++++++++--------
ambari-web/app/models/cluster_states.js | 21 ++++++++--
2 files changed, 42 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4be37e9b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index a5c58e5..5875533 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -187,6 +187,28 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
onTaskStatusChange: function () {
console.warn('func: onTaskStatusChange1');
+ var statuses = this.get('tasks').mapProperty('status');
+ var logs = this.get('tasks').mapProperty('hosts');
+ var requestIds = this.get('currentRequestIds');
+ console.warn('func: onTaskStatusChange5',statuses, logs, requestIds);
+ // save task info
+ App.router.get(this.get('content.controllerName')).saveTasksStatuses(statuses);
+ App.router.get(this.get('content.controllerName')).saveRequestIds(requestIds);
+ App.router.get(this.get('content.controllerName')).saveLogs(logs);
+ // call saving of cluster status asynchronous
+ // synchronous executing cause problems in Firefox
+ App.clusterStatus.setClusterStatus({
+ clusterName: this.get('content.cluster.name'),
+ clusterState: this.get('clusterDeployState'),
+ wizardControllerName: this.get('content.controllerName'),
+ localdb: App.db.data
+ }, { async: true, success: 'statusChangeCallback', sender: this });
+ },
+ /**
+ * Method that called after saving persist data to server.
+ * Switch task according its status.
+ */
+ statusChangeCallback: function() {
if (!this.get('tasks').someProperty('status', 'IN_PROGRESS') && !this.get('tasks').someProperty('status', 'QUEUED') && !this.get('tasks').someProperty('status', 'FAILED')) {
var nextTask = this.get('tasks').findProperty('status', 'PENDING');
if (nextTask) {
@@ -210,24 +232,10 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
}
this.get('tasks').filterProperty('status','COMPLETED').setEach('showRetry', false);
this.get('tasks').filterProperty('status','COMPLETED').setEach('showRollback', false);
-
- var statuses = this.get('tasks').mapProperty('status');
- var logs = this.get('tasks').mapProperty('hosts');
- var requestIds = this.get('currentRequestIds');
- console.warn('func: onTaskStatusChange5',statuses, logs, requestIds);
- App.router.get(this.get('content.controllerName')).saveTasksStatuses(statuses);
- App.router.get(this.get('content.controllerName')).saveRequestIds(requestIds);
- App.router.get(this.get('content.controllerName')).saveLogs(logs);
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('content.cluster.name'),
- clusterState: this.get('clusterDeployState'),
- wizardControllerName: this.get('content.controllerName'),
- localdb: App.db.data
- });
},
- /*
- run command of appropriate task
+ /**
+ * Run command of appropriate task
*/
runTask: function (taskId) {
console.warn('func: runTask',taskId);
@@ -370,6 +378,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
console.warn('func: doPolling');
this.setTaskStatus(this.get('currentTaskId'), 'IN_PROGRESS');
var requestIds = this.get('currentRequestIds');
+ this.set('logs', []);
for (var i = 0; i < requestIds.length; i++) {
App.ajax.send({
name: 'admin.high_availability.polling',
@@ -415,7 +424,6 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
self.doPolling()
}, self.POLL_INTERVAL);
}
- this.set('logs', []);
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/4be37e9b/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index fae426e..e1ed468 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -124,9 +124,11 @@ App.clusterStatus = Ember.Object.create({
/**
* update cluster status and post it on server
* @param newValue
+ * @param opt - used for additional ajax request options, by default ajax used synchronous mode
+ *
* @return {*}
*/
- setClusterStatus: function(newValue){
+ setClusterStatus: function(newValue, opt){
if(App.testMode) return false;
var user = App.db.getUser();
var login = App.db.getLoginName();
@@ -146,6 +148,7 @@ App.clusterStatus = Ember.Object.create({
this.set('wizardControllerName', newValue.wizardControllerName);
val.wizardControllerName = newValue.wizardControllerName;
}
+
if (newValue.localdb) {
if (newValue.localdb.app && newValue.localdb.app.user)
delete newValue.localdb.app.user;
@@ -156,7 +159,7 @@ App.clusterStatus = Ember.Object.create({
} else {
delete App.db.data.app.user;
delete App.db.data.app.loginName;
- val.localdb = App.db.data;
+ val.localdb = App.db.data;
App.db.setUser(user);
App.db.setLoginName(login);
}
@@ -165,7 +168,7 @@ App.clusterStatus = Ember.Object.create({
keyValuePair[this.get('key')] = JSON.stringify(val);
- App.ajax.send({
+ var ajaxOptions = {
name: 'cluster.state',
sender: this,
data: {
@@ -173,7 +176,17 @@ App.clusterStatus = Ember.Object.create({
},
beforeSend: 'clusterStatusBeforeSend',
error: 'clusterStatusErrorCallBack'
- });
+ };
+
+ if (opt) {
+ ajaxOptions.async = !!opt.async;
+ ajaxOptions.sender = opt.sender || this;
+ ajaxOptions.success = opt.success;
+ ajaxOptions.beforeSend = opt.beforeSend;
+ ajaxOptions.error = opt.error;
+ }
+
+ App.ajax.send(ajaxOptions);
return newValue;
}
},