Updated Branches:
  refs/heads/trunk 08bcffd94 -> 7d968d392

AMBARI-3038. NameNode HA Wizard: Add check to make sure that the checkpoint has 
been created in Create Checkpoint Page. (alexantonenko via yusaku)


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

Branch: refs/heads/trunk
Commit: 7d968d39295cba0475adc6b414f9373388f1784a
Parents: 08bcffd
Author: Yusaku Sako <[email protected]>
Authored: Wed Aug 28 16:03:04 2013 +0300
Committer: Yusaku Sako <[email protected]>
Committed: Wed Aug 28 16:03:04 2013 +0300

----------------------------------------------------------------------
 .../admin/highAvailability/step4_controller.js  | 40 +++++++++++++++++++-
 ambari-web/app/messages.js                      |  1 +
 .../main/admin/highAvailability/step4.hbs       |  4 +-
 ambari-web/app/utils/ajax.js                    |  5 +++
 .../main/admin/highAvailability/step4_view.js   | 15 +++++++-
 5 files changed, 61 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7d968d39/ambari-web/app/controllers/main/admin/highAvailability/step4_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/admin/highAvailability/step4_controller.js 
b/ambari-web/app/controllers/main/admin/highAvailability/step4_controller.js
index 1985aed..37ad4f0 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/step4_controller.js
@@ -22,7 +22,45 @@ require('controllers/main/admin/misc_controller');
 
 App.HighAvailabilityWizardStep4Controller = Em.Controller.extend({
 
-  name:"highAvailabilityWizardStep4Controller"
+  name:"highAvailabilityWizardStep4Controller",
+
+  POLL_INTERVAL: 1000,
+
+  isNextEnabled: false,
+
+  pullCheckPointStatus: function () {
+    var hostName = 
this.get('content.masterComponentHosts').findProperty('isCurNameNode', 
true).hostName;
+    App.ajax.send({
+      name: 'admin.high_availability.getNnCheckPointStatus',
+      sender: this,
+      data: {
+        hostName: hostName
+      },
+      success: 'checkNnCheckPointStatus'
+    });
+  },
+
+  checkNnCheckPointStatus: function (data) {
+    var self = this;
+    var journalTransactionInfo =  
$.parseJSON(data.metrics.dfs.namenode.JournalTransactionInfo);
+    journalTransactionInfo = 
parseInt(journalTransactionInfo.LastAppliedOrWrittenTxId) - 
parseInt(journalTransactionInfo.MostRecentCheckpointTxId);
+    if(journalTransactionInfo <= 1){
+      this.set("isNextEnabled", true);
+      return;
+    }
+
+    window.setTimeout(function () {
+      self.pullCheckPointStatus()
+    }, self.POLL_INTERVAL);
+  },
+
+  done: function () {
+    if (this.get('isNextEnabled')) {
+      App.router.send('next');
+    }
+  }
+
+
 
 })
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7d968d39/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index cd23c90..8c93fef 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -687,6 +687,7 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step3.sn':'Existing Secondary NameNode on {0} 
will be disabled.',
   'admin.highAvailability.wizard.step3.jn':'JournalNode will be installed on 
following hosts:',
   'admin.highAvailability.wizard.step4.ckNotCreated':'Checkpoint not created 
yet',
+  'admin.highAvailability.wizard.step4.ckCreated':'Checkpoint created',
   'admin.highAvailability.wizard.step6.jsNoInit':'JournalNodes not initialized 
yet',
   'admin.highAvailability.wizard.step8.metaNoInit':'Metadata not initialized 
yet',
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7d968d39/ambari-web/app/templates/main/admin/highAvailability/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/step4.hbs 
b/ambari-web/app/templates/main/admin/highAvailability/step4.hbs
index d164ec4..780d79d 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/step4.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/step4.hbs
@@ -21,7 +21,7 @@
     {{{view.step4BodyText}}}
   </p>
   <div class="btn-area">
-    <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} 
&rarr;</a>
-    <span class="pull-right btn-extra-info">{{t 
admin.highAvailability.wizard.step4.ckNotCreated}}</span>
+    <a  {{bindAttr class="controller.isNextEnabled::disabled :btn :btn-success 
:pull-right"}} {{action done target="controller"}}>{{t common.next}} &rarr;</a>
+    <span class="pull-right btn-extra-info">{{view.nnCheckPointText}}</span>
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7d968d39/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 0a300c1..5783ba0 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -606,6 +606,11 @@ var urls = {
     'mock': '',
     'type': 'GET'
   },
+  'admin.high_availability.getNnCheckPointStatus': {
+    'real': 
'/clusters/{clusterName}/hosts/{hostName}/host_components/NAMENODE',
+    'mock': '',
+    'type': 'GET'
+  },
   'admin.high_availability.create_component': {
     'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
     'mock': '',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7d968d39/ambari-web/app/views/main/admin/highAvailability/step4_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/step4_view.js 
b/ambari-web/app/views/main/admin/highAvailability/step4_view.js
index 2e15a72..baaf9e5 100644
--- a/ambari-web/app/views/main/admin/highAvailability/step4_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/step4_view.js
@@ -23,9 +23,22 @@ App.HighAvailabilityWizardStep4View = Em.View.extend({
 
   templateName: require('templates/main/admin/highAvailability/step4'),
 
+  didInsertElement: function() {
+    this.get('controller').pullCheckPointStatus();
+  },
+
   step4BodyText: function () {
     var nN = 
this.get('controller.content.masterComponentHosts').findProperty('isCurNameNode',
 true);
     return 
Em.I18n.t('admin.highAvailability.wizard.step4.body').format(this.get('controller.content.hdfsUser'),
 nN.hostName);
-  }.property('controller.content.masterComponentHosts')
+  }.property('controller.content.masterComponentHosts'),
+
+  nnCheckPointText: function () {
+    var curStatus = this.get('controller.isNextEnabled');
+    if(curStatus){
+      return Em.I18n.t('admin.highAvailability.wizard.step4.ckCreated');
+    }else{
+      return Em.I18n.t('admin.highAvailability.wizard.step4.ckNotCreated');
+    }
+  }.property('controller.isNextEnabled')
 
 });

Reply via email to