Repository: ambari Updated Branches: refs/heads/trunk ca630b868 -> c3e482f78
AMBARI-16641. NN HA wizard cannot recover from server restart at Step6 (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c3e482f7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c3e482f7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c3e482f7 Branch: refs/heads/trunk Commit: c3e482f7817a91eadb5b804af8bee267105f2ae1 Parents: ca630b8 Author: Alex Antonenko <[email protected]> Authored: Fri May 13 12:29:29 2016 +0300 Committer: Alex Antonenko <[email protected]> Committed: Fri May 13 18:13:45 2016 +0300 ---------------------------------------------------------------------- .../controllers/global/cluster_controller.js | 16 +-- .../hawq/activateStandby/wizard_controller.js | 59 +++++--- .../hawq/addStandby/wizard_controller.js | 65 ++++++--- .../hawq/removeStandby/wizard_controller.js | 59 +++++--- .../nameNode/rollback_controller.js | 23 +-- .../nameNode/wizard_controller.js | 25 +++- .../rangerAdmin/wizard_controller.js | 5 +- .../resourceManager/wizard_controller.js | 63 +++++--- .../app/controllers/main/host/add_controller.js | 76 ++++++---- .../controllers/main/service/add_controller.js | 20 ++- .../main/service/reassign_controller.js | 90 ++++++++---- ambari-web/app/controllers/wizard.js | 51 ++++--- .../app/routes/high_availability_routes.js | 15 +- .../main/host/add_controller_test.js | 144 ------------------- 14 files changed, 371 insertions(+), 340 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/global/cluster_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index 9862261..2360507 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -212,14 +212,14 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, { /** * Order of loading: * 1. load all created service components - * 1. request for service components supported by stack - * 2. load stack components to model - * 3. request for services - * 4. put services in cache - * 5. request for hosts and host-components (single call) - * 6. request for service metrics - * 7. load host-components to model - * 8. load services from cache with metrics to model + * 2. request for service components supported by stack + * 3. load stack components to model + * 4. request for services + * 5. put services in cache + * 6. request for hosts and host-components (single call) + * 7. request for service metrics + * 8. load host-components to model + * 9. load services from cache with metrics to model */ self.loadStackServiceComponents(function (data) { data.items.forEach(function (service) { http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js index aa50b76..4523262 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js @@ -36,6 +36,45 @@ App.ActivateHawqStandbyWizardController = App.WizardController.extend({ controllerName: 'activateHawqStandbyWizardController' }), + /** + * Load data for all steps until <code>current step</code> + */ + loadMap: { + '1': [ + { + type: 'sync', + callback: function () { + this.load('cluster'); + } + } + ], + '2': [ + { + type: 'async', + callback: function () { + var dfd = $.Deferred(); + this.loadHawqHosts(); + this.loadServicesFromServer(); + this.loadMasterComponentHosts().done(function () { + dfd.resolve(); + }); + return dfd.promise(); + } + } + ], + '3': [ + { + type: 'sync', + callback: function () { + this.loadTasksStatuses(); + this.loadTasksRequestIds(); + this.loadRequestIds(); + this.loadConfigs(); + } + } + ] + }, + init: function () { this._super(); this.clearStep(); @@ -89,26 +128,6 @@ App.ActivateHawqStandbyWizardController = App.WizardController.extend({ }, /** - * Load data for all steps until <code>current step</code> - */ - loadAllPriorSteps: function () { - var step = this.get('currentStep'); - switch (step) { - case '3': - this.loadTasksStatuses(); - this.loadTasksRequestIds(); - this.loadRequestIds(); - this.loadConfigs(); - case '2': - this.loadHawqHosts(); - this.loadServicesFromServer(); - this.loadMasterComponentHosts(); - case '1': - this.load('cluster'); - } - }, - - /** * Remove all loaded data. */ clearAllSteps: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/wizard_controller.js index 1c4325e..6aeb82a 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/wizard_controller.js @@ -36,6 +36,47 @@ App.AddHawqStandbyWizardController = App.WizardController.extend({ controllerName: 'addHawqStandbyWizardController' }), + /** + * Load data for all steps until <code>current step</code> + */ + loadMap: { + '1': [ + { + type: 'sync', + callback: function () { + this.load('cluster'); + } + } + ], + '2': [ + { + type: 'async', + callback: function () { + var self = this, + dfd = $.Deferred(); + this.loadHawqHosts(); + this.loadServicesFromServer(); + this.loadMasterComponentHosts().done(function () { + self.loadConfirmedHosts(); + dfd.resolve(); + }); + return dfd.promise(); + } + } + ], + '4': [ + { + type: 'sync', + callback: function () { + this.loadTasksStatuses(); + this.loadTasksRequestIds(); + this.loadRequestIds(); + this.loadConfigs(); + } + } + ] + }, + init: function () { this._super(); this.clearStep(); @@ -56,7 +97,7 @@ App.AddHawqStandbyWizardController = App.WizardController.extend({ /** * Save hosts for hawq master and hawq standby to local db and <code>controller.content</code> - * @param rmHosts + * @param hawqHosts */ saveHawqHosts: function (hawqHosts) { this.set('content.hawqHosts', hawqHosts); @@ -87,28 +128,6 @@ App.AddHawqStandbyWizardController = App.WizardController.extend({ }, /** - * Load data for all steps until <code>current step</code> - */ - loadAllPriorSteps: function () { - var step = this.get('currentStep'); - switch (step) { - case '4': - this.loadTasksStatuses(); - this.loadTasksRequestIds(); - this.loadRequestIds(); - this.loadConfigs(); - case '3': - case '2': - this.loadHawqHosts(); - this.loadServicesFromServer(); - this.loadMasterComponentHosts(); - this.loadConfirmedHosts(); - case '1': - this.load('cluster'); - } - }, - - /** * Remove all loaded data. */ clearAllSteps: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js index 0797eed..7546065 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/removeStandby/wizard_controller.js @@ -36,6 +36,45 @@ App.RemoveHawqStandbyWizardController = App.WizardController.extend({ controllerName: 'removeHawqStandbyWizardController' }), + /** + * Load data for all steps until <code>current step</code> + */ + loadMap: { + '1': [ + { + type: 'sync', + callback: function () { + this.load('cluster'); + } + } + ], + '2': [ + { + type: 'async', + callback: function () { + var dfd = $.Deferred(); + this.loadHawqHosts(); + this.loadServicesFromServer(); + this.loadMasterComponentHosts().done(function () { + dfd.resolve(); + }); + return dfd.promise(); + } + } + ], + '3': [ + { + type: 'sync', + callback: function () { + this.loadTasksStatuses(); + this.loadTasksRequestIds(); + this.loadRequestIds(); + this.loadConfigs(); + } + } + ] + }, + init: function () { this._super(); this.clearStep(); @@ -89,26 +128,6 @@ App.RemoveHawqStandbyWizardController = App.WizardController.extend({ }, /** - * Load data for all steps until <code>current step</code> - */ - loadAllPriorSteps: function () { - var step = this.get('currentStep'); - switch (step) { - case '3': - this.loadTasksStatuses(); - this.loadTasksRequestIds(); - this.loadRequestIds(); - this.loadConfigs(); - case '2': - this.loadHawqHosts(); - this.loadServicesFromServer(); - this.loadMasterComponentHosts(); - case '1': - this.load('cluster'); - } - }, - - /** * Remove all loaded data. */ clearAllSteps: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js index 6895c6c..fc44724 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js @@ -49,17 +49,24 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl ], loadStep: function () { - this.initData(); - this.clearStep(); - this.loadTasks(); - this.addObserver('[email protected]', this, 'onTaskStatusChange'); - this.onTaskStatusChange(); + var self = this; + this.initData().done(function () { + self.clearStep(); + self.loadTasks(); + self.addObserver('[email protected]', self, 'onTaskStatusChange'); + self.onTaskStatusChange(); + }); }, initData: function () { - this.loadMasterComponentHosts(); - this.loadFailedTask(); - this.loadHdfsClientHosts(); + var self = this, + dfd = $.Deferred(); + this.loadMasterComponentHosts().done(function () { + self.loadFailedTask(); + self.loadHdfsClientHosts(); + dfd.resolve(); + }); + return dfd.promise(); }, setCommandsAndTasks: function(tmpTasks) { http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js index 255e781..dc37cab 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js @@ -189,9 +189,23 @@ App.HighAvailabilityWizardController = App.WizardController.extend({ loadMap: { '1': [ { - type: 'sync', + type: 'async', callback: function () { - this.load('cluster'); + var dfd = $.Deferred(), + self = this, + usersLoadingCallback = function () { + self.saveHdfsUser(); + self.load('cluster'); + dfd.resolve(); + }; + if (App.db.getHighAvailabilityWizardHdfsUser()) { + usersLoadingCallback(); + } else { + this.usersLoading().done(function () { + usersLoadingCallback(); + }); + } + return dfd.promise(); } } ], @@ -203,9 +217,10 @@ App.HighAvailabilityWizardController = App.WizardController.extend({ var self = this; this.loadHosts().done(function () { self.loadServicesFromServer(); - self.loadMasterComponentHosts(); - self.loadHdfsUser(); - dfd.resolve(); + self.loadMasterComponentHosts().done(function () { + self.loadHdfsUser(); + dfd.resolve(); + }); }); return dfd.promise(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js index 4e31569..2bc6e37 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js @@ -77,8 +77,9 @@ App.RAHighAvailabilityWizardController = App.WizardController.extend({ var self = this; this.loadHosts().done(function () { self.loadServicesFromServer(); - self.loadMasterComponentHosts(); - dfd.resolve(); + self.loadMasterComponentHosts().done(function () { + dfd.resolve(); + }); }); return dfd.promise(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js index 963d65e..c88835f 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js @@ -36,6 +36,47 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({ controllerName: 'rMHighAvailabilityWizardController' }), + /** + * Load data for all steps until <code>current step</code> + */ + loadMap: { + '1': [ + { + type: 'sync', + callback: function () { + this.load('cluster'); + } + } + ], + '2': [ + { + type: 'async', + callback: function () { + var self = this, + dfd = $.Deferred(); + this.loadRmHosts(); + this.loadServicesFromServer(); + this.loadMasterComponentHosts().done(function () { + self.loadConfirmedHosts(); + dfd.resolve(); + }); + return dfd.promise(); + } + } + ], + '4': [ + { + type: 'sync', + callback: function () { + this.loadTasksStatuses(); + this.loadTasksRequestIds(); + this.loadRequestIds(); + this.loadConfigs(); + } + } + ] + }, + init: function () { this._super(); this.clearStep(); @@ -89,28 +130,6 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({ }, /** - * Load data for all steps until <code>current step</code> - */ - loadAllPriorSteps: function () { - var step = this.get('currentStep'); - switch (step) { - case '4': - this.loadTasksStatuses(); - this.loadTasksRequestIds(); - this.loadRequestIds(); - this.loadConfigs(); - case '3': - case '2': - this.loadRmHosts(); - this.loadServicesFromServer(); - this.loadMasterComponentHosts(); - this.loadConfirmedHosts(); - case '1': - this.load('cluster'); - } - }, - - /** * Remove all loaded data. * Created as copy for App.router.clearAllSteps */ http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/host/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js index 01da508..38179ea 100644 --- a/ambari-web/app/controllers/main/host/add_controller.js +++ b/ambari-web/app/controllers/main/host/add_controller.js @@ -63,6 +63,56 @@ App.AddHostController = App.WizardController.extend({ }), /** + * Load data for all steps until <code>current step</code> + */ + loadMap: { + '1': [ + { + type: 'sync', + callback: function () { + this.load('hosts'); + this.load('installOptions'); + this.load('cluster'); + } + } + ], + '2': [ + { + type: 'sync', + callback: function () { + this.loadServices(); + } + } + ], + '3': [ + { + type: 'async', + callback: function () { + var self = this, + dfd = $.Deferred(); + this.loadClients(); + this.loadServices(); + this.loadMasterComponentHosts().done(function () { + self.loadSlaveComponentHosts(); + self.load('hosts'); + dfd.resolve(); + }); + return dfd.promise(); + } + } + ], + '5': [ + { + type: 'sync', + callback: function () { + this.loadServiceConfigProperties(); + this.getServiceConfigGroups(); + } + } + ] + }, + + /** * save info about wizard progress, particularly current step of wizard * @param currentStep * @param completed @@ -348,32 +398,6 @@ App.AddHostController = App.WizardController.extend({ } this.set('content.serviceConfigProperties', serviceConfigProperties); }, - /** - * Load data for all steps until <code>current step</code> - */ - loadAllPriorSteps: function () { - var step = this.get('currentStep'); - switch (step) { - case '7': - case '6': - case '5': - this.loadServiceConfigProperties(); - this.getServiceConfigGroups(); - case '4': - case '3': - this.loadClients(); - this.loadServices(); - this.loadMasterComponentHosts(); - this.loadSlaveComponentHosts(); - this.load('hosts'); - case '2': - this.loadServices(); - case '1': - this.load('hosts'); - this.load('installOptions'); - this.load('cluster'); - } - }, /** * Remove all loaded data. http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/service/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js index 6a8c553..6d4f991 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -90,10 +90,11 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { var dfd = $.Deferred(); var self = this; this.loadHosts().done(function () { - self.loadMasterComponentHosts(); - self.load('hosts'); - self.loadRecommendations(); - dfd.resolve(); + self.loadMasterComponentHosts().done(function () { + self.load('hosts'); + self.loadRecommendations(); + dfd.resolve(); + }); }); return dfd.promise(); } @@ -266,9 +267,14 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { * Load master component hosts data for using in required step controllers */ loadMasterComponentHosts: function () { - this._super(); - this.set('content.skipMasterStep', App.StackService.find().filterProperty('isSelected').filterProperty('hasMaster').everyProperty('isInstalled', true)); - this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep') || (this.get('currentStep') == 7 || this.get('currentStep') == 8)); + var self = this, + dfd = $.Deferred(); + this._super().done(function () { + self.set('content.skipMasterStep', App.StackService.find().filterProperty('isSelected').filterProperty('hasMaster').everyProperty('isInstalled', true)); + self.get('isStepDisabled').findProperty('step', 2).set('value', self.get('content.skipMasterStep') || (self.get('currentStep') == 7 || self.get('currentStep') == 8)); + dfd.resolve(); + }); + return dfd.promise(); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/main/service/reassign_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js index da4f65a..07d6e2c 100644 --- a/ambari-web/app/controllers/main/service/reassign_controller.js +++ b/ambari-web/app/controllers/main/service/reassign_controller.js @@ -85,6 +85,66 @@ App.ReassignMasterController = App.WizardController.extend({ 'requestIds' ], + /** + * Load data for all steps until <code>current step</code> + */ + loadMap: { + '1': [ + { + type: 'sync', + callback: function () { + this.loadComponentToReassign(); + this.loadDatabaseType(); + this.loadServiceProperties(); + this.load('cluster'); + } + } + ], + '2': [ + { + type: 'async', + callback: function () { + var self = this, + dfd = $.Deferred(); + this.loadServicesFromServer(); + this.loadMasterComponentHosts().done(function () { + self.loadConfirmedHosts(); + dfd.resolve(); + }); + return dfd.promise(); + } + } + ], + '3': [ + { + type: 'sync', + callback: function () { + this.loadReassignHosts(); + } + } + ], + '4': [ + { + type: 'sync', + callback: function () { + this.loadTasksStatuses(); + this.loadTasksRequestIds(); + this.loadRequestIds(); + this.loadReassignComponentsInMM(); + } + } + ], + '5': [ + { + type: 'sync', + callback: function () { + this.loadSecureConfigs(); + this.loadComponentDir(); + } + } + ] + }, + addManualSteps: function () { var hasManualSteps = this.get('content.componentsWithManualCommands').contains(this.get('content.reassign.component_name')); this.set('content.hasManualSteps', hasManualSteps); @@ -257,36 +317,6 @@ App.ReassignMasterController = App.WizardController.extend({ }, /** - * Load data for all steps until <code>current step</code> - */ - loadAllPriorSteps: function () { - var step = this.get('currentStep'); - switch (step) { - case '7': - case '6': - case '5': - this.loadSecureConfigs(); - this.loadComponentDir(); - case '4': - this.loadTasksStatuses(); - this.loadTasksRequestIds(); - this.loadRequestIds(); - this.loadReassignComponentsInMM(); - case '3': - this.loadReassignHosts(); - case '2': - this.loadServicesFromServer(); - this.loadMasterComponentHosts(); - this.loadConfirmedHosts(); - case '1': - this.loadComponentToReassign(); - this.loadDatabaseType(); - this.loadServiceProperties(); - this.load('cluster'); - } - }, - - /** * Remove all loaded data. * Created as copy for App.router.clearAllSteps */ http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index f0f5ea2..e29c13b 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -1089,24 +1089,43 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM * Load master component hosts data for using in required step controllers */ loadMasterComponentHosts: function () { - var masterComponentHosts = this.getDBProperty('masterComponentHosts'); - var stackMasterComponents = App.get('components.masters').uniq(); - if (!masterComponentHosts) { + var masterComponentHosts = this.getDBProperty('masterComponentHosts'), + self = this, + observerContext = { + setMasterComponentHosts: function () { + if (App.get('router.clusterController.isServiceMetricsLoaded')) { + var stackMasterComponents = App.get('components.masters').uniq(); + App.HostComponent.find().filter(function(component) { + return stackMasterComponents.contains(component.get('componentName')); + }).forEach(function (item) { + masterComponentHosts.push({ + component: item.get('componentName'), + hostName: item.get('hostName'), + isInstalled: true, + serviceId: item.get('service.id'), + display_name: item.get('displayName') + }) + }); + self.setDBProperty('masterComponentHosts', masterComponentHosts); + self.set('content.masterComponentHosts', masterComponentHosts); + self.removeObserver('App.router.clusterController.isServiceMetricsLoaded', this, 'setMasterComponentHosts'); + dfd.resolve(); + } + } + }, + dfd = $.Deferred(); + if (Em.isNone(masterComponentHosts)) { masterComponentHosts = []; - App.HostComponent.find().filter(function(component) { - return stackMasterComponents.contains(component.get('componentName')); - }).forEach(function (item) { - masterComponentHosts.push({ - component: item.get('componentName'), - hostName: item.get('hostName'), - isInstalled: true, - serviceId: item.get('service.id'), - display_name: item.get('displayName') - }) - }); - this.setDBProperty('masterComponentHosts', masterComponentHosts); + if (App.get('router.clusterController.isServiceMetricsLoaded')) { + observerContext.setMasterComponentHosts(); + } else { + this.addObserver('App.router.clusterController.isServiceMetricsLoaded', observerContext, 'setMasterComponentHosts'); + } + } else { + this.set('content.masterComponentHosts', masterComponentHosts); + dfd.resolve(); } - this.set("content.masterComponentHosts", masterComponentHosts); + return dfd.promise(); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/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 21e83ab..4ab36e4 100644 --- a/ambari-web/app/routes/high_availability_routes.js +++ b/ambari-web/app/routes/high_availability_routes.js @@ -96,17 +96,14 @@ module.exports = App.WizardRoute.extend({ step1: Em.Route.extend({ route: '/step1', connectOutlets: function (router) { - var controller = router.get('highAvailabilityWizardController'); + var controller = router.get('highAvailabilityWizardController'), + highAvailabilityWizardStep1Controller = router.get('highAvailabilityWizardStep1Controller'); controller.dataLoading().done(function () { controller.setCurrentStep('1'); - controller.usersLoading().done(function () { - controller.saveHdfsUser(); - var highAvailabilityWizardStep1Controller = router.get('highAvailabilityWizardStep1Controller'); - highAvailabilityWizardStep1Controller.setHawqInstalled(); - controller.loadAllPriorSteps().done(function () { - controller.connectOutlet('highAvailabilityWizardStep1', controller.get('content')); - }); - }) + highAvailabilityWizardStep1Controller.setHawqInstalled(); + controller.loadAllPriorSteps().done(function () { + controller.connectOutlet('highAvailabilityWizardStep1', controller.get('content')); + }); }) }, unroutePath: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/c3e482f7/ambari-web/test/controllers/main/host/add_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/host/add_controller_test.js b/ambari-web/test/controllers/main/host/add_controller_test.js index 1c78da4..c03075f 100644 --- a/ambari-web/test/controllers/main/host/add_controller_test.js +++ b/ambari-web/test/controllers/main/host/add_controller_test.js @@ -1172,150 +1172,6 @@ describe('App.AddHostController', function () { }); }); - /*eslint-disable mocha-cleanup/no-assertions-in-loop*/ - describe("#loadAllPriorSteps()", function () { - var stepsSet = { - '1': [ - { - name: 'load', - args: ['hosts'] - }, - { - name: 'load', - args: ['installOptions'] - }, - { - name: 'load', - args: ['cluster'] - } - ], - '2': [ - { - name: 'loadServices', - args: [] - } - ], - '3': [ - { - name: 'loadClients', - args: [] - }, - { - name: 'loadServices', - args: [] - }, - { - name: 'loadMasterComponentHosts', - args: [] - }, - { - name: 'loadSlaveComponentHosts', - args: [] - }, - { - name: 'load', - args: ['hosts'] - } - ], - '5': [ - { - name: 'loadServiceConfigProperties', - args: [] - }, - { - name: 'getServiceConfigGroups', - args: [] - } - ] - }; - var testCases = [ - { - currentStep: '0', - calledFunctions: [] - }, - { - currentStep: '1', - calledFunctions: stepsSet['1'] - }, - { - currentStep: '2', - calledFunctions: stepsSet['1'].concat(stepsSet['2']) - }, - { - currentStep: '3', - calledFunctions: stepsSet['3'].concat(stepsSet['2'], stepsSet['1']) - }, - { - currentStep: '4', - calledFunctions: stepsSet['3'].concat(stepsSet['2'], stepsSet['1']) - }, - { - currentStep: '5', - calledFunctions: stepsSet['5'].concat(stepsSet['3'], stepsSet['2'], stepsSet[1]) - }, - { - currentStep: '6', - calledFunctions: stepsSet['5'].concat(stepsSet['3'], stepsSet['2'], stepsSet[1]) - }, - { - currentStep: '7', - calledFunctions: stepsSet['5'].concat(stepsSet['3'], stepsSet['2'], stepsSet[1]) - }, - { - currentStep: '8', - calledFunctions: [] - } - ]; - var functionsToCall = [ - 'loadServiceConfigProperties', - 'getServiceConfigGroups', - 'loadClients', - 'loadServices', - 'loadMasterComponentHosts', - 'loadSlaveComponentHosts', - 'load' - ]; - beforeEach(function () { - this.mock = sinon.stub(controller, 'get'); - sinon.stub(controller, 'loadServiceConfigProperties', Em.K); - sinon.stub(controller, 'getServiceConfigGroups', Em.K); - sinon.stub(controller, 'loadClients', Em.K); - sinon.stub(controller, 'loadServices', Em.K); - sinon.stub(controller, 'loadMasterComponentHosts', Em.K); - sinon.stub(controller, 'loadSlaveComponentHosts', Em.K); - sinon.stub(controller, 'load', Em.K); - sinon.stub(controller, 'saveClusterStatus', Em.K); - }); - afterEach(function () { - this.mock.restore(); - controller.loadServiceConfigProperties.restore(); - controller.getServiceConfigGroups.restore(); - controller.loadClients.restore(); - controller.loadServices.restore(); - controller.loadMasterComponentHosts.restore(); - controller.loadSlaveComponentHosts.restore(); - controller.load.restore(); - controller.saveClusterStatus.restore(); - }); - testCases.forEach(function (test) { - it("current step - " + test.currentStep, function () { - this.mock.returns(test.currentStep); - controller.loadAllPriorSteps(); - functionsToCall.forEach(function (fName) { - var callStack = test.calledFunctions.filterProperty('name', fName); - if (callStack.length > 0) { - callStack.forEach(function (f, index) { - expect(controller[f.name].getCall(index).args).to.eql(f.args); - }, this); - } else { - expect(controller[fName].called).to.be.false; - } - }, this); - }); - }, this); - }); - /*eslint-enable mocha-cleanup/no-assertions-in-loop*/ - describe("#clearAllSteps()", function () { beforeEach(function () { sinon.stub(controller, 'clearInstallOptions', Em.K);
