Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 1c89883e8 -> 89bcca4ea


AMBARI-18981 - Manage JournalNodes Wizard: Display only the steps needed for 
DELETE ONLY task (rzang)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/89bcca4e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/89bcca4e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/89bcca4e

Branch: refs/heads/branch-2.5
Commit: 89bcca4ea1e111c15438059f042d92969ff79f34
Parents: 1c89883
Author: Richard Zang <[email protected]>
Authored: Mon Dec 5 18:11:12 2016 -0800
Committer: Richard Zang <[email protected]>
Committed: Mon Dec 5 18:17:56 2016 -0800

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js |  5 ++--
 .../journalNode/wizard_controller.js            | 28 +++++++++++++-------
 .../app/routes/manage_journalnode_routes.js     |  4 +--
 .../highAvailability/journalNode/wizard.hbs     |  8 +++---
 .../highAvailability/journalNode/step2_view.js  |  5 ++--
 5 files changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89bcca4e/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js 
b/ambari-web/app/controllers/global/update_controller.js
index 4631f09..ce93b34 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -249,11 +249,10 @@ App.UpdateController = Em.Controller.extend({
         ]);
       }
       else {
-        // clusterController.isHostsLoaded may be changed in callback, that is 
why it's value is cached before calling callback
-        isHostsLoaded = App.router.get('clusterController.isHostsLoaded');
-        callback();
         // On pages except for hosts/hostDetails, making sure hostsMapper 
loaded only once on page load, no need to update, but at least once
+        isHostsLoaded = App.router.get('clusterController.isHostsLoaded');
         if (isHostsLoaded) {
+          callback();
           return;
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/89bcca4e/ambari-web/app/controllers/main/admin/highAvailability/journalNode/wizard_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/wizard_controller.js
 
b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/wizard_controller.js
index 2305524..fe9a15b 100644
--- 
a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/wizard_controller.js
+++ 
b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/wizard_controller.js
@@ -120,22 +120,30 @@ App.ManageJournalNodeWizardController = 
App.WizardController.extend({
   },
 
   getJournalNodesToAdd: function () {
-    return 
this.get('content.masterComponentHosts').filterProperty('component', 
'JOURNALNODE')
-      .filterProperty('isInstalled', false).mapProperty('hostName');
+    var result = [];
+    var masterComponentHosts = this.get('content.masterComponentHosts');
+    if (masterComponentHosts) {
+      result = masterComponentHosts.filterProperty('component', 
'JOURNALNODE').filterProperty('isInstalled', false).mapProperty('hostName');
+    }
+    return result;
   },
 
   getJournalNodesToDelete: function () {
-    var existingHosts = 
App.HostComponent.find().filterProperty('componentName', 
'JOURNALNODE').mapProperty('hostName');
-    var currentJNs = 
this.get('content.masterComponentHosts').filterProperty('component', 
'JOURNALNODE');
-    var removed = existingHosts.filter(function(host) {
-      return currentJNs.filterProperty('hostName', host).length == 0;
-    });
-    return removed;
+    var result = [];
+    var masterComponentHosts = this.get('content.masterComponentHosts');
+    if (masterComponentHosts) {
+      var currentJNs = masterComponentHosts.filterProperty('component', 
'JOURNALNODE');
+      var existingHosts = 
App.HostComponent.find().filterProperty('componentName', 
'JOURNALNODE').mapProperty('hostName');
+      result = existingHosts.filter(function(host) {
+        return currentJNs.filterProperty('hostName', host).length == 0;
+      });
+    }
+    return result;
   },
 
   isDeleteOnly: function () {
-    return this.getJournalNodesToAdd().length == 0 && 
this.getJournalNodesToDelete().length > 0;
-  },
+    return this.get('currentStep') > 1 && this.getJournalNodesToAdd().length 
== 0 && this.getJournalNodesToDelete().length > 0;
+  }.property('content.masterComponentHosts', 
'App.router.clusterController.isHostsLoaded', 'currentStep'),
 
   /**
    * Save config properties

http://git-wip-us.apache.org/repos/asf/ambari/blob/89bcca4e/ambari-web/app/routes/manage_journalnode_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/manage_journalnode_routes.js 
b/ambari-web/app/routes/manage_journalnode_routes.js
index 50e3ec9..7f004e0 100644
--- a/ambari-web/app/routes/manage_journalnode_routes.js
+++ b/ambari-web/app/routes/manage_journalnode_routes.js
@@ -117,7 +117,7 @@ module.exports = App.WizardRoute.extend({
       controller.saveConfigTag(stepController.get("hdfsSiteTag"));
       
controller.saveNameServiceId(stepController.get('content.nameServiceId'));
       App.set('router.nextBtnClickInProgress', false);
-      if (controller.isDeleteOnly()) {
+      if (controller.get('isDeleteOnly')) {
         router.transitionTo('step4');
       } else {
         router.transitionTo('step3');
@@ -166,7 +166,7 @@ module.exports = App.WizardRoute.extend({
     next: function (router) {
       var controller = router.get('manageJournalNodeWizardController');
       controller.clearTasksData();
-      if (controller.isDeleteOnly()) {
+      if (controller.get('isDeleteOnly')) {
         router.transitionTo('step8');
       } else {
         router.transitionTo('step5');

http://git-wip-us.apache.org/repos/asf/ambari/blob/89bcca4e/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs 
b/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs
index f7ee486..ac8ee41 100644
--- 
a/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs
+++ 
b/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs
@@ -27,11 +27,11 @@
                             <li class="nav-header">{{t 
admin.manageJournalNode.wizard.header}}</li>
                             <li {{bindAttr class="isStep1:active 
view.isStep1Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep1 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step1.header}}</a></li>
                             <li {{bindAttr class="isStep2:active 
view.isStep2Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep2 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step2.header}}</a></li>
-                            <li {{bindAttr class="isStep3:active 
view.isStep3Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep3 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step3.header}}</a></li>
+                            <li {{bindAttr class="isStep3:active 
view.isStep3Disabled:disabled isDeleteOnly:hidden"}}><a 
href="javascript:void(null);"  {{action gotoStep3 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step3.header}}</a></li>
                             <li {{bindAttr class="isStep4:active 
view.isStep4Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep4 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step4.header}}</a></li>
-                            <li {{bindAttr class="isStep5:active 
view.isStep5Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep5 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step5.header}}</a></li>
-                            <li {{bindAttr class="isStep6:active 
view.isStep6Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep6 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step6.header}}</a></li>
-                            <li {{bindAttr class="isStep7:active 
view.isStep7Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep7 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step7.header}}</a></li>
+                            <li {{bindAttr class="isStep5:active 
view.isStep5Disabled:disabled isDeleteOnly:hidden"}}><a 
href="javascript:void(null);"  {{action gotoStep5 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step5.header}}</a></li>
+                            <li {{bindAttr class="isStep6:active 
view.isStep6Disabled:disabled isDeleteOnly:hidden"}}><a 
href="javascript:void(null);"  {{action gotoStep6 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step6.header}}</a></li>
+                            <li {{bindAttr class="isStep7:active 
view.isStep7Disabled:disabled isDeleteOnly:hidden"}}><a 
href="javascript:void(null);"  {{action gotoStep7 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step7.header}}</a></li>
                             <li {{bindAttr class="isStep8:active 
view.isStep8Disabled:disabled"}}><a href="javascript:void(null);"  {{action 
gotoStep8 target="controller"}}>{{t 
admin.manageJournalNode.wizard.step8.header}}</a></li>
                         </ul>
                     </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/89bcca4e/ambari-web/app/views/main/admin/highAvailability/journalNode/step2_view.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/views/main/admin/highAvailability/journalNode/step2_view.js 
b/ambari-web/app/views/main/admin/highAvailability/journalNode/step2_view.js
index 656c487..680daa5 100644
--- a/ambari-web/app/views/main/admin/highAvailability/journalNode/step2_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/journalNode/step2_view.js
@@ -22,18 +22,17 @@ var App = require('app');
 App.ManageJournalNodeWizardStep2View = Em.View.extend({
 
   templateName: 
require('templates/main/admin/highAvailability/journalNode/step2'),
-  aaa: '',
   didInsertElement: function () {
     this.get('controller').loadStep();
   },
 
   journalNodesToAdd: function () {
     return 
App.router.get('manageJournalNodeWizardController').getJournalNodesToAdd();
-  }.property(),
+  }.property('App.router.clusterController.isHostsLoaded'),
 
   journalNodesToDelete: function () {
     return 
App.router.get('manageJournalNodeWizardController').getJournalNodesToDelete();
-  }.property(),
+  }.property('App.router.clusterController.isHostsLoaded'),
 
   isBackButtonVisible: false
 });

Reply via email to