ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [07/41] ambari git commit: AMBARI-18981 - Manage JournalNodes Wizard: Display only the steps needed for DELETE ONLY task (rzang)
Date Wed, 07 Dec 2016 21:17:52 GMT
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/353b2ac0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/353b2ac0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/353b2ac0

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 353b2ac0064e0d014ace50acba12c523491782a8
Parents: e88f846
Author: Richard Zang <rzang@apache.org>
Authored: Mon Dec 5 18:11:12 2016 -0800
Committer: Richard Zang <rzang@apache.org>
Committed: Mon Dec 5 18:11:12 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     | 13 +++++----
 .../highAvailability/journalNode/step2_view.js  |  5 ++--
 5 files changed, 30 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/353b2ac0/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/353b2ac0/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/353b2ac0/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 e13a338..90b45b0 100644
--- a/ambari-web/app/routes/manage_journalnode_routes.js
+++ b/ambari-web/app/routes/manage_journalnode_routes.js
@@ -118,7 +118,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');
@@ -167,7 +167,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/353b2ac0/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 844e1c8..a4c2155 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/journalNode/wizard.hbs
@@ -22,13 +22,12 @@
             <ul class="nav nav-pills nav-stacked">
                 <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled view.isStep1Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep1 target="controller"}}><i class="step-marker"><span
class="step-index">1</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step1.header}}</p></a></li>
                 <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled view.isStep2Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep2 target="controller"}}><i class="step-marker"><span
class="step-index">2</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step2.header}}</p></a></li>
-                <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled view.isStep3Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep3 target="controller"}}><i class="step-marker"><span
class="step-index">3</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step3.header}}</p></a></li>
-                <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled view.isStep4Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep4 target="controller"}}><i class="step-marker"><span
class="step-index">4</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step4.header}}</p></a></li>
-                <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled view.isStep5Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep5 target="controller"}}><i class="step-marker"><span
class="step-index">5</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step5.header}}</p></a></li>
-                <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled view.isStep6Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep6 target="controller"}}><i class="step-marker"><span
class="step-index">6</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step6.header}}</p></a></li>
-                <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled view.isStep7Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep5 target="controller"}}><i class="step-marker"><span
class="step-index">7</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step7.header}}</p></a></li>
-                <li {{bindAttr class="isStep8:active view.isStep8Disabled:disabled view.isStep8Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep6 target="controller"}}><i class="step-marker"><span
class="step-index">8</span></i><p class="step-name">{{t admin.manageJournalNode.wizard.step8.header}}</p></a></li>
-
+                <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled view.isStep3Completed:completed
isDeleteOnly:hidden"}}><a href="javascript:void(null);"  {{action gotoStep3 target="controller"}}><i
class="step-marker"><span class="step-index">3</span></i><p class="step-name">{{t
admin.manageJournalNode.wizard.step3.header}}</p></a></li>
+                <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled view.isStep4Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep4 target="controller"}}><i class="step-marker"><span
class="step-index">{{#if isDeleteOnly}}3{{else}}4{{/if}}</span></i><p class="step-name">{{t
admin.manageJournalNode.wizard.step4.header}}</p></a></li>
+                <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled view.isStep5Completed:completed
isDeleteOnly:hidden"}}><a href="javascript:void(null);"  {{action gotoStep5 target="controller"}}><i
class="step-marker"><span class="step-index">5</span></i><p class="step-name">{{t
admin.manageJournalNode.wizard.step5.header}}</p></a></li>
+                <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled view.isStep6Completed:completed
isDeleteOnly:hidden"}}><a href="javascript:void(null);"  {{action gotoStep6 target="controller"}}><i
class="step-marker"><span class="step-index">6</span></i><p class="step-name">{{t
admin.manageJournalNode.wizard.step6.header}}</p></a></li>
+                <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled view.isStep7Completed:completed
isDeleteOnly:hidden"}}><a href="javascript:void(null);"  {{action gotoStep5 target="controller"}}><i
class="step-marker"><span class="step-index">7</span></i><p class="step-name">{{t
admin.manageJournalNode.wizard.step7.header}}</p></a></li>
+                <li {{bindAttr class="isStep8:active view.isStep8Disabled:disabled view.isStep8Completed:completed"}}><a
href="javascript:void(null);"  {{action gotoStep6 target="controller"}}><i class="step-marker"><span
class="step-index">{{#if isDeleteOnly}}4{{else}}8{{/if}}</span></i><p class="step-name">{{t
admin.manageJournalNode.wizard.step8.header}}</p></a></li>
             </ul>
         </div>
         {{outlet}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/353b2ac0/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
 });


Mime
View raw message