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 2016/06/02 15:00:59 UTC
ambari git commit: AMBARI-17003 Background Ops Dialog Spinner,
JS error. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 09c3ad4ef -> e8fa1c283
AMBARI-17003 Background Ops Dialog Spinner, JS error. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e8fa1c28
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e8fa1c28
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e8fa1c28
Branch: refs/heads/trunk
Commit: e8fa1c28322d49060d792ed8a84894fa60f7c99b
Parents: 09c3ad4
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Jun 2 14:26:51 2016 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Jun 2 18:00:25 2016 +0300
----------------------------------------------------------------------
ambari-web/app/utils/host_progress_popup.js | 10 ++--
.../common/host_progress_popup_body_view.js | 1 +
.../host_progress_popup_body_view_test.js | 56 +++++++++++++++++++-
3 files changed, 61 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8fa1c28/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 8fe928f..20ea220 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -91,9 +91,9 @@ App.HostPopup = Em.Object.create({
servicesInfo: [],
/**
- * @type {?wrappedHost[]}
+ * @type {wrappedHost[]}
*/
- hosts: null,
+ hosts: [],
/**
* @type {?object[]}
@@ -697,8 +697,10 @@ App.HostPopup = Em.Object.create({
existedHosts.forEach(function (host) {
var newHostInfo = hostsMap[host.get('name')];
//update only hosts with changed tasks or currently opened tasks of host
- var hostShouldBeUpdated = !this.get('isBackgroundOperations') || newHostInfo.isModified || this.get('currentHostName') === host.get('name');
- if (newHostInfo && hostShouldBeUpdated) {
+ if (newHostInfo &&
+ (!this.get('isBackgroundOperations') ||
+ newHostInfo.isModified ||
+ this.get('currentHostName') === host.get('name'))) {
var hostStatus = self.getStatus(newHostInfo.logTasks);
var hostProgress = self.getProgress(newHostInfo.logTasks);
host.setProperties({
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8fa1c28/ambari-web/app/views/common/host_progress_popup_body_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/host_progress_popup_body_view.js b/ambari-web/app/views/common/host_progress_popup_body_view.js
index 19fabd0..b9181e2 100644
--- a/ambari-web/app/views/common/host_progress_popup_body_view.js
+++ b/ambari-web/app/views/common/host_progress_popup_body_view.js
@@ -373,6 +373,7 @@ App.HostProgressPopupBodyView = App.TableView.extend({
isServiceListHidden: false
});
this.get("controller").setBackgroundOperationHeader(false);
+ this.get('controller.hosts').clear();
this.setOnStart();
this.rerender();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8fa1c28/ambari-web/test/views/common/host_progress_popup_body_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/host_progress_popup_body_view_test.js b/ambari-web/test/views/common/host_progress_popup_body_view_test.js
index 16c7b4d..534269b 100644
--- a/ambari-web/test/views/common/host_progress_popup_body_view_test.js
+++ b/ambari-web/test/views/common/host_progress_popup_body_view_test.js
@@ -24,8 +24,11 @@ describe('App.HostProgressPopupBodyView', function () {
beforeEach(function () {
view = App.HostProgressPopupBodyView.create({
controller: Em.Object.create({
- dataSourceController: Em.Object.create({})
- })
+ dataSourceController: Em.Object.create({}),
+ setBackgroundOperationHeader: Em.K,
+ hosts: []
+ }),
+ parentView: Em.Object.create()
});
});
@@ -251,4 +254,53 @@ describe('App.HostProgressPopupBodyView', function () {
});
});
});
+
+ describe("#resetState()", function () {
+
+ beforeEach(function() {
+ sinon.stub(view.get('controller'), 'setBackgroundOperationHeader');
+ sinon.stub(view, 'setOnStart');
+ sinon.stub(view, 'rerender');
+ sinon.stub(view, 'updateSelectView');
+ });
+
+ afterEach(function() {
+ view.get('controller').setBackgroundOperationHeader.restore();
+ view.setOnStart.restore();
+ view.rerender.restore();
+ view.updateSelectView.restore();
+ });
+
+ it("should set properties of parentView", function() {
+ view.set('parentView.isOpen', true);
+ expect(JSON.stringify(view.get('parentView'))).to.be.equal(JSON.stringify({
+ "isOpen": true,
+ "isLogWrapHidden": true,
+ "isTaskListHidden": true,
+ "isHostListHidden": true,
+ "isServiceListHidden": false
+ }));
+ });
+
+ it("setBackgroundOperationHeader should be called", function() {
+ view.set('parentView.isOpen', true);
+ expect(view.get('controller').setBackgroundOperationHeader.calledWith(false)).to.be.true;
+ });
+
+ it("controller.hosts should be empty", function() {
+ view.set('controller.hosts', [{}]);
+ view.set('parentView.isOpen', true);
+ expect(view.get('controller.hosts')).to.be.empty;
+ });
+
+ it("setOnStart should be called", function() {
+ view.set('parentView.isOpen', true);
+ expect(view.setOnStart.calledOnce).to.be.true;
+ });
+
+ it("rerender should be called", function() {
+ view.set('parentView.isOpen', true);
+ expect(view.rerender.calledOnce).to.be.true;
+ });
+ });
});