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 2015/06/10 17:35:40 UTC
ambari git commit: AMBARI-11834. Add Service Wizard: disable Deploy
button after click (after Kerberos enabling) (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk cbd1d9480 -> cd2e39790
AMBARI-11834. Add Service Wizard: disable Deploy button after click (after Kerberos enabling) (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cd2e3979
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cd2e3979
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cd2e3979
Branch: refs/heads/trunk
Commit: cd2e39790c0c68060f9e54df548807b0be71c778
Parents: cbd1d94
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Jun 10 16:22:36 2015 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Jun 10 18:32:57 2015 +0300
----------------------------------------------------------------------
.../app/controllers/main/admin/kerberos.js | 6 +-
.../main/admin/kerberos/step3_controller.js | 11 +--
.../app/controllers/wizard/step8_controller.js | 86 +++++++++++++++---
ambari-web/app/mixins.js | 1 -
.../mixins/wizard/wizardDeployProgressView.js | 96 --------------------
.../wizard/wizardProgressPageController.js | 13 ++-
ambari-web/app/utils/ajax/ajax.js | 22 ++---
ambari-web/app/views/wizard/step8_view.js | 10 +-
.../test/controllers/wizard/step8_test.js | 18 ++--
ambari-web/test/views/wizard/step8_view_test.js | 67 --------------
10 files changed, 108 insertions(+), 222 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index ecd79a6..2bc7cfd 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -210,7 +210,6 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
* @param data {object}
* @param opt {object}
* @param params {object}
- * @returns {App.ModalPopup|undefined}
*/
runSecurityCheckSuccess: function (data, opt, params) {
//TODO correct check
@@ -366,7 +365,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
return configProperties;
},
- getKDCSessionState: function(callback) {
+ getKDCSessionState: function(callback, kdcCancelHandler) {
if (this.get('securityEnabled')) {
App.ajax.send({
name: 'kerberos.session.state',
@@ -374,7 +373,8 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
data: {
callback: callback
},
- success: 'checkState'
+ success: 'checkState',
+ kdcCancelHandler: kdcCancelHandler
})
} else {
callback();
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js
index 8946481..b51f8ec 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js
@@ -52,11 +52,6 @@ App.KerberosWizardStep3Controller = App.KerberosProgressPageController.extend({
});
},
- onKDCCancel: function() {
- App.router.get(this.get('content.controllerName')).setStepsEnable();
- this.get('tasks').objectAt(this.get('currentTaskId')).set('status', 'FAILED');
- },
-
getKerberosClientState: function() {
return App.ajax.send({
name: 'common.service_component.info',
@@ -70,12 +65,16 @@ App.KerberosWizardStep3Controller = App.KerberosProgressPageController.extend({
},
testKerberos: function() {
+ var self = this;
App.ajax.send({
'name': 'service.item.smoke',
'sender': this,
'success': 'startPolling',
'error': 'onTestKerberosError',
- 'kdcCancelHandler': 'onKDCCancel',
+ 'kdcCancelHandler': function() {
+ App.router.get(self.get('content.controllerName')).setStepsEnable();
+ self.get('tasks').objectAt(self.get('currentTaskId')).set('status', 'FAILED');
+ },
'data': {
'serviceName': this.serviceName,
'displayName': App.format.role(this.serviceName),
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 6aef9bc..b44f900 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -102,13 +102,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
isBackBtnDisabled: false,
/**
- * This flag when turned to true launches deploy progress bar
- */
- isDeployStarted: function() {
- this.get('isSubmitDisabled');
- }.property('isSubmitDisabled'),
-
- /**
* Is error appears while <code>ajaxQueue</code> executes
* @type {bool}
*/
@@ -733,14 +726,28 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
* @return {void}
*/
submit: function () {
+ var self = this;
+ var wizardController;
if (!this.get('isSubmitDisabled')) {
+ wizardController = App.router.get(this.get('content.controllerName'));
+ this.set('isSubmitDisabled', true);
+ this.set('isBackBtnDisabled', true);
+ wizardController.setLowerStepsDisable(wizardController.get('currentStep'));
if (this.get('content.controllerName') != 'installerController' && this.get('securityEnabled') && !this.get('isManualKerberos')) {
- App.get('router.mainAdminKerberosController').getKDCSessionState(this.submitProceed.bind(this));
+ App.get('router.mainAdminKerberosController').getKDCSessionState(this.submitProceed.bind(this), function () {
+ self.set('isSubmitDisabled', false);
+ self.set('isBackBtnDisabled', false);
+ wizardController.setStepsEnable();
+ if (self.get('content.controllerName') === 'addServiceController') {
+ wizardController.setSkipSlavesStep(wizardController.getDBProperty('selectedServiceNames'), 3);
+ }
+ });
} else {
this.submitProceed();
}
}
},
+
/**
* Update configurations for installed services.
* Do separated PUT-request for each siteName for each service
@@ -772,11 +779,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
*/
submitProceed: function () {
var self = this;
- this.setProperties({
- isSubmitDisabled: true,
- isBackBtnDisabled: true,
- clusterDeleteRequestsCompleted: 0
- });
+ this.set('clusterDeleteRequestsCompleted', 0);
this.get('clusterDeleteErrorViews').clear();
if (this.get('content.controllerName') == 'addHostController') {
App.router.get('addHostController').setLowerStepsDisable(4);
@@ -1000,6 +1003,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
this.set('ajaxQueueLength', this.get('ajaxRequestsQueue.queue.length'));
this.get('ajaxRequestsQueue').start();
+ this.showLoadingIndicator();
},
/**
@@ -1834,5 +1838,61 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
data: apiObject
}
});
+ },
+
+ /**
+ * Should ajax-queue progress bar be displayed
+ * @method showLoadingIndicator
+ */
+ showLoadingIndicator: function () {
+ return App.ModalPopup.show({
+
+ header: '',
+
+ showFooter: false,
+
+ showCloseButton: false,
+
+ bodyClass: Em.View.extend({
+
+ templateName: require('templates/wizard/step8/step8_log_popup'),
+
+ controllerBinding: 'App.router.wizardStep8Controller',
+
+ /**
+ * Css-property for progress-bar
+ * @type {string}
+ */
+ barWidth: '',
+
+ /**
+ * Popup-message
+ * @type {string}
+ */
+ message: '',
+
+ /**
+ * Set progress bar width and popup message when ajax-queue requests are proccessed
+ * @method ajaxQueueChangeObs
+ */
+ ajaxQueueChangeObs: function () {
+ var length = this.get('controller.ajaxQueueLength');
+ var left = this.get('controller.ajaxRequestsQueue.queue.length');
+ this.set('barWidth', 'width: ' + ((length - left) / length * 100) + '%;');
+ this.set('message', Em.I18n.t('installer.step8.deployPopup.message').format((length - left), length));
+ }.observes('controller.ajaxQueueLength', 'controller.ajaxRequestsQueue.queue.length'),
+
+ /**
+ * Hide popup when ajax-queue is finished
+ * @method autoHide
+ */
+ autoHide: function () {
+ if (this.get('controller.servicesInstalled')) {
+ this.get('parentView').hide();
+ }
+ }.observes('controller.servicesInstalled')
+ })
+
+ });
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 838ace5..3b40d11 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -37,7 +37,6 @@ require('mixins/routers/redirections');
require('mixins/wizard/wizardProgressPageController');
require('mixins/wizard/wizardDeployProgressController');
require('mixins/wizard/wizardProgressPageView');
-require('mixins/wizard/wizardDeployProgressView');
require('mixins/wizard/wizardEnableDone');
require('mixins/wizard/selectHost');
require('mixins/wizard/addSecurityConfigs');
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/mixins/wizard/wizardDeployProgressView.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardDeployProgressView.js b/ambari-web/app/mixins/wizard/wizardDeployProgressView.js
deleted file mode 100644
index 50d70c0..0000000
--- a/ambari-web/app/mixins/wizard/wizardDeployProgressView.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-/**
- * Mixin for wizard view for showing command progress on wizard pages
- * This should
- * @type {Ember.Mixin}
- */
-App.wizardDeployProgressViewMixin = Em.Mixin.create({
-
- /**
- * Should ajax-queue progress bar be displayed
- * @method showLoadingIndicator
- */
- showLoadingIndicator: function () {
- if (!this.get('controller.isSubmitDisabled') || App.get('testMode')) {
- if (this.get('modalPopup')) {
- this.get('modalPopup').hide();
- this.set('modalPopup', null);
- }
- return;
- }
- // don't create popup if it already exists
- if (this.get('modalPopup')) {
- return;
- }
- this.set('modalPopup', App.ModalPopup.show({
-
- header: '',
-
- showFooter: false,
-
- showCloseButton: false,
-
- bodyClass: Em.View.extend({
-
- templateName: require('templates/wizard/step8/step8_log_popup'),
-
- controllerBinding: 'App.router.wizardStep8Controller',
-
- /**
- * Css-property for progress-bar
- * @type {string}
- */
- barWidth: '',
-
- /**
- * Popup-message
- * @type {string}
- */
- message: '',
-
- /**
- * Set progress bar width and popup message when ajax-queue requests are proccessed
- * @method ajaxQueueChangeObs
- */
- ajaxQueueChangeObs: function () {
- var length = this.get('controller.ajaxQueueLength');
- var left = this.get('controller.ajaxRequestsQueue.queue.length');
- this.set('barWidth', 'width: ' + ((length - left) / length * 100) + '%;');
- this.set('message', Em.I18n.t('installer.step8.deployPopup.message').format((length - left), length));
- }.observes('controller.ajaxQueueLength', 'controller.ajaxRequestsQueue.queue.length'),
-
- /**
- * Hide popup when ajax-queue is finished
- * @method autoHide
- */
- autoHide: function () {
- if (this.get('controller.servicesInstalled')) {
- this.get('parentView').hide();
- }
- }.observes('controller.servicesInstalled')
- })
-
- }));
- }.observes('controller.isDeployStarted')
-
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index 74f048f..49bcae6 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -126,13 +126,18 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
},
submitRequest: function () {
+ var self = this;
return App.ajax.send({
name: this.get('request.ajaxName'),
data: this.get('request.ajaxData'),
sender: this,
error: 'onSingleRequestError',
success: 'submitRequestSuccess',
- kdcCancelHandler: 'failTaskOnKdcCheck'
+ kdcCancelHandler: function() {
+ self.set('status', 'FAILED');
+ self.set('isLoaded', true);
+ self.set('showRetry', true);
+ }
});
},
@@ -150,12 +155,6 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
}
},
- failTaskOnKdcCheck: function() {
- this.set('status', 'FAILED');
- this.set('isLoaded', true);
- this.set('showRetry', true);
- },
-
doPollingForPageRequest: function () {
App.ajax.send({
name: 'admin.poll.kerberize.cluster.request',
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index b1c6f12..1876268 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2660,20 +2660,6 @@ var ajax = Em.Object.extend({
opt.error = function (request, ajaxOptions, error) {
var KDCErrorMsg = this.getKDCErrorMgs(request);
if (!Em.isNone(KDCErrorMsg)) {
- /**
- * run this handler before show KDC error popup
- */
- if (config.kdcFailHandler) {
- config.sender[config.kdcFailHandler](request, ajaxOptions, error, opt, params);
- }
- /**
- * run this handler when click cancle on KDC error popup
- */
- if (config.kdcCancelHandler) {
- opt.kdcCancelHandler = function() {
- config.sender[config.kdcCancelHandler]();
- };
- }
this.defaultErrorKDCHandler(opt, KDCErrorMsg);
} else if (config.error) {
config.sender[config.error](request, ajaxOptions, error, opt, params);
@@ -2686,6 +2672,14 @@ var ajax = Em.Object.extend({
config.callback();
}
};
+
+ /**
+ * run this handler when click cancle on KDC error popup
+ */
+ if (config.kdcCancelHandler) {
+ opt.kdcCancelHandler = config.kdcCancelHandler;
+ }
+
if ($.mocho) {
opt.url = 'http://' + $.hostName + opt.url;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/app/views/wizard/step8_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step8_view.js b/ambari-web/app/views/wizard/step8_view.js
index 20d666f..c653fdd 100644
--- a/ambari-web/app/views/wizard/step8_view.js
+++ b/ambari-web/app/views/wizard/step8_view.js
@@ -19,7 +19,7 @@
var App = require('app');
-App.WizardStep8View = Em.View.extend(App.wizardDeployProgressViewMixin, {
+App.WizardStep8View = Em.View.extend({
templateName: require('templates/wizard/step8'),
@@ -35,12 +35,6 @@ App.WizardStep8View = Em.View.extend(App.wizardDeployProgressViewMixin, {
printReview: function () {
var o = $("#step8-info");
o.jqprint();
- },
-
- /**
- * Reference to modalPopup to make sure only one instance is created
- * @type {App.ModalPopup|null}
- */
- modalPopup: null
+ }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index c4628bd..67eb04a 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -792,13 +792,6 @@ describe('App.WizardStep8Controller', function () {
});
});
- describe('#isDeployStarted', function () {
- it('should be undefined', function () {
- installerStep8Controller.set('isSubmitDisabled',false);
- expect(installerStep8Controller.get('isDeployStarted')).to.equal(undefined);
- });
- });
-
describe('#configMapping', function () {
it('should object with isOverridable', function () {
var configMapping = [
@@ -2604,4 +2597,15 @@ describe('App.WizardStep8Controller', function () {
});
+ describe('#showLoadingIndicator', function() {
+ it('if popup doesn\'t exist should create another', function() {
+ installerStep8Controller.set('isSubmitDisabled', true);
+ sinon.spy(App.ModalPopup, 'show');
+ installerStep8Controller.showLoadingIndicator();
+ expect(App.ModalPopup.show.calledOnce).to.equal(true);
+ App.ModalPopup.show.restore();
+ });
+
+ });
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd2e3979/ambari-web/test/views/wizard/step8_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step8_view_test.js b/ambari-web/test/views/wizard/step8_view_test.js
index 9cfc0d6..3f8a605 100644
--- a/ambari-web/test/views/wizard/step8_view_test.js
+++ b/ambari-web/test/views/wizard/step8_view_test.js
@@ -50,71 +50,4 @@ describe('App.WizardStep8View', function() {
});
});
- describe('#showLoadingIndicator', function() {
- it('should hide existing popup', function() {
- var popup = App.ModalPopup.show({});
- view.set('modalPopup', popup);
- view.set('controller', {isSubmitDisabled: false});
- view.showLoadingIndicator();
- expect(Em.isNone(view.get('popup'))).to.equal(true);
- });
- it('if popup exists shouldn\'t create another', function() {
- view.set('modalPopup', App.ModalPopup.show({}));
- view.set('controller', {isSubmitDisabled: true});
- sinon.spy(App.ModalPopup, 'show');
- view.showLoadingIndicator();
- expect(App.ModalPopup.show.called).to.equal(false);
- App.ModalPopup.show.restore();
- });
- it('if popup doesn\'t exist should create another', function() {
- view.set('modalPopup', null);
- view.reopen({controller: {isSubmitDisabled: true}});
- sinon.spy(App.ModalPopup, 'show');
- view.showLoadingIndicator();
- expect(App.ModalPopup.show.calledOnce).to.equal(true);
- App.ModalPopup.show.restore();
- });
-
- describe('#bodyClass', function() {
-
- beforeEach(function() {
- view.set('modalPopup', null);
- view.reopen({controller: {isSubmitDisabled: true}});
- });
-
- describe('#autoHide', function() {
- it('should be called if controller.servicesInstalled is true', function() {
- view.showLoadingIndicator();
- var v = view.get('modalPopup').get('bodyClass').create();
- v.reopen({controller: {servicesInstalled: false}, parentView: Em.Object.create({hide: Em.K})});
- sinon.spy(v.get('parentView'), 'hide');
- v.set('controller.servicesInstalled', true);
- expect(v.get('parentView').hide.calledOnce).to.equal(true);
- v.get('parentView').hide.restore();
- });
- it('shouldn\'t be called if controller.servicesInstalled is false', function() {
- view.showLoadingIndicator();
- var v = view.get('modalPopup').get('bodyClass').create();
- v.reopen({controller: {servicesInstalled: false}, parentView: Em.Object.create({hide: Em.K})});
- sinon.spy(v.get('parentView'), 'hide');
- v.set('controller.servicesInstalled', false);
- expect(v.get('parentView').hide.called).to.equal(false);
- v.get('parentView').hide.restore();
- });
- });
-
- describe('#ajaxQueueChangeObs', function() {
- it('should set barWidth and message', function() {
- view.showLoadingIndicator();
- var v = view.get('modalPopup').get('bodyClass').create();
- v.reopen({controller: {ajaxQueueLength: 12, ajaxRequestsQueue: Em.Object.create({queue: []})}});
- v.set('controller.ajaxRequestsQueue.queue', [{}, {}, {}, {}]);
- expect(v.get('barWidth')).to.equal('width: ' + (8 / 12 * 100) + '%;');
- expect(v.get('message')).to.equal(Em.I18n.t('installer.step8.deployPopup.message').format(8, 12));
- });
- });
-
- });
- });
-
});
\ No newline at end of file