incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: AMBARI-2991. NameNode HA Wizard: Prompt for Nameservice ID in Get Started page. (Aleksandr Kovalenko)
Date Thu, 22 Aug 2013 17:20:33 GMT
Updated Branches:
  refs/heads/trunk 758bbc1ac -> 20a73bf9d


AMBARI-2991. NameNode HA Wizard: Prompt for Nameservice ID in Get Started page. (Aleksandr
Kovalenko)


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

Branch: refs/heads/trunk
Commit: 20a73bf9ddeb6c26500a5d81dda959539a1c768a
Parents: 758bbc1
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Thu Aug 22 10:19:56 2013 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Thu Aug 22 10:20:25 2013 -0700

----------------------------------------------------------------------
 .../admin/highAvailability/step1_controller.js  | 13 ++++++++++-
 .../admin/highAvailability/step5_controller.js  | 19 ++++++++--------
 .../admin/highAvailability/wizard_controller.js | 14 +++++++++++-
 ambari-web/app/messages.js                      |  3 +++
 .../app/routes/high_availability_routes.js      |  2 ++
 ambari-web/app/styles/application.less          |  5 +++++
 .../main/admin/highAvailability/step1.hbs       | 23 +++++++++++++++-----
 ambari-web/app/utils/db.js                      | 11 ++++++++++
 .../main/admin/highAvailability/step1_view.js   |  7 +++++-
 9 files changed, 79 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/controllers/main/admin/highAvailability/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step1_controller.js
index 5e22cb5..bb875c5 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/step1_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/step1_controller.js
@@ -21,6 +21,17 @@ var App = require('app');
 require('controllers/main/admin/misc_controller');
 
 App.HighAvailabilityWizardStep1Controller = App.MainAdminMiscController.extend({
-  name:"highAvailabilityWizardStep1Controller"
+  name: "highAvailabilityWizardStep1Controller",
+
+  isNameServiceIdValid: function () {
+    return /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])$/.test(this.get('content.nameServiceId'));
+  }.property('content.nameServiceId'),
+
+  next: function () {
+    if (this.get('isNameServiceIdValid')) {
+      App.router.send('next');
+    }
+  }
+
 });
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js
index 255b460..74ec3dd 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/step5_controller.js
@@ -105,23 +105,24 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
     var newNameNodeHost = this.get('content.masterComponentHosts').findProperty('isAddNameNode').hostName;
     var journalNodeHosts = this.get('content.masterComponentHosts').filterProperty('component',
'JOURNALNODE').mapProperty('hostName');
     var zooKeeperHosts = this.get('content.masterComponentHosts').filterProperty('component',
'ZOOKEEPER_SERVER').mapProperty('hostName');
+    var nameServiceId = this.get('content.nameServiceId');
 
     //hdfs-site configs changes
