AMBARI-19131. Manage Journalnode Wizard: incorrect number of installed JournalNodes (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9cc66e44 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9cc66e44 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9cc66e44 Branch: refs/heads/branch-feature-AMBARI-18901 Commit: 9cc66e447ced78153c0a23cf0d54044029c6af6d Parents: a85000b Author: Aleksandr Kovalenko <[email protected]> Authored: Wed Dec 7 21:12:48 2016 +0200 Committer: Aleksandr Kovalenko <[email protected]> Committed: Thu Dec 8 13:09:32 2016 +0200 ---------------------------------------------------------------------- .../journalNode/step1_controller.js | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9cc66e44/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js index b6ffe5b..e1252b7 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js @@ -28,8 +28,6 @@ App.ManageJournalNodeWizardStep1Controller = Em.Controller.extend(App.BlueprintM mastersToShow: ['JOURNALNODE'], - mastersToAdd: [], - showInstalledMastersFirst: true, JOURNALNODES_COUNT_MINIMUM: 3, // TODO get this from stack @@ -41,14 +39,9 @@ App.ManageJournalNodeWizardStep1Controller = Em.Controller.extend(App.BlueprintM * @param masterComponents */ renderComponents: function(masterComponents) { - var jns = App.HostComponent.find().filterProperty('componentName', 'JOURNALNODE'); - var count = jns.get('length'); - this.set('mastersToAdd', []); - if (masterComponents.filterProperty('component_name', 'JOURNALNODE').length == 0) { - for (var i = 0; i < count; i++) { - this.get('mastersToAdd').push('JOURNALNODE'); - } - } + //check if we are restoring components assignment by checking existing of JOURNALNODE component in array + var restoringComponents = masterComponents.someProperty('component_name', 'JOURNALNODE'); + masterComponents = restoringComponents ? masterComponents : masterComponents.concat(this.generateJournalNodeComponents()); this._super(masterComponents); this.updateJournalNodeInfo(); this.showHideJournalNodesAddRemoveControl(); @@ -56,6 +49,19 @@ App.ManageJournalNodeWizardStep1Controller = Em.Controller.extend(App.BlueprintM }, /** + * Create JOURNALNODE components to add them to masters array + */ + generateJournalNodeComponents: function () { + var journalNodes = []; + App.HostComponent.find().filterProperty('componentName', 'JOURNALNODE').forEach(function (jn) { + var jnComponent = this.createComponentInstallationObject(Em.Object.create({serviceName: jn.get('service.serviceName'), componentName: jn.get('componentName')}), jn.get('hostName')); + jnComponent.isInstalled = true; + journalNodes.push(jnComponent); + }, this); + return journalNodes; + }, + + /** * Enable/Disable show/hide operation for each JournalNode */ showHideJournalNodesAddRemoveControl: function() {
