You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2018/06/04 14:23:17 UTC
[ambari] branch trunk updated: AMBARI-24019 Upgrade Task details is
not loading in Upgrade History Details Window.
This is an automated email from the ASF dual-hosted git repository.
atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new a9800b0 AMBARI-24019 Upgrade Task details is not loading in Upgrade History Details Window.
a9800b0 is described below
commit a9800b0e0d0abd393a05ce7c37d1a3d66bbdff0e
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Mon Jun 4 14:33:29 2018 +0300
AMBARI-24019 Upgrade Task details is not loading in Upgrade History Details Window.
---
.../main/admin/stack_upgrade_history_controller.js | 35 +++++++++++++-
.../admin/stack_upgrade_history_controller_test.js | 53 ++++++++++++++++++++++
2 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js b/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
index 4c9abfe..d52c9fa 100644
--- a/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
@@ -182,13 +182,18 @@ App.MainAdminStackUpgradeHistoryController = Em.ArrayController.extend({
data.tasks.forEach(function (task) {
var currentTask = item.get('tasks').findProperty('id', task.Tasks.id);
this.get('taskDetailsProperties').forEach(function (property) {
- currentTask.set(property, task.Tasks[property]);
+ if (!Em.isNone(task.Tasks[property])) {
+ currentTask.set(property, task.Tasks[property]);
+ }
}, this);
}, this);
} else {
var tasks = [];
data.tasks.forEach(function (task) {
- tasks.pushObject(App.finishedUpgradeEntity.create({type: 'TASK'}, task.Tasks));
+ tasks.pushObject(App.finishedUpgradeEntity.create({
+ type: 'TASK',
+ group_id: data.UpgradeItem.group_id
+ }, task.Tasks));
});
item.set('tasks', tasks);
}
@@ -200,6 +205,32 @@ App.MainAdminStackUpgradeHistoryController = Em.ArrayController.extend({
},
/**
+ * request Upgrade Task
+ * @param {Em.Object} task
+ * @return {$.ajax}
+ */
+ getUpgradeTask: function (task) {
+ return App.ajax.send({
+ name: 'admin.upgrade.upgrade_task',
+ sender: this,
+ data: {
+ upgradeId: task.get('request_id'),
+ groupId: task.get('group_id'),
+ stageId: task.get('stage_id'),
+ taskId: task.get('id'),
+ task: task
+ },
+ success: 'getUpgradeTaskSuccessCallback'
+ });
+ },
+
+ getUpgradeTaskSuccessCallback: function (data, xhr, params) {
+ this.get('taskDetailsProperties').forEach(function (property) {
+ params.task.set(property, data.Tasks[property]);
+ }, this);
+ },
+
+ /**
* status of Upgrade request
* @type {string}
*/
diff --git a/ambari-web/test/controllers/main/admin/stack_upgrade_history_controller_test.js b/ambari-web/test/controllers/main/admin/stack_upgrade_history_controller_test.js
index 6bd817b..d2fa2ad 100644
--- a/ambari-web/test/controllers/main/admin/stack_upgrade_history_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_upgrade_history_controller_test.js
@@ -122,4 +122,57 @@ describe('App.MainAdminStackUpgradeHistoryController', function() {
});
});
});
+
+ describe("#getUpgradeTask()", function() {
+
+ it("default callback", function() {
+ var task = Em.Object.create({
+ request_id: 1,
+ group_id: 2,
+ stage_id: 3,
+ id: 4
+ });
+ controller.getUpgradeTask(task);
+ var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.upgrade_task');
+ expect(args[0]).to.exists;
+ expect(args[0].sender).to.be.eql(controller);
+ expect(args[0].success).to.be.equal('getUpgradeTaskSuccessCallback');
+ expect(args[0].data).to.be.eql({
+ upgradeId: 1,
+ groupId: 2,
+ stageId: 3,
+ taskId: 4,
+ task: task
+ });
+ });
+ });
+
+ describe('#getUpgradeTaskSuccessCallback', function() {
+
+ it('should update volatile properties', function() {
+ var data = {
+ Tasks: {
+ status: 'IN_PROGRESS',
+ id: 1,
+ stderr: 'Error',
+ error_log: '',
+ host_name: 'host1',
+ output_log: '',
+ stdout: ''
+ }
+ };
+ var params = {
+ task: Em.Object.create()
+ };
+ controller.getUpgradeTaskSuccessCallback(data, {}, params);
+ expect(params.task).to.be.eql(Em.Object.create({
+ status: 'IN_PROGRESS',
+ stderr: 'Error',
+ error_log: '',
+ host_name: 'host1',
+ output_log: '',
+ stdout: ''
+ }))
+ });
+ });
});
--
To stop receiving notification emails like this one, please contact
atkach@apache.org.