-    hdfsSiteProperties['dfs.nameservices'] = 'mycluster';
-    hdfsSiteProperties['dfs.ha.namenodes.mycluster'] = 'nn1,nn2';
-    hdfsSiteProperties['dfs.namenode.rpc-address.mycluster.nn1'] = currentNameNodeHost +
':8020';
-    hdfsSiteProperties['dfs.namenode.rpc-address.mycluster.nn2'] = newNameNodeHost + ':8020';
-    hdfsSiteProperties['dfs.namenode.http-address.mycluster.nn1'] = currentNameNodeHost +
':50070';
-    hdfsSiteProperties['dfs.namenode.http-address.mycluster.nn2'] = newNameNodeHost + ':50070';
-    hdfsSiteProperties['dfs.namenode.shared.edits.dir'] = 'qjournal://' + journalNodeHosts[0]
+ ':8485;' + journalNodeHosts[1] + ':8485;' + journalNodeHosts[2] + ':8485/mycluster';
-    hdfsSiteProperties['dfs.client.failover.proxy.provider.mycluster'] = 'org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider';
+    hdfsSiteProperties['dfs.nameservices'] = nameServiceId;
+    hdfsSiteProperties['dfs.ha.namenodes.' + nameServiceId] = 'nn1,nn2';
+    hdfsSiteProperties['dfs.namenode.rpc-address.' + nameServiceId + '.nn1'] = currentNameNodeHost
+ ':8020';
+    hdfsSiteProperties['dfs.namenode.rpc-address.' + nameServiceId + '.nn2'] = newNameNodeHost
+ ':8020';
+    hdfsSiteProperties['dfs.namenode.http-address.' + nameServiceId + '.nn1'] = currentNameNodeHost
+ ':50070';
+    hdfsSiteProperties['dfs.namenode.http-address.' + nameServiceId + '.nn2'] = newNameNodeHost
+ ':50070';
+    hdfsSiteProperties['dfs.namenode.shared.edits.dir'] = 'qjournal://' + journalNodeHosts[0]
+ ':8485;' + journalNodeHosts[1] + ':8485;' + journalNodeHosts[2] + ':8485/' + nameServiceId;
+    hdfsSiteProperties['dfs.client.failover.proxy.provider.' + nameServiceId] = 'org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider';
     hdfsSiteProperties['dfs.ha.fencing.methods'] = 'shell(/bin/true)';
     hdfsSiteProperties['dfs.journalnode.edits.dir'] = '/grid/0/hdfs/journal';
     hdfsSiteProperties['dfs.ha.automatic-failover.enabled'] = 'true';
 
     //core-site configs changes
     coreSiteProperties['ha.zookeeper.quorum'] = zooKeeperHosts[0] + ':2181,' + zooKeeperHosts[1]
+ ':2181,' + zooKeeperHosts[2] + ':2181';
-    coreSiteProperties['fs.defaultFS'] = 'hdfs://mycluster';
+    coreSiteProperties['fs.defaultFS'] = 'hdfs://' + nameServiceId;
     this.set('configsSaved', false);
     App.ajax.send({
       name: 'admin.high_availability.save_configs',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
index dd24785..e025a36 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js
@@ -38,7 +38,8 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
     slaveComponentHosts: null,
     masterComponentHosts: null,
     serviceName: 'MISC',
-    hdfsUser:"hdfs"
+    hdfsUser:"hdfs",
+    nameServiceId: ''
   }),
 
   /**
@@ -172,6 +173,16 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
     this.set('content.requestIds', requestIds);
   },
 
+  saveNameServiceId: function(nameServiceId){
+    App.db.setHighAvailabilityWizardNameServiceId(nameServiceId);
+    this.set('content.nameServiceId', nameServiceId);
+  },
+
+  loadNameServiceId: function(){
+    var nameServiceId = App.db.getHighAvailabilityWizardNameServiceId();
+    this.set('content.nameServiceId', nameServiceId);
+  },
+
   /**
    * Load data for all steps until <code>current step</code>
    */
@@ -183,6 +194,7 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
       case '7':
       case '6':
       case '5':
+        this.loadNameServiceId();
         this.loadTasksStatuses();
         this.loadRequestIds();
       case '4':

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 523e667..cda511c 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -649,6 +649,9 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.progressPage.notice.failed':'You can click on the Retry
button to retry failed tasks.',
   'admin.highAvailability.wizard.progressPage.header':'Deploy',
   'admin.highAvailability.wizard.step1.header':'Get Started',
+  'admin.highAvailability.wizard.step1.nameserviceid.tooltip.title':'Nameservice ID',
+  'admin.highAvailability.wizard.step1.nameserviceid.tooltip.content':'This will be the ID
for the NameNode HA cluster. For example, if you set Nameservice ID to <b>mycluster</b>,
the logical URI for HDFS will be <b>hdfs://mycluster</b>.',
+  'admin.highAvailability.wizard.step1.nameserviceid':'Nameservice ID',
   'admin.highAvailability.wizard.step2.header':'Select Hosts',
   'admin.highAvailability.wizard.step3.header':'Review',
   'admin.highAvailability.wizard.step4.header':'Create Checkpoint',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/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 0becf5e..9d45583 100644
