You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2016/05/26 17:09:04 UTC
[1/2] ambari git commit: AMBARI-16904. 'Reload Page' popup is still
shown when connection is established (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 4e8cfd490 -> 55b265407
AMBARI-16904. 'Reload Page' popup is still shown when connection is established (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/55b26540
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/55b26540
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/55b26540
Branch: refs/heads/branch-2.4
Commit: 55b2654072c1449280191c18e743a8621fd83a6d
Parents: 08a7ea8
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu May 26 20:03:01 2016 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu May 26 20:08:56 2016 +0300
----------------------------------------------------------------------
.../app/controllers/wizard/step3_controller.js | 14 +-
.../app/controllers/wizard/step9_controller.js | 7 +-
ambari-web/app/mixins/common/reload_popup.js | 23 +--
ambari-web/app/utils/polling.js | 3 +-
.../test/controllers/wizard/step3_test.js | 38 ++++
.../test/mixins/common/reload_popup_test.js | 174 ++++++++++---------
ambari-web/test/utils/polling_test.js | 6 +-
7 files changed, 160 insertions(+), 105 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 8e8eb11..f4a7d18 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -534,6 +534,16 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
}.observes('isBackDisabled'),
/**
+ * Close reload popup on exit from Confirm Hosts step
+ * @method closeReloadPopupOnExit
+ */
+ closeReloadPopupOnExit: function () {
+ if (this.get('stopBootstrap')) {
+ this.closeReloadPopup();
+ }
+ }.observes('stopBootstrap'),
+
+ /**
* Do bootstrap calls
* @method doBootstrap
* @return {$.ajax|null}
@@ -550,8 +560,8 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
data: {
bootRequestId: this.get('content.installOptions.bootRequestId'),
numPolls: this.get('numPolls'),
- errorLogMessage: 'Bootstrap failed',
callback: this.doBootstrap,
+ timeout: 3000,
shouldUseDefaultHandler: true
},
success: 'doBootstrapSuccessCallback',
@@ -640,8 +650,8 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
success: 'isHostsRegisteredSuccessCallback',
error: 'reloadErrorCallback',
data: {
- errorLogMessage: 'Error: Getting registered host information from the server',
callback: this.isHostsRegistered,
+ timeout: 3000,
shouldUseDefaultHandler: true
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index 412589e..916f9dc 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -1053,8 +1053,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
numPolls: this.get('numPolls'),
callback: this.getLogsByRequest,
args: [polling, requestId],
- timeout: 3000,
- errorLogMessage: 'Install services all retries failed'
+ timeout: 3000
},
success: 'reloadSuccessCallback',
error: 'reloadErrorCallback'
@@ -1085,9 +1084,11 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
* @method reloadErrorCallback
*/
reloadErrorCallback: function (jqXHR, ajaxOptions, error, opt, params) {
- this._super(jqXHR, ajaxOptions, error, opt, params);
if (jqXHR.status) {
+ this.closeReloadPopup();
this.loadLogData(true);
+ } else {
+ this._super(jqXHR, ajaxOptions, error, opt, params);
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/app/mixins/common/reload_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/reload_popup.js b/ambari-web/app/mixins/common/reload_popup.js
index c4b37d7..bc37f9f 100644
--- a/ambari-web/app/mixins/common/reload_popup.js
+++ b/ambari-web/app/mixins/common/reload_popup.js
@@ -20,8 +20,6 @@ var App = require('app');
App.ReloadPopupMixin = Em.Mixin.create({
- retryCount: 0,
-
reloadPopup: null,
reloadSuccessCallback: function () {
@@ -35,17 +33,13 @@ App.ReloadPopupMixin = Em.Mixin.create({
App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
}
} else {
- var times = Em.isNone(params.times) ? App.get('maxRetries') : params.times,
- timeout = Em.isNone(params.timeout) ? App.get('timeout') : params.timeout;
+ var timeout = Em.isNone(params.timeout) ? App.get('timeout') : params.timeout;
this.showReloadPopup(params.reloadPopupText);
- if (this.get('retryCount') < times) {
- if (params.callback) {
- var self = this;
- window.setTimeout(function () {
- params.callback.apply(self, params.args || []);
- }, timeout);
- }
- this.incrementProperty('retryCount');
+ if (params.callback) {
+ var self = this;
+ window.setTimeout(function () {
+ params.callback.apply(self, params.args || []);
+ }, timeout);
}
}
},
@@ -70,10 +64,7 @@ App.ReloadPopupMixin = Em.Mixin.create({
+ this.t('app.reloadPopup.link') + "</a></div>")
}),
onClose: function () {
- self.setProperties({
- reloadPopup: null,
- retryCount: 0
- });
+ self.set('reloadPopup', null);
this._super();
}
}));
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/app/utils/polling.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/polling.js b/ambari-web/app/utils/polling.js
index 7337fbb..6bb00e8 100644
--- a/ambari-web/app/utils/polling.js
+++ b/ambari-web/app/utils/polling.js
@@ -147,8 +147,7 @@ App.Poll = Em.Object.extend(App.ReloadPopupMixin, {
sender: this,
data: {
requestId: this.get('requestId'),
- callback: this.startPolling,
- errorLogMessage: 'Install services all retries failed'
+ callback: this.startPolling
},
success: 'reloadSuccessCallback',
error: 'reloadErrorCallback'
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 6cb7ee7..a214656 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -3149,4 +3149,42 @@ describe('App.WizardStep3Controller', function () {
});
+ describe('#closeReloadPopupOnExit', function () {
+
+ var cases = [
+ {
+ stopBootstrap: true,
+ closeReloadPopupCallCount: 1,
+ title: 'bootstrap should be stopped'
+ },
+ {
+ stopBootstrap: false,
+ closeReloadPopupCallCount: 0,
+ title: 'bootstrap should not be stopped'
+ }
+ ];
+
+ beforeEach(function () {
+ sinon.stub(c, 'closeReloadPopup', Em.K);
+ });
+
+ afterEach(function () {
+ c.closeReloadPopup.restore();
+ });
+
+ cases.forEach(function (item) {
+
+ it(item.title, function () {
+ if (c.get('stopBootstrap') === item.stopBootstrap) {
+ c.propertyDidChange('stopBootstrap');
+ } else {
+ c.set('stopBootstrap', item.stopBootstrap);
+ }
+ expect(c.closeReloadPopup.callCount).to.equal(item.closeReloadPopupCallCount);
+ });
+
+ });
+
+ });
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/test/mixins/common/reload_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/reload_popup_test.js b/ambari-web/test/mixins/common/reload_popup_test.js
index 6df35a2..619255a 100644
--- a/ambari-web/test/mixins/common/reload_popup_test.js
+++ b/ambari-web/test/mixins/common/reload_popup_test.js
@@ -52,11 +52,9 @@ describe('App.ReloadPopupMixin', function () {
describe('#closeReloadPopup', function () {
it('should hide modal popup', function () {
- obj.set('retryCount', 1);
obj.showReloadPopup();
obj.closeReloadPopup();
expect(obj.get('reloadPopup')).to.be.null;
- expect(obj.get('retryCount')).to.equal(0);
});
});
@@ -64,110 +62,130 @@ describe('App.ReloadPopupMixin', function () {
describe('#reloadSuccessCallback', function () {
it('should hide modal popup', function () {
- obj.set('retryCount', 1);
obj.showReloadPopup();
obj.reloadSuccessCallback();
expect(obj.get('reloadPopup')).to.be.null;
- expect(obj.get('retryCount')).to.equal(0);
});
});
describe('#reloadErrorCallback', function () {
- var cases = [
- {
- args: [{status: 404}, null, null, {}, {shouldUseDefaultHandler: true}],
- closeReloadPopupCallCount: 1,
- consoleLogCallCount: 0,
- defaultErrorHandlerCallCount: 1,
- showReloadPopupCallCount: 0,
- setTimeoutCount: 0,
- title: 'status received, no console message, default error handler'
- },
- {
- args: [{status: 404}, null, null, {}, {errorLogMessage: 'error'}],
- closeReloadPopupCallCount: 1,
- consoleLogCallCount: 1,
- defaultErrorHandlerCallCount: 0,
- showReloadPopupCallCount: 0,
- setTimeoutCount: 0,
- title: 'status received, console message displayed, no default error handler'
- },
- {
- args: [{status: 0}, null, null, {}, {times: 5}],
- retryCount: 5,
- retryCountResult: 5,
- closeReloadPopupCallCount: 0,
- consoleLogCallCount: 0,
- defaultErrorHandlerCallCount: 0,
- showReloadPopupCallCount: 1,
- setTimeoutCount: 0,
- title: 'no status received, custom retries count, max retries reached'
- },
- {
- args: [{status: 0}, null, null, {}, {}],
- retryCount: 2,
- retryCountResult: 3,
- closeReloadPopupCallCount: 0,
- consoleLogCallCount: 0,
- defaultErrorHandlerCallCount: 0,
- showReloadPopupCallCount: 1,
- setTimeoutCount: 0,
- title: 'no status received, default retries count, max retries not reached, no callback'
- },
- {
- args: [{status: 0}, null, null, {}, {callback: Em.K}],
- retryCount: 2,
- retryCountResult: 3,
- closeReloadPopupCallCount: 0,
- consoleLogCallCount: 0,
- defaultErrorHandlerCallCount: 0,
- showReloadPopupCallCount: 1,
- setTimeoutCount: 1,
- title: 'no status received, default retries count, max retries not reached, callback specified'
- }
- ];
-
- beforeEach(function () {
- sinon.stub(obj, 'closeReloadPopup', Em.K);
- sinon.stub(App.ajax, 'defaultErrorHandler', Em.K);
- sinon.stub(obj, 'showReloadPopup', Em.K);
- sinon.stub(App, 'get').withArgs('maxRetries').returns(3);
- });
-
- afterEach(function () {
- obj.closeReloadPopup.restore();
- App.ajax.defaultErrorHandler.restore();
- obj.showReloadPopup.restore();
- App.get.restore();
- });
+ var clock,
+ cases = [
+ {
+ args: [{status: 404}, null, null, {}, {shouldUseDefaultHandler: true}],
+ closeReloadPopupCallCount: 1,
+ defaultErrorHandlerCallCount: 1,
+ showReloadPopupCallCount: 0,
+ isCallbackCalled: false,
+ title: 'status received, default error handler'
+ },
+ {
+ args: [{status: 404}, null, null, {}, {}],
+ closeReloadPopupCallCount: 1,
+ defaultErrorHandlerCallCount: 0,
+ showReloadPopupCallCount: 0,
+ isCallbackCalled: false,
+ title: 'status received, no default error handler'
+ },
+ {
+ args: [{status: 0}, null, null, {}, {}],
+ closeReloadPopupCallCount: 0,
+ defaultErrorHandlerCallCount: 0,
+ showReloadPopupCallCount: 1,
+ isCallbackCalled: false,
+ title: 'no status received, no callback'
+ },
+ {
+ args: [{status: 0}, null, null, {}, {callback: Em.K, timeout: 2000}],
+ timeout: 1999,
+ closeReloadPopupCallCount: 0,
+ defaultErrorHandlerCallCount: 0,
+ showReloadPopupCallCount: 1,
+ isCallbackCalled: false,
+ title: 'no status received, callback specified, custom timeout, not enough time passed'
+ },
+ {
+ args: [{status: 0}, null, null, {}, {callback: Em.K}],
+ timeout: 999,
+ closeReloadPopupCallCount: 0,
+ defaultErrorHandlerCallCount: 0,
+ showReloadPopupCallCount: 1,
+ isCallbackCalled: false,
+ title: 'no status received, callback specified, default timeout, not enough time passed'
+ },
+ {
+ args: [{status: 0}, null, null, {}, {callback: Em.K, args: [{}], timeout: 2000}],
+ timeout: 2000,
+ closeReloadPopupCallCount: 0,
+ defaultErrorHandlerCallCount: 0,
+ showReloadPopupCallCount: 1,
+ isCallbackCalled: true,
+ callbackArgs: [{}],
+ title: 'no status received, callback with arguments specified, custom timeout, enough time passed'
+ },
+ {
+ args: [{status: 0}, null, null, {}, {callback: Em.K}],
+ timeout: 1000,
+ closeReloadPopupCallCount: 0,
+ defaultErrorHandlerCallCount: 0,
+ showReloadPopupCallCount: 1,
+ isCallbackCalled: true,
+ callbackArgs: [],
+ title: 'no status received, callback with no arguments specified, default timeout, enough time passed'
+ }
+ ];
cases.forEach(function (item) {
describe(item.title, function () {
beforeEach(function () {
- if (!Em.isNone(item.retryCount)) {
- obj.set('retryCount', item.retryCount);
+ sinon.stub(obj, 'closeReloadPopup', Em.K);
+ sinon.stub(App.ajax, 'defaultErrorHandler', Em.K);
+ sinon.stub(obj, 'showReloadPopup', Em.K);
+ sinon.stub(App, 'get').withArgs('timeout').returns(1000);
+ if (item.args[4].callback) {
+ sinon.spy(item.args[4], 'callback');
}
+ clock = sinon.useFakeTimers();
obj.reloadErrorCallback.apply(obj, item.args);
+ clock.tick(item.timeout);
});
afterEach(function () {
- if (!Em.isNone(item.retryCountResult)) {
- obj.set('retryCount', item.retryCountResult);
+ obj.closeReloadPopup.restore();
+ App.ajax.defaultErrorHandler.restore();
+ obj.showReloadPopup.restore();
+ App.get.restore();
+ if (item.args[4].callback) {
+ item.args[4].callback.restore();
}
+ clock.restore();
});
- it('closeReloadPopup is called needed number of times', function () {
+ it('closeReloadPopup call', function () {
expect(obj.closeReloadPopup.callCount).to.equal(item.closeReloadPopupCallCount);
});
- it('defaultErrorHandler is called needed number of times', function () {
+ it('defaultErrorHandler call', function () {
expect(App.ajax.defaultErrorHandler.callCount).to.equal(item.defaultErrorHandlerCallCount);
});
- it('showReloadPopup is called needed number of times', function () {
+ it('showReloadPopup call', function () {
expect(obj.showReloadPopup.callCount).to.equal(item.showReloadPopupCallCount);
});
+
+ if (item.isCallbackCalled) {
+ it('callback call', function () {
+ expect(item.args[4].callback.calledOnce).to.be.true;
+ });
+ it('callback context', function () {
+ expect(item.args[4].callback.calledOn(obj)).to.be.true;
+ });
+ it('callback arguments', function () {
+ expect(item.args[4].callback.firstCall.args).to.eql(item.callbackArgs);
+ });
+ }
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/55b26540/ambari-web/test/utils/polling_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/polling_test.js b/ambari-web/test/utils/polling_test.js
index 2682890..2e5f105 100644
--- a/ambari-web/test/utils/polling_test.js
+++ b/ambari-web/test/utils/polling_test.js
@@ -515,8 +515,7 @@ describe('App.Poll', function () {
ajaxCallArguments: [{
name: 'background_operations.get_by_request',
data: {
- requestId: 0,
- errorLogMessage: 'Install services all retries failed'
+ requestId: 0
},
success: 'reloadSuccessCallback',
error: 'reloadErrorCallback'
@@ -530,8 +529,7 @@ describe('App.Poll', function () {
ajaxCallArguments: [{
name: 'background_operations.get_by_request',
data: {
- requestId: 1,
- errorLogMessage: 'Install services all retries failed'
+ requestId: 1
},
success: 'reloadSuccessCallback',
error: 'reloadErrorCallback'
[2/2] ambari git commit: AMBARI-16903. View Config: Wrong replace of
cluster name string in inherit section (alexantonenko)
Posted by al...@apache.org.
AMBARI-16903. View Config: Wrong replace of cluster name string in inherit section (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/08a7ea84
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/08a7ea84
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/08a7ea84
Branch: refs/heads/branch-2.4
Commit: 08a7ea846e2e092a05e5c28ae88a8d70493a1ca1
Parents: 4e8cfd4
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu May 26 19:56:51 2016 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu May 26 20:08:56 2016 +0300
----------------------------------------------------------------------
.../main/resources/ui/admin-web/app/views/ambariViews/edit.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/08a7ea84/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index 7a4ca0b..f6facb5 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -279,7 +279,7 @@
</div>
<div ng-show="!isPermissionsEmpty && (data.clusterType == 'LOCAL_AMBARI') && editConfigurationDisabled">
<div class="col-sm-12">
- <span translate="views.clusterPermissions.infoMessage" translate-values="{cluster: cluster}"></span>
+ <span translate="views.clusterPermissions.infoMessage" translate-values="{cluster: cluster.name}"></span>
</div>
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox col-sm-12" ng-repeat="key in clusterInheritedPermissionKeys">