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/18 07:39:57 UTC
[ambari] branch trunk updated: AMBARI-24116 Web Client Pulls Back
Too Much Information in Upgrade Wizard
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 d9b7a28 AMBARI-24116 Web Client Pulls Back Too Much Information in Upgrade Wizard
d9b7a28 is described below
commit d9b7a28430cddc2f0388301a18843fb8f89f622b
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Fri Jun 15 17:52:16 2018 +0300
AMBARI-24116 Web Client Pulls Back Too Much Information in Upgrade Wizard
---
.../admin/stack_upgrade/stack_upgrade_wizard.hbs | 4 +--
.../main/admin/stack_upgrade/upgrade_task.hbs | 6 ++--
.../main/admin/stack_upgrade/upgrade_group_view.js | 1 -
.../main/admin/stack_upgrade/upgrade_task_view.js | 35 ++++++++++------------
.../admin/stack_upgrade/upgrade_task_view_test.js | 26 +++++++++-------
5 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
index 332594e..93bfa62 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
@@ -74,7 +74,7 @@
<div class="panel-body">
{{#if view.runningItem.isTasksLoaded}}
<div class="clear col-md-12">
- {{view App.upgradeTaskView contentBinding="view.taskDetails" outsideViewBinding="view.outsideView"}}
+ {{view App.upgradeTaskView contentBinding="view.taskDetails" outsideViewBinding="view"}}
</div>
{{else}}
{{view App.SpinnerView classNames="clear"}}
@@ -110,7 +110,7 @@
<div class="panel-body">
{{#if view.failedItem.isTasksLoaded}}
<div class="clear col-md-12">
- {{view App.upgradeTaskView contentBinding="view.taskDetails" outsideViewBinding="view.outsideView"}}
+ {{view App.upgradeTaskView contentBinding="view.taskDetails" outsideViewBinding="view"}}
</div>
{{else}}
{{view App.SpinnerView classNames="clear"}}
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
index 8c0fd42..bd8af95 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
@@ -19,13 +19,13 @@
{{#unless view.outsideView}}
<div {{bindAttr class="view.content.isActive::not-active-link"}}>
{{statusIcon view.content.status}}
- <a href="#" {{action toggleExpanded view.content target="view"}}>
+ <a href="#" {{action toggleExpanded target="view"}}>
{{view.content.command_detail}}
</a>
</div>
{{/unless}}
-{{#if view.showContent}}
- {{#if view.isContentLoaded}}
+{{#if view.isExpanded}}
+ {{#if view.content.isContentLoaded}}
<div class="task-details task-detail-info">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" {{bindAttr href="view.logTabIdLink"}}>{{t common.stdout}}</a></li>
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
index 071770d..09835cc 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
@@ -45,7 +45,6 @@ App.upgradeGroupView = Em.View.extend({
this.collapseLowerLevels(event.context);
event.context.set('isExpanded', !isExpanded);
if (!isExpanded && event.context.get('type') === 'ITEM') {
- event.context.set('isTasksLoaded', false);
this.doPolling(event.context);
}
},
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
index 0ea332d..8e9c19e 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
@@ -24,14 +24,14 @@ App.upgradeTaskView = Em.View.extend({
/**
* view observed directly
- * @type {boolean}
+ * @type {?Em.View}
*/
- outsideView: false,
+ outsideView: null,
/**
* @type {boolean}
*/
- showContent: Em.computed.or('outsideView', 'content.isExpanded'),
+ isExpanded: false,
/**
* @type {boolean}
@@ -74,37 +74,34 @@ App.upgradeTaskView = Em.View.extend({
*/
errorTabIdLInk: Em.computed.format('#{0}','errorTabId'),
- /**
- * @type {boolean}
- */
- isContentLoaded: false,
-
didInsertElement: function() {
if (this.get('outsideView') && this.get('content')) {
- this.toggleExpanded({context: this.get('content')});
+ this.set('isExpanded', true);
+ this.doPolling();
}
},
- toggleExpanded: function (event) {
- var isExpanded = event.context.get('isExpanded');
- event.context.toggleProperty('isExpanded', !isExpanded);
+ toggleExpanded: function () {
+ var isExpanded = this.get('isExpanded');
+ this.toggleProperty('isExpanded', !isExpanded);
if (!isExpanded) {
- this.doPolling(event.context);
+ this.doPolling();
} else {
- this.set('isContentLoaded', true);
+ this.set('content.isContentLoaded', true);
}
},
/**
*
- * @param task
*/
- doPolling: function (task) {
+ doPolling: function () {
var self = this;
+ var task = this.get('content');
+ var isExpanded = this.get('outsideView') ? this.get('outsideView.isDetailsOpened') : this.get('isExpanded');
- if (task && task.get('isExpanded')) {
+ if (task && isExpanded) {
this.get('controller').getUpgradeTask(task).complete(function () {
- self.set('isContentLoaded', true);
+ task.set('isContentLoaded', true);
if (!task.get('isCompleted')) {
self.set('timer', setTimeout(function () {
self.doPolling(task);
@@ -114,7 +111,7 @@ App.upgradeTaskView = Em.View.extend({
} else {
clearTimeout(this.get('timer'));
}
- },
+ }.observes('outsideView.isDetailsOpened'),
willDestroyElement: function () {
clearTimeout(this.get('timer'));
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_task_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_task_view_test.js
index d525031..221917d 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_task_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_task_view_test.js
@@ -33,8 +33,6 @@ describe('App.upgradeTaskView', function () {
view.removeObserver('content.isExpanded', view, 'doPolling');
view.removeObserver('outsideView', view, 'doPolling');
- App.TestAliases.testAsComputedOr(view, 'showContent', ['outsideView', 'content.isExpanded']);
-
describe("#logTabId", function() {
it("depends on `elementId`", function() {
view.reopen({
@@ -183,13 +181,9 @@ describe('App.upgradeTaskView', function () {
});
it('doPolling should be called', function() {
- var event = {
- context: Em.Object.create({
- isExpanded: false
- })
- };
- view.toggleExpanded(event);
- expect(event.context.get('isExpanded')).to.be.true;
+ view.set('isExpanded', false);
+ view.toggleExpanded();
+ expect(view.get('isExpanded')).to.be.true;
expect(view.doPolling.calledOnce).to.be.true;
});
});
@@ -197,9 +191,19 @@ describe('App.upgradeTaskView', function () {
describe('#doPolling', function() {
it('getUpgradeTask should be called', function() {
- view.doPolling(Em.Object.create({isExpanded: true}));
+ view.set('isExpanded', true);
+ view.doPolling();
expect(view.get('controller').getUpgradeTask.calledOnce).to.be.true;
- expect(view.get('isContentLoaded')).to.be.true;
+ expect(view.get('content.isContentLoaded')).to.be.true;
+ });
+
+ it('getUpgradeTask should be called when outside view', function() {
+ view.set('outsideView', Em.Object.create({
+ isDetailsOpened: true
+ }));
+ view.doPolling();
+ expect(view.get('controller').getUpgradeTask.called).to.be.true;
+ expect(view.get('content.isContentLoaded')).to.be.true;
});
});
--
To stop receiving notification emails like this one, please contact
atkach@apache.org.