--- a/ambari-web/app/routes/high_availability_routes.js
+++ b/ambari-web/app/routes/high_availability_routes.js
@@ -73,6 +73,8 @@ module.exports = Em.Route.extend({
       })
     },
     next: function (router) {
+      var controller = router.get('highAvailabilityWizardController');
+      controller.saveNameServiceId(router.get('highAvailabilityWizardStep1Controller.content.nameServiceId'));
       router.transitionTo('step2');
     }
   }),

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index e65c9da..16d84df 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -475,6 +475,11 @@ h1 {
       margin-left: 0;
     }
   }
+  #ha-step1 {
+    .nameserviceid-input {
+      display: inline-block;
+    }
+  }
 }
 
 #stack-upgrade {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/templates/main/admin/highAvailability/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/step1.hbs b/ambari-web/app/templates/main/admin/highAvailability/step1.hbs
index 5eca055..cc592d1 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/step1.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/step1.hbs
@@ -15,11 +15,22 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
+<div id="ha-step1">
+  <h2>{{t admin.highAvailability.wizard.step1.header}}</h2>
 
-<h2>{{t admin.highAvailability.wizard.step1.header}}</h2>
-<p class="alert alert-info">
-  {{t admin.highAvailability.wizard.step1.body}}
-</p>
-<div class="btn-area">
-  <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
+  <p class="alert alert-info">
+    {{t admin.highAvailability.wizard.step1.body}}
+  </p>
+
+  <div {{bindAttr class=":control-group view.showInputError:error :form-horizontal :nameserviceid-input"}}
rel="popover" {{translateAttr title="admin.highAvailability.wizard.step1.nameserviceid.tooltip.title"
+       data-content="admin.highAvailability.wizard.step1.nameserviceid.tooltip.content"}}>
+    <label class="control-label">{{t admin.highAvailability.wizard.step1.nameserviceid}}:</label>
+
+    <div class="controls">
+      {{view Ember.TextField valueBinding="content.nameServiceId"}}
+    </div>
+  </div>
+  <div class="btn-area">
+    <a {{bindAttr class=":btn controller.isNameServiceIdValid::disabled :btn-success :pull-right"}}
{{action next target="controller"}}>{{t common.next}} &rarr;</a>
+  </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index 2cfff1d..b9ac072 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -362,6 +362,12 @@ App.db.setHighAvailabilityWizardRequestIds = function (requestIds) {
   localStorage.setObject('ambari', App.db.data);
 };
 
+App.db.setHighAvailabilityWizardNameServiceId = function (nameServiceId) {
+  App.db.data = localStorage.getObject('ambari');
+  App.db.data.HighAvailabilityWizard.nameServiceId = nameServiceId;
+  localStorage.setObject('ambari', App.db.data);
+};
+
 /*
  *  getter methods
  */
@@ -585,4 +591,9 @@ App.db.getHighAvailabilityWizardRequestIds = function () {
   return App.db.data.HighAvailabilityWizard.requestIds;
 };
 
+App.db.getHighAvailabilityWizardNameServiceId = function () {
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.HighAvailabilityWizard.nameServiceId;
+};
+
 module.exports = App.db;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/20a73bf9/ambari-web/app/views/main/admin/highAvailability/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/step1_view.js b/ambari-web/app/views/main/admin/highAvailability/step1_view.js
index 31b8ee6..7dc8bea 100644
--- a/ambari-web/app/views/main/admin/highAvailability/step1_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/step1_view.js
@@ -24,7 +24,12 @@ App.HighAvailabilityWizardStep1View = Em.View.extend({
   templateName: require('templates/main/admin/highAvailability/step1'),
 
   didInsertElement: function() {
+    App.popover($("[rel=popover]"), {'placement': 'right', 'trigger': 'hover'});
     this.get('controller').loadUsers();
-  }
+  },
+
+  showInputError: function () {
+    return !this.get('controller.isNameServiceIdValid') && this.get('controller.content.nameServiceId').length;
+  }.property('controller.isNameServiceIdValid', 'controller.nameServiceId')
 
 });


Mime
View raw message