Repository: ambari Updated Branches: refs/heads/trunk 58badf8d6 -> bc82a6eca
AMBARI-16432. Give user visual feedback while we do background request and next button is disabled (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bc82a6ec Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bc82a6ec Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bc82a6ec Branch: refs/heads/trunk Commit: bc82a6eca1ea9062d184add0d3acd099c6893434 Parents: 58badf8 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Tue May 10 17:19:34 2016 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed May 11 11:13:20 2016 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step4_controller.js | 26 ++++---- .../app/controllers/wizard/step6_controller.js | 29 +++++---- .../app/controllers/wizard/step7_controller.js | 68 ++++++++++---------- ambari-web/app/routes/add_host_routes.js | 3 + ambari-web/app/routes/add_service_routes.js | 3 +- .../app/routes/high_availability_routes.js | 21 +++--- ambari-web/app/routes/installer.js | 8 ++- .../common/assign_master_components.hbs | 11 ++-- .../admin/highAvailability/nameNode/step3.hbs | 3 + ambari-web/app/templates/wizard/step6.hbs | 3 + ambari-web/app/templates/wizard/step7.hbs | 3 + ambari-web/app/views/common/global/spinner.js | 6 +- ambari-web/test/controllers/installer_test.js | 12 ---- .../kerberos/kerberos_wizard_controler_test.js | 4 +- .../admin/kerberos/step1_controller_test.js | 1 - .../admin/kerberos/step2_controller_test.js | 12 ++-- .../service/reassign/step4_controller_test.js | 2 +- .../views/main/service/services/hive_test.js | 5 -- 18 files changed, 109 insertions(+), 111 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/controllers/wizard/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js index 56bf435..0575f07 100644 --- a/ambari-web/app/controllers/wizard/step4_controller.js +++ b/ambari-web/app/controllers/wizard/step4_controller.js @@ -17,7 +17,6 @@ */ var App = require('app'); -var stringUtils = require('utils/string_utils'); App.WizardStep4Controller = Em.ArrayController.extend({ @@ -37,11 +36,10 @@ App.WizardStep4Controller = Em.ArrayController.extend({ if (arguments.length > 1) { this.filterProperty('isInstalled', false).setEach('isSelected', value); return value; - } else { - return this.filterProperty('isInstalled', false). - filterProperty('isHiddenOnSelectServicePage', false). - everyProperty('isSelected', true); } + return this.filterProperty('isInstalled', false). + filterProperty('isHiddenOnSelectServicePage', false). + everyProperty('isSelected', true); }.property('@each.isSelected'), /** @@ -75,8 +73,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ * @method multipleDFSs */ multipleDFSs: function () { - var dfsServices = this.filterProperty('isDFS',true).filterProperty('isSelected',true); - return dfsServices.length > 1; + return this.filterProperty('isDFS',true).filterProperty('isSelected',true).length > 1; }, /** @@ -114,7 +111,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ sparkValidation: function (callback) { var sparkService = this.findProperty('serviceName', 'SPARK'); if (sparkService && !sparkService.get('isInstalled') && - App.get('currentStackName') == 'HDP' && App.get('currentStackVersionNumber') == '2.2') { + App.get('currentStackName') === 'HDP' && App.get('currentStackVersionNumber') === '2.2') { if(sparkService.get('isSelected')) { this.addValidationError({ id: 'sparkWarning', @@ -147,7 +144,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ this.unSelectServices(); this.setGroupedServices(); if (this.validate()) { - App.router.nextBtnClickInProgress = true; + App.set('router.nextBtnClickInProgress', true); this.set('errorStack', []); App.router.send('next'); } @@ -189,7 +186,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ this.rangerValidation(callback); this.sparkValidation(callback); if (!!this.get('errorStack').filterProperty('isShown', false).length) { - var firstError = this.get('errorStack').findProperty('isShown', false); + var firstError = this.get('errorStack').findProperty('isShown', false); this.showError(firstError); result = false; } else { @@ -237,9 +234,8 @@ App.WizardStep4Controller = Em.ArrayController.extend({ if (!this.get('errorStack').someProperty('id', errorObject.id)) { this.get('errorStack').push(this.createError(errorObject)); return true; - } else { - return false; } + return false; }, /** @@ -262,7 +258,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ * @method onPrimaryPopupCallback **/ onPrimaryPopupCallback: function(callback, id) { - var firstError = this.get('errorStack').findProperty('isShown', false); + var firstError = this.get('errorStack').findProperty('isShown', false); if (firstError) { firstError.isShown = true; } @@ -338,7 +334,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ if (this.multipleDFSs()) { var dfsServices = this.filterProperty('isDFS',true).filterProperty('isSelected',true).mapProperty('serviceName'); var services = dfsServices.map(function (item){ - return { + return { serviceName: item, selected: item === primaryDfsServiceName }; @@ -372,7 +368,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({ var missingDependencies = []; var missingDependenciesDisplayName = []; selectedServices.forEach(function(service){ - var requiredServices = service.get('requiredServices'); + var requiredServices = service.get('requiredServices'); if (!!requiredServices && requiredServices.length) { requiredServices.forEach(function(_requiredService){ var requiredService = this.findProperty('serviceName', _requiredService); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/controllers/wizard/step6_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js index b9adc90..6090f74 100644 --- a/ambari-web/app/controllers/wizard/step6_controller.js +++ b/ambari-web/app/controllers/wizard/step6_controller.js @@ -17,8 +17,6 @@ */ var App = require('app'); -var db = require('utils/db'); -var stringUtils = require('utils/string_utils'); var blueprintUtils = require('utils/blueprint'); var validationUtils = require('utils/validator'); @@ -355,7 +353,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { var hostInfo = this.get('content.hosts'); var hostNames = []; //flag identify whether get all hosts or only uninstalled(newly added) hosts - var getUninstalledHosts = (this.get('content.controllerName') !== 'addServiceController'); + var getUninstalledHosts = this.get('content.controllerName') !== 'addServiceController'; for (var index in hostInfo) { if (hostInfo.hasOwnProperty(index)) { @@ -443,8 +441,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { hostsObj.forEach(function(host) { var installedHost = hosts[host.hostName]; - var installedComponents = (installedHost) ? - installedHost.hostComponents.mapProperty('HostRoles.component_name') : []; + var installedComponents = installedHost ? installedHost.hostComponents.mapProperty('HostRoles.component_name') : []; host.checkboxes.forEach(function(checkbox) { checkbox.isInstalled = installedComponents.contains(checkbox.component); @@ -756,10 +753,10 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { var mapping = self.get('hosts'); mapping.forEach(function (item, i) { - var group_name = 'host-group-' + (i+1); + var groupName = 'host-group-' + (i+1); - var host_group = { - name: group_name, + var hostGroup = { + name: groupName, components: item.checkboxes.filterProperty('checked', true).map(function (checkbox) { if (checkbox.component === "CLIENT") { return clientComponents.map(function (client) { @@ -771,16 +768,16 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { }) }; - host_group.components = [].concat.apply([], host_group.components); + hostGroup.components = [].concat.apply([], hostGroup.components); var binding = { - name: group_name, + name: groupName, hosts: [ { fqdn: item.hostName } ] }; - res.blueprint.host_groups.push(host_group); + res.blueprint.host_groups.push(hostGroup); res.blueprint_cluster_binding.host_groups.push(binding); }); @@ -802,7 +799,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { var hosts = this.get('content.hosts'); Em.keys(hosts).forEach(function (host, i) { - var group_name = 'host-group-' + (i + 1); + var groupName = 'host-group-' + (i + 1); var components = []; masters.forEach(function (master) { if (master.hostName === host) { @@ -812,11 +809,11 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { } }); res.blueprint.host_groups.push({ - name: group_name, + name: groupName, components: components }); res.blueprint_cluster_binding.host_groups.push({ - name: group_name, + name: groupName, hosts: [ { fqdn: host @@ -843,6 +840,10 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, { onPrimary: function () { this.hide(); callback(); + }, + onSecondary: function () { + App.set('router.nextBtnClickInProgress', false); + this._super(); } }); } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index c97de10..c3b98b5 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -143,7 +143,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E isSubmitDisabled: function () { if (!this.get('stepConfigs.length')) return true; if (this.get('submitButtonClicked')) return true; - return (!this.get('stepConfigs').filterProperty('showConfig', true).everyProperty('errorCount', 0) || this.get("miscModalVisible")); + return !this.get('stepConfigs').filterProperty('showConfig', true).everyProperty('errorCount', 0) || this.get("miscModalVisible"); }.property('stepConfigs.@each.errorCount', 'miscModalVisible', 'submitButtonClicked'), /** @@ -219,8 +219,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E var clientPort = App.configsCollection.getConfigByName('clientPort', 'zoo.cfg.xml'); if (hiveMetastore) dependencies['hive.metastore.uris'] = hiveMetastore.recommendedValue; - if (clientPort) dependencies['clientPort'] = clientPort.recommendedValue; - return dependencies + if (clientPort) dependencies.clientPort = clientPort.recommendedValue; + return dependencies; }.property(), /** @@ -245,8 +245,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E ], issuesFilterText: function () { - return (this.get('isSubmitDisabled') && !this.get('submitButtonClicked') && - this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected')) ? + return this.get('isSubmitDisabled') && !this.get('submitButtonClicked') && + this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected') ? Em.I18n.t('installer.step7.showingPropertiesWithIssues') : ''; }.property('isSubmitDisabled', 'submitButtonClicked', 'filterColumns.@each.selected'), @@ -255,11 +255,10 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E return Em.I18n.t('installer.step7.showAllProperties'); } - return (this.get('isSubmitDisabled') && !this.get('submitButtonClicked')) ? - ( + return this.get('isSubmitDisabled') && !this.get('submitButtonClicked') ? this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected') ? Em.I18n.t('installer.step7.showAllProperties') : Em.I18n.t('installer.step7.showPropertiesWithIssues') - ) : ''; + : ''; }.property('isSubmitDisabled', 'submitButtonClicked', 'filterColumns.@each.selected'), /** @@ -326,7 +325,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E * Are some changes available */ hasChanges: function () { - return this.get('hash') != this.getHash(); + return this.get('hash') !== this.getHash(); }, /** @@ -420,7 +419,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E } else { serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isEditable') && serviceConfigProperty.get('isReconfigurable')); } - } else if (!(Em.get(serviceConfigProperty, 'group') && Em.get(serviceConfigProperty, 'group.name') == this.get('selectedConfigGroup.name'))) { + } else if (!(Em.get(serviceConfigProperty, 'group') && Em.get(serviceConfigProperty, 'group.name') === this.get('selectedConfigGroup.name'))) { serviceConfigProperty.set('isEditable', false); } } @@ -482,7 +481,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E * @param {Array} configs */ updateHawqConfigs: function (configs) { - if (this.get('wizardController.name') == 'addServiceController') { + if (this.get('wizardController.name') === 'addServiceController') { if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs); if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs); } @@ -504,7 +503,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E if (!this.get('installedServiceNames').contains('HAWQ') && this.get('allSelectedServiceNames').contains('HAWQ')) { this.updateHawqConfigs(configs); } - if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') { + if (App.get('isKerberosEnabled') && this.get('wizardController.name') === 'addServiceController') { this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []); } App.configTheme.resolveConfigThemeConditions(configs); @@ -539,12 +538,12 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E App.ConfigAction.find().forEach(function(item){ var configName = item.get('configName'); var fileName = item.get('fileName'); - var config = configs.filterProperty('filename', fileName).findProperty('name', configName); + var config = configs.filterProperty('filename', fileName).findProperty('name', configName); if (config) { var isServiceInstalled = App.Service.find().findProperty('serviceName', config.serviceName); if (isServiceInstalled) { var serviceConfigs = stepConfigs.findProperty('serviceName', config.serviceName).get('configs'); - var serviceConfig = serviceConfigs.filterProperty('filename', fileName).findProperty('name', configName); + var serviceConfig = serviceConfigs.filterProperty('filename', fileName).findProperty('name', configName); serviceConfig.set('isReconfigurable', false); config.isReconfigurable = false; } @@ -627,12 +626,12 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E if (['MISC'].concat(this.get('allSelectedServiceNames')).contains(serviceName)) { var serviceConfig = App.config.createServiceConfig(serviceName); serviceConfig.set('showConfig', App.StackService.find(serviceName).get('isInstallable')); - if (this.get('wizardController.name') == 'addServiceController') { + if (this.get('wizardController.name') === 'addServiceController') { serviceConfig.set('selected', !this.get('installedServiceNames').concat('MISC').contains(serviceName)); if (serviceName === 'MISC') { serviceConfig.set('configCategories', serviceConfig.get('configCategories').rejectProperty('name', 'Notifications')); } - } else if (this.get('wizardController.name') == 'kerberosWizardController') { + } else if (this.get('wizardController.name') === 'kerberosWizardController') { serviceConfig.set('showConfig', true); } stepConfigs.pushObject(serviceConfig); @@ -814,7 +813,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E * @param storedConfigProperty */ updateHostOverrides: function (configProperty, storedConfigProperty) { - if (storedConfigProperty.overrides != null && storedConfigProperty.overrides.length > 0) { + if (!Em.isEmpty(storedConfigProperty.overrides)) { var overrides = []; storedConfigProperty.overrides.forEach(function (overrideEntry) { // create new override with new value @@ -860,7 +859,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E var cfg = serviceConfigs.findProperty('serviceName', c.serviceName).configs.findProperty('name', c.configToUpdate); var regexPattern = /\/\/.*:[0-9]+/i; var replacementValue = '//' + nameServiceId.get('value'); - if (typeof(c.regexPattern) !== "undefined" && typeof(c.replacementValue) !== "undefined") { + if (!Em.isNone(c.regexPattern) && !Em.isNone(c.replacementValue)) { regexPattern = c.regexPattern; replacementValue = c.replacementValue; } @@ -918,7 +917,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E var serviceConfigTags = []; for (var site in data.Clusters.desired_configs) { if (data.Clusters.desired_configs.hasOwnProperty(site)) { - if (installedServiceSites.contains(site) || site == 'cluster-env') { + if (installedServiceSites.contains(site) || site === 'cluster-env') { serviceConfigTags.push({ siteName: site, tagName: data.Clusters.desired_configs[site].tag, @@ -947,12 +946,12 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E var allConfigs = configs.filter(function (_config) { // filter out alert_notification configs on add service //TODO find better place for this! if (_config.filename === 'alert_notification') return false; - if ((['MISC'].concat(installedServiceNames).contains(_config.serviceName))) { + if (['MISC'].concat(installedServiceNames).contains(_config.serviceName)) { var type = _config.filename ? App.config.getConfigTagFromFileName(_config.filename) : null; var mappedConfigValue = type && configsMap[type] ? configsMap[type][_config.name] : null; if (Em.isNone(mappedConfigValue)) { //for now ranger plugin properties are not sending by recommendations if they are missed - it should be added - return _config.serviceName == 'MISC' || /^ranger-/.test(_config.filename); + return _config.serviceName === 'MISC' || /^ranger-/.test(_config.filename); } else { if (_config.savedValue != mappedConfigValue) { _config.savedValue = App.config.formatPropertyValue(_config, mappedConfigValue); @@ -989,7 +988,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E if (config.name === 'hive.metastore.uris' && config.filename === 'hive-site.xml') { this.get('configDependencies')['hive.metastore.uris'] = config.savedValue; } else if (config.name === 'clientPort' && config.filename === 'hive-site.xml') { - this.get('configDependencies')['clientPort'] = config.savedValue; + this.get('configDependencies').clientPort = config.savedValue; } }, @@ -1002,10 +1001,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E setGroupsToDelete: function (groups) { var groupsToDelete = this.get('groupsToDelete'); groups.forEach(function (group) { - if (!group.get('isTemporary')) + if (!group.get('isTemporary')) { groupsToDelete.push({ id: group.get('id') }); + } }); this.get('wizardController').setDBProperty('groupsToDelete', groupsToDelete); }, @@ -1017,7 +1017,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E * @method selectedServiceObserver */ selectedServiceObserver: function () { - if (this.get('selectedService') && (this.get('selectedService.serviceName') !== 'MISC')) { + if (this.get('selectedService') && this.get('selectedService.serviceName') !== 'MISC') { var serviceGroups = this.get('selectedService.configGroups'); serviceGroups.forEach(function (item, index, array) { if (item.isDefault) { @@ -1087,7 +1087,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E switchConfigGroupConfigs: function () { var serviceConfigs = this.get('selectedService.configs'), selectedGroup = this.get('selectedConfigGroup'), - overrideToAdd = this.get('overrideToAdd'), overrides = []; if (!selectedGroup) return; @@ -1110,7 +1109,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E _getDisplayedConfigGroups: function () { var selectedGroup = this.get('selectedConfigGroup'); if (!selectedGroup) return []; - return (selectedGroup.get('isDefault')) ? + return selectedGroup.get('isDefault') ? this.get('selectedService.configGroups').filterProperty('isDefault', false) : [this.get('selectedConfigGroup')]; }, @@ -1132,7 +1131,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E isEditable = selectedGroup.get('isDefault'); } if (config.get('group')) { - isEditable = config.get('group.name') == this.get('selectedConfigGroup.name'); + isEditable = config.get('group.name') === this.get('selectedConfigGroup.name'); } config.set('isEditable', isEditable); return config; @@ -1152,7 +1151,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E configOverrides = overrides.filterProperty('name', config.get('name')); if (!selectedGroup) return config; if (overrideToAdd && overrideToAdd.get('name') === config.get('name')) { - var valueForOverride = (config.get('widget') || config.get('displayType') == 'checkbox') ? config.get('value') : ''; + var valueForOverride = (config.get('widget') || config.get('displayType') === 'checkbox') ? config.get('value') : ''; var group = this.get('selectedService.configGroups').findProperty('name', selectedGroup.get('name')); var newSCP = App.config.createOverride(config, {value: valueForOverride, recommendedValue: valueForOverride}, group); configOverrides.push(newSCP); @@ -1284,7 +1283,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E return; } var hiveDBType = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hive_database').value; - if (hiveDBType == 'New MySQL Database') { + if (hiveDBType === 'New MySQL Database') { var self = this; return this.checkMySQLHost().done(function () { self.mySQLWarningHandler(); @@ -1432,7 +1431,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E var self = this; if (this.get('selectedServiceNames').contains('OOZIE')) { var databaseType = Em.getWithDefault(App.config.findConfigProperty(this.get('stepConfigs'), 'oozie_database', 'oozie-env.xml') || {}, 'value', ''); - if (databaseType == Em.I18n.t('installer.step7.oozie.database.new')) { + if (databaseType === Em.I18n.t('installer.step7.oozie.database.new')) { return App.ModalPopup.show({ header: Em.I18n.t('common.warning'), body: Em.I18n.t('installer.step7.popup.oozie.derby.warning'), @@ -1445,6 +1444,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E } }, onSecondary: function() { + App.set('router.nextBtnClickInProgress', false); self.set('submitButtonClicked', false); this.hide(); }, @@ -1464,7 +1464,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E * Proceed to the next step **/ moveNext: function () { - App.router.nextBtnClickInProgress = true; + App.set('router.nextBtnClickInProgress', true); App.router.send('next'); this.set('submitButtonClicked', false); }, @@ -1478,7 +1478,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E if (this.get('isSubmitDisabled') || App.router.nextBtnClickInProgress) { return false; } - + App.set('router.nextBtnClickInProgress', true); if (this.get('supportsPreInstallChecks')) { var preInstallChecksController = App.router.get('preInstallChecksController'); if (preInstallChecksController.get('preInstallChecksWhereRun')) { @@ -1496,9 +1496,9 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E self.serverSideValidationCallback(); }) .fail(function (value) { - if ("invalid_configs" == value) { + if ("invalid_configs" === value) { self.set('submitButtonClicked', false); - App.router.nextBtnClickInProgress = false; + App.set('router.nextBtnClickInProgress', false); } else { // Failed due to validation mechanism failure. // Should proceed with other checks http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/routes/add_host_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js index 53ca9bc..ba290cd 100644 --- a/ambari-web/app/routes/add_host_routes.js +++ b/ambari-web/app/routes/add_host_routes.js @@ -184,6 +184,7 @@ module.exports = App.WizardRoute.extend({ }, back: Em.Router.transitionTo('step2'), next: function (router) { + App.set('router.nextBtnClickInProgress', true); var addHostController = router.get('addHostController'); var wizardStep6Controller = router.get('wizardStep6Controller'); @@ -191,10 +192,12 @@ module.exports = App.WizardRoute.extend({ wizardStep6Controller.showValidationIssuesAcceptBox(function () { addHostController.saveSlaveComponentHosts(wizardStep6Controller); if (wizardStep6Controller.isAllCheckboxesEmpty()) { + App.set('router.nextBtnClickInProgress', false); router.transitionTo('step5'); addHostController.set('content.configGroups', []); addHostController.saveServiceConfigGroups(); } else { + App.set('router.nextBtnClickInProgress', false); router.transitionTo('step4'); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/routes/add_service_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js index 5dbc585..a69068a 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -47,7 +47,6 @@ module.exports = App.WizardRoute.extend({ onClose: function () { this.set('showCloseButton', false); // prevent user to click "Close" many times App.router.get('updateController').set('isWorking', true); - var self = this; App.router.get('updateController').updateServices(function () { App.router.get('updateController').updateServiceMetric(); }); @@ -179,6 +178,7 @@ module.exports = App.WizardRoute.extend({ } }, next: function (router) { + App.set('router.nextBtnClickInProgress', true); var addServiceController = router.get('addServiceController'); var wizardStep6Controller = router.get('wizardStep6Controller'); @@ -195,6 +195,7 @@ module.exports = App.WizardRoute.extend({ router.get('wizardStep7Controller').set('recommendationsConfigs', null); router.get('wizardStep7Controller').clearAllRecommendations(); addServiceController.setDBProperty('serviceConfigGroups', undefined); + App.set('router.nextBtnClickInProgress', false); router.transitionTo('step4'); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/routes/high_availability_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/high_availability_routes.js b/ambari-web/app/routes/high_availability_routes.js index d7641cd..21e83ab 100644 --- a/ambari-web/app/routes/high_availability_routes.js +++ b/ambari-web/app/routes/high_availability_routes.js @@ -52,10 +52,9 @@ module.exports = App.WizardRoute.extend({ }.observes('App.router.highAvailabilityWizardController.currentStep'), onClose: function () { - var self = this; var currStep = App.router.get('highAvailabilityWizardController.currentStep'); var highAvailabilityProgressPageController = App.router.get('highAvailabilityProgressPageController'); - if (parseInt(currStep) > 4) { + if (parseInt(currStep, 10) > 4) { if (!App.supports.autoRollbackHA) { highAvailabilityProgressPageController.manualRollback(); } else { @@ -66,7 +65,7 @@ module.exports = App.WizardRoute.extend({ } else { var controller = App.router.get('highAvailabilityWizardController'); controller.clearTasksData(); - controller.resetOnClose(controller, self, 'main.services.index'); + controller.resetOnClose(controller, 'main.services.index'); } }, didInsertElement: function () { @@ -164,7 +163,7 @@ module.exports = App.WizardRoute.extend({ controller.dataLoading().done(function () { controller.setCurrentStep('3'); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep3', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep3', controller.get('content')); }); }); }, @@ -172,6 +171,7 @@ module.exports = App.WizardRoute.extend({ return false; }, next: function (router) { + App.set('router.nextBtnClickInProgress', true); var controller = router.get('highAvailabilityWizardController'); var stepController = router.get('highAvailabilityWizardStep3Controller'); controller.saveServiceConfigProperties(stepController); @@ -180,6 +180,7 @@ module.exports = App.WizardRoute.extend({ if (App.Service.find().someProperty('serviceName', 'HBASE')) { controller.saveConfigTag(stepController.get("hbaseSiteTag")); } + App.set('router.nextBtnClickInProgress', false); router.transitionTo('step4'); }, back: Em.Router.transitionTo('step2') @@ -193,7 +194,7 @@ module.exports = App.WizardRoute.extend({ controller.setCurrentStep('4'); controller.setLowerStepsDisable(4); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep4', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep4', controller.get('content')); }); }) }, @@ -215,7 +216,7 @@ module.exports = App.WizardRoute.extend({ controller.setCurrentStep('5'); controller.setLowerStepsDisable(5); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep5', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep5', controller.get('content')); }); }) }, @@ -237,7 +238,7 @@ module.exports = App.WizardRoute.extend({ controller.setCurrentStep('6'); controller.setLowerStepsDisable(6); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep6', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep6', controller.get('content')); }); }) }, @@ -257,7 +258,7 @@ module.exports = App.WizardRoute.extend({ controller.setCurrentStep('7'); controller.setLowerStepsDisable(7); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep7', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep7', controller.get('content')); }); }) }, @@ -279,7 +280,7 @@ module.exports = App.WizardRoute.extend({ controller.setCurrentStep('8'); controller.setLowerStepsDisable(8); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep8', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep8', controller.get('content')); }); }) }, @@ -301,7 +302,7 @@ module.exports = App.WizardRoute.extend({ controller.setCurrentStep('9'); controller.setLowerStepsDisable(9); controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep9', controller.get('content')); + controller.connectOutlet('highAvailabilityWizardStep9', controller.get('content')); }); }) }, http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/routes/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js index eacf30f..24a611a 100644 --- a/ambari-web/app/routes/installer.js +++ b/ambari-web/app/routes/installer.js @@ -85,7 +85,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, { }, connectOutlets: function (router, context) { - console.log('in /installer:connectOutlets'); router.get('applicationController').connectOutlet('installer'); }, @@ -345,9 +344,9 @@ module.exports = Em.Route.extend(App.RouterRedirections, { next: function (router) { console.time('step6 next'); + App.set('router.nextBtnClickInProgress', true); var controller = router.get('installerController'); var wizardStep6Controller = router.get('wizardStep6Controller'); - var wizardStep7Controller = router.get('wizardStep7Controller'); if (!wizardStep6Controller.get('submitDisabled')) { wizardStep6Controller.showValidationIssuesAcceptBox(function () { if (!router.transitionInProgress) { @@ -360,6 +359,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { recommendationsHostGroups: wizardStep6Controller.get('content.recommendationsHostGroups'), recommendationsConfigs: null }); + App.set('router.nextBtnClickInProgress', false); router.transitionTo('step7'); console.timeEnd('step6 next'); } @@ -407,11 +407,13 @@ module.exports = Em.Route.extend(App.RouterRedirections, { console.time('step7 next'); if (!router.transitionInProgress) { router.set('transitionInProgress', true); + App.set('router.nextBtnClickInProgress', true); var controller = router.get('installerController'); var wizardStep7Controller = router.get('wizardStep7Controller'); controller.saveServiceConfigProperties(wizardStep7Controller); controller.saveServiceConfigGroups(wizardStep7Controller); controller.setDBProperty('recommendationsConfigs', wizardStep7Controller.get('recommendationsConfigs')); + App.set('router.nextBtnClickInProgress', false); router.transitionTo('step8'); console.timeEnd('step7 next'); } @@ -422,7 +424,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, { route: '/step8', connectOutlets: function (router, context) { console.time('step8 connectOutlets'); - console.log('in installer.step8:connectOutlets'); var controller = router.get('installerController'); controller.setCurrentStep('8'); controller.loadAllPriorSteps().done(function () { @@ -445,6 +446,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { // We need to do recovery based on whether we are in Add Host or Installer wizard installerController.saveClusterState('CLUSTER_INSTALLING_3'); wizardStep8Controller.set('servicesInstalled', true); + router.set('nextBtnClickInProgress', false); router.transitionTo('step9'); console.timeEnd('step8 next'); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/templates/common/assign_master_components.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/assign_master_components.hbs b/ambari-web/app/templates/common/assign_master_components.hbs index 860e01d..dc05d74 100644 --- a/ambari-web/app/templates/common/assign_master_components.hbs +++ b/ambari-web/app/templates/common/assign_master_components.hbs @@ -138,9 +138,12 @@ {{view App.SpinnerView}} {{/if}} <div class="btn-area"> - {{#if view.isBackButtonVisible}} - <a class="btn pull-left installer-back-btn" {{action back}}>← {{t common.back}}</a> - {{/if}} - <a class="btn btn-success pull-right" {{bindAttr disabled="submitDisabled"}} {{action submit target="controller"}}>{{view.acceptButtonText}}</a> + {{#if view.isBackButtonVisible}} + <a class="btn pull-left installer-back-btn" {{action back}}>← {{t common.back}}</a> + {{/if}} + <a class="btn btn-success pull-right" {{bindAttr disabled="submitDisabled"}} {{action submit target="controller"}}>{{view.acceptButtonText}}</a> + {{#if App.router.nextBtnClickInProgress}} + {{view App.SpinnerView tagName="span" classNames="pull-right"}} + {{/if}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/templates/main/admin/highAvailability/nameNode/step3.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/highAvailability/nameNode/step3.hbs b/ambari-web/app/templates/main/admin/highAvailability/nameNode/step3.hbs index 1fc5ee5..27653d3 100644 --- a/ambari-web/app/templates/main/admin/highAvailability/nameNode/step3.hbs +++ b/ambari-web/app/templates/main/admin/highAvailability/nameNode/step3.hbs @@ -78,4 +78,7 @@ <div class="btn-area"> <a class="btn" {{action back}}>← {{t common.back}}</a> <a class="btn btn-success pull-right" {{bindAttr disabled="controller.isNextDisabled"}} {{action next}}>{{t common.next}} →</a> + {{#if App.router.nextBtnClickInProgress}} + {{view App.SpinnerView tagName="span" classNames="pull-right"}} + {{/if}} </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/templates/wizard/step6.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step6.hbs b/ambari-web/app/templates/wizard/step6.hbs index 36d93f9..31d62f9 100644 --- a/ambari-web/app/templates/wizard/step6.hbs +++ b/ambari-web/app/templates/wizard/step6.hbs @@ -96,5 +96,8 @@ <div class="btn-area"> <a class="btn installer-back-btn" {{action back}}>← {{t common.back}}</a> <a class="btn btn-success pull-right" {{bindAttr disabled="submitDisabled"}} {{action next}}>{{t common.next}} →</a> + {{#if App.router.nextBtnClickInProgress}} + {{view App.SpinnerView tagName="span" classNames="pull-right"}} + {{/if}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/templates/wizard/step7.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step7.hbs b/ambari-web/app/templates/wizard/step7.hbs index c0442e5..c29fdc9 100644 --- a/ambari-web/app/templates/wizard/step7.hbs +++ b/ambari-web/app/templates/wizard/step7.hbs @@ -36,6 +36,9 @@ {{#if App.supports.preInstallChecks}} <a class="btn" {{action runPreInstallChecks target="App.router.preInstallChecksController"}} {{bindAttr disabled="isSubmitDisabled"}}><i class="icon-exclamation"></i> {{t installer.step7.preInstallChecks}}</a> {{/if}} + {{#if App.router.nextBtnClickInProgress}} + {{view App.SpinnerView tagName="span"}} + {{/if}} <a class="btn btn-success" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}} →</a> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/app/views/common/global/spinner.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/global/spinner.js b/ambari-web/app/views/common/global/spinner.js index 1a5beb0..1990b53 100644 --- a/ambari-web/app/views/common/global/spinner.js +++ b/ambari-web/app/views/common/global/spinner.js @@ -20,13 +20,13 @@ var App = require('app'); App.SpinnerView = Em.View.extend({ classNames: 'spinner', + message: '', translated: function() { return this.get('message') ? Em.I18n.t(this.get('message')) : ''; }.property('message'), - template: function() { - return Em.Handlebars.compile('<i class="icon-spinner icon-spin"></i>' + this.get('translated')); - }.property() + template: Em.Handlebars.compile('<i class="icon-spinner icon-spin"></i>{{view.translated}}') + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/test/controllers/installer_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js index 85f5613..303c8a4 100644 --- a/ambari-web/test/controllers/installer_test.js +++ b/ambari-web/test/controllers/installer_test.js @@ -41,18 +41,6 @@ describe('App.InstallerController', function () { }); }); - describe('#loadStacksVersionsDefinitionsSuccessCallback', function() { - beforeEach(function () { - sinon.stub(App.store, 'commit', Em.K); - }); - afterEach(function () { - App.store.commit.restore(); - }); - it ('Correct data', function() { - installerController.set('loadStacksRequestsCounter', 1); - }); - }); - describe('#getCluster', function() { it ('Should return merged clusterStatusTemplate', function() { installerController.set('clusterStatusTemplate', { http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js index 6696c3c..2d792f2 100644 --- a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js +++ b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js @@ -466,8 +466,8 @@ describe('App.KerberosWizardController', function() { expect(controller.saveRequestIds.calledWith(undefined)).to.be.true; }); - it("saveTasksRequestIds should be called", function() { - expect(controller.saveTasksRequestIds.calledWith(undefined)).to.be.true; + it("saveTasksStatuses should be called", function() { + expect(controller.saveTasksStatuses.calledWith(undefined)).to.be.true; }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js index 280f923..fda2ab4 100644 --- a/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js +++ b/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js @@ -17,7 +17,6 @@ */ var App = require('app'); -var testHelpers = require('test/helpers'); function getController() { return App.KerberosWizardStep1Controller.create({}); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js index 260782c..dd8263e 100644 --- a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js +++ b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js @@ -310,7 +310,7 @@ describe('App.KerberosWizardStep2Controller', function() { App.config.get.restore(); }); - it("fileName not specified", function() { + it("fileName not specified (serviceName S1)", function() { this.mock.returns([ { serviceName: 'S1' @@ -319,7 +319,7 @@ describe('App.KerberosWizardStep2Controller', function() { expect(controller.getKerberosConfigs()).to.be.empty; }); - it("fileName not specified", function() { + it("fileName not specified (serviceName KERBEROS)", function() { this.mock.returns([ { serviceName: 'KERBEROS' @@ -419,7 +419,7 @@ describe('App.KerberosWizardStep2Controller', function() { expect(controller.get('controllers.kerberosWizardController').overrideVisibility.calledOnce).to.be.true; }); - it("overrideVisibility should be called", function() { + it("overrideVisibility results are valid", function() { configs = [{ name: 'manage_identities' }]; @@ -532,7 +532,7 @@ describe('App.KerberosWizardStep2Controller', function() { expect(App.router.send.calledWith('next')).to.be.true; }); - it("App.router.send should be called", function() { + it("createKerberosResources should be called", function() { mock.set('skipClientInstall', false); controller.configureKerberos(); expect(mock.createKerberosResources.calledOnce).to.be.true; @@ -694,13 +694,13 @@ describe('App.KerberosWizardStep2Controller', function() { it("kdc_type should be p2", function() { var properties = {'kdc_type': 'p2'}; controller.tweakKdcTypeValue(properties); - expect(properties['kdc_type']).to.be.equal('p2') + expect(properties.kdc_type).to.be.equal('p2') }); it("kdc_type should be k1", function() { var properties = {'kdc_type': 'p1'}; controller.tweakKdcTypeValue(properties); - expect(properties['kdc_type']).to.be.equal('k1') + expect(properties.kdc_type).to.be.equal('k1') }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js index f5a8a1b..d6ef9dc 100644 --- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js @@ -1479,7 +1479,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { expect(configs['hbase-site']['hbase.rootdir']).to.equal('hdfs://host2:8020/apps/hbase/data'); expect(configs['accumulo-site']['instance.volumes']).to.equal('hdfs://host2:8020/apps/accumulo/data'); expect(configs['accumulo-site']['instance.volumes.replacements']).to.equal('hdfs://host1:8020/apps/accumulo/data hdfs://host2:8020/apps/accumulo/data'); - expect(configs['hawq-site']['hawq_dfs_url']).to.equal('host2:8020/hawq/data'); + expect(configs['hawq-site'].hawq_dfs_url).to.equal('host2:8020/hawq/data'); }); it('HA enabled and namenode 1', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/bc82a6ec/ambari-web/test/views/main/service/services/hive_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/service/services/hive_test.js b/ambari-web/test/views/main/service/services/hive_test.js index ba987a0..39a198d 100644 --- a/ambari-web/test/views/main/service/services/hive_test.js +++ b/ambari-web/test/views/main/service/services/hive_test.js @@ -16,13 +16,8 @@ * limitations under the License. */ -var App = require('app'); require('/views/main/service/services/hive'); describe('App.MainDashboardServiceHiveView', function () { - var view; - beforeEach(function() { - view = App.MainDashboardServiceHiveView.create(); - }); }); \ No newline at end of file