You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/07/18 16:52:19 UTC

git commit: AMBARI-6540. RM HA: Create Step2. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 366bcbb69 -> 5d3d25f27


AMBARI-6540. RM HA: Create Step2. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 5d3d25f2744485eda6207f7876c3e47cb6e0de04
Parents: 366bcbb
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jul 18 17:47:20 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jul 18 17:51:47 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/app.js                           |  4 +-
 .../nameNode/wizard_controller.js               | 43 -----------
 .../resourceManager/step2_controller.js         | 30 +++++++-
 .../resourceManager/wizard_controller.js        | 17 +++++
 .../main/service/reassign_controller.js         | 43 -----------
 ambari-web/app/controllers/wizard.js            | 45 +++++++++++-
 .../app/controllers/wizard/step5_controller.js  | 10 ++-
 ambari-web/app/messages.js                      |  1 +
 .../app/models/stack_service_component.js       |  9 +--
 .../app/routes/rm_high_availability_routes.js   |  1 +
 ambari-web/app/styles/application.less          |  6 ++
 .../highAvailability/resourceManager/step2.hbs  | 76 ++++++++++++++++++--
 .../highAvailability/resourceManager/wizard.hbs |  2 +-
 .../resourceManager/step2_view.js               |  2 +-
 14 files changed, 184 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index b4e3657..4f209b7 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -161,8 +161,8 @@ module.exports = Em.Application.create({
       return App.StackServiceComponent.find().filterProperty('isMasterAddableInstallerWizard', true).mapProperty('componentName')
     }.property('App.router.clusterController.isLoaded'),
 
-    addableMasterHaWizard: function () {
-      return App.StackServiceComponent.find().filterProperty('isMasterWithMultipleInstancesHaWizard', true).mapProperty('componentName')
+    multipleMasters: function () {
+      return App.StackServiceComponent.find().filterProperty('isMasterWithMultipleInstances', true).mapProperty('componentName')
     }.property('App.router.clusterController.isLoaded'),
 
     slaves: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
index 22791bf..f876c4f 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
@@ -63,49 +63,6 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
   },
 
   /**
-   * Load services data from server.
-   */
-  loadServicesFromServer: function() {
-    var services = this.getDBProperty('services');
-    if (!services) {
-      services = {
-        selectedServices: [],
-        installedServices: []
-      };
-      App.StackService.find().forEach(function(item){
-        var isInstalled = App.Service.find().someProperty('id', item.get('serviceName'));
-        item.set('isSelected', isInstalled);
-        item.set('isInstalled', isInstalled);
-        if (isInstalled) {
-          services.selectedServices.push(item.get('serviceName'));
-          services.installedServices.push(item.get('serviceName'));
-        }
-      },this);
-      this.setDBProperty('services',services);
-    } else {
-      App.StackService.find().forEach(function(item) {
-        var isSelected =   services.selectedServices.contains(item.get('serviceName'));
-        var isInstalled = services.installedServices.contains(item.get('serviceName'));
-        item.set('isSelected', isSelected);
-        item.set('isInstalled', isInstalled);
-      },this);
-    }
-    this.set('content.services', App.StackService.find());
-  },
-
-  /**
-   * Load confirmed hosts.
-   * Will be used at <code>Assign Masters(step5)</code> step
-   */
-  loadConfirmedHosts: function () {
-    var hosts = App.db.getHosts();
-
-    if (hosts) {
-      this.set('content.hosts', hosts);
-      console.log('ReassignMasterController.loadConfirmedHosts: loaded hosts', hosts);
-    }
-  },
-  /**
    * save status of the cluster.
    * @param clusterStatus object with status,requestId fields.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step2_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step2_controller.js
index e2a6546..7231eb3 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step2_controller.js
@@ -18,7 +18,33 @@
 
 var App = require('app');
 
-App.RMHighAvailabilityWizardStep2Controller = Em.Controller.extend({
-  name:"rMHighAvailabilityWizardStep2Controller"
+App.RMHighAvailabilityWizardStep2Controller = App.WizardStep5Controller.extend({
+  name: "rMHighAvailabilityWizardStep2Controller",
+
+  loadStep: function () {
+    this._super();
+    this.hideUnusedComponents();
+  },
+
+  renderComponents: function (masterComponents) {
+    var existedRM = masterComponents.findProperty('component_name', 'RESOURCEMANAGER');
+    existedRM.isAdditional = false;
+    var additionalRM = $.extend({}, existedRM, {
+      isInstalled: false,
+      isAdditional: true,
+      selectedHost: this.get('hosts').mapProperty('host_name').without(existedRM.selectedHost)[0]
+    });
+    masterComponents.push(additionalRM);
+    this._super(masterComponents);
+  },
+
+  /**
+   * Remove service masters, that should be hidden in this wizard
+   */
+  hideUnusedComponents: function () {
+    var servicesMasters = this.get('servicesMasters');
+    servicesMasters = servicesMasters.filterProperty('component_name', 'RESOURCEMANAGER');
+    this.set('servicesMasters', servicesMasters);
+  }
 });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
index a2a4be7..3cf08ed 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js
@@ -40,6 +40,23 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({
   },
 
   /**
+   * Load data for all steps until <code>current step</code>
+   */
+  loadAllPriorSteps: function () {
+    var step = this.get('currentStep');
+    switch (step) {
+      case '4':
+      case '3':
+      case '2':
+        this.loadServicesFromServer();
+        this.loadMasterComponentHosts();
+        this.loadConfirmedHosts();
+      case '1':
+        this.load('cluster');
+    }
+  },
+
+  /**
    * Remove all loaded data.
    * Created as copy for App.router.clearAllSteps
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/controllers/main/service/reassign_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js
index 8e2feca..5a6ba25 100644
--- a/ambari-web/app/controllers/main/service/reassign_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign_controller.js
@@ -132,49 +132,6 @@ App.ReassignMasterController = App.WizardController.extend({
   },
 
   /**
-   * Load services data from server.
-   */
-  loadServicesFromServer: function () {
-    var services = this.getDBProperty('services');
-    if (!services) {
-      services = {
-        selectedServices: [],
-        installedServices: []
-      };
-      App.StackService.find().forEach(function(item){
-        var isInstalled = App.Service.find().someProperty('id', item.get('serviceName'));
-        item.set('isSelected', isInstalled);
-        item.set('isInstalled', isInstalled);
-        if (isInstalled) {
-          services.selectedServices.push(item.get('serviceName'));
-          services.installedServices.push(item.get('serviceName'));
-        }
-      },this);
-      this.setDBProperty('services',services);
-    } else {
-      App.StackService.find().forEach(function(item) {
-        var isSelected =   services.selectedServices.contains(item.get('serviceName'));
-        var isInstalled = services.installedServices.contains(item.get('serviceName'));
-        item.set('isSelected', isSelected);
-        item.set('isInstalled', isInstalled);
-      },this);
-    }
-    this.set('content.services', App.StackService.find());
-  },
-
-  /**
-   * Load confirmed hosts.
-   * Will be used at <code>Assign Masters(step5)</code> step
-   */
-  loadConfirmedHosts: function () {
-    var hosts = App.db.getHosts();
-
-    if (hosts) {
-      this.set('content.hosts', hosts);
-    }
-    console.log('ReassignMasterController.loadConfirmedHosts: loaded hosts', hosts);
-  },
-  /**
    * Load tasks statuses for step5 of Reassign Master Wizard to restore installation
    */
   loadTasksStatuses: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index e2ba26d..efc3b9e 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1021,5 +1021,48 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
    */
   getCluster: function () {
     return jQuery.extend({}, this.get('clusterStatusTemplate'), {name: App.router.getClusterName()});
+  },
+
+  /**
+   * Load services data from server.
+   */
+  loadServicesFromServer: function () {
+    var services = this.getDBProperty('services');
+    if (!services) {
+      services = {
+        selectedServices: [],
+        installedServices: []
+      };
+      App.StackService.find().forEach(function(item){
+        var isInstalled = App.Service.find().someProperty('id', item.get('serviceName'));
+        item.set('isSelected', isInstalled);
+        item.set('isInstalled', isInstalled);
+        if (isInstalled) {
+          services.selectedServices.push(item.get('serviceName'));
+          services.installedServices.push(item.get('serviceName'));
+        }
+      },this);
+      this.setDBProperty('services',services);
+    } else {
+      App.StackService.find().forEach(function(item) {
+        var isSelected =   services.selectedServices.contains(item.get('serviceName'));
+        var isInstalled = services.installedServices.contains(item.get('serviceName'));
+        item.set('isSelected', isSelected);
+        item.set('isInstalled', isInstalled);
+      },this);
+    }
+    this.set('content.services', App.StackService.find());
+  },
+
+  /**
+   * Load confirmed hosts.
+   * Will be used at <code>Assign Masters(step5)</code> step
+   */
+  loadConfirmedHosts: function () {
+    var hosts = App.db.getHosts();
+
+    if (hosts) {
+      this.set('content.hosts', hosts);
+    }
   }
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/controllers/wizard/step5_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js
index f8f14b1..3368d5d 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -64,6 +64,14 @@ App.WizardStep5Controller = Em.Controller.extend({
    * @type {string[]}
    */
   multipleComponents: function () {
+    return App.get('components.multipleMasters');
+  }.property('App.components.multipleMasters'),
+
+  /**
+   * Master components which could be assigned to multiple hosts
+   * @type {string[]}
+   */
+  addableComponents: function () {
     return App.get('components.addableMasterInstallerWizard');
   }.property('App.components.addableMasterInstallerWizard'),
 
@@ -208,7 +216,7 @@ App.WizardStep5Controller = Em.Controller.extend({
     this.clearStep();
     this.renderHostInfo();
     this.renderComponents(this.loadComponents());
-    this.get('multipleComponents').forEach(function (componentName) {
+    this.get('addableComponents').forEach(function (componentName) {
       this.updateComponent(componentName);
     }, this);
     if (!this.get("selectedServicesMasters").filterProperty('isInstalled', false).length) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 78ab353..62c4673 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -980,6 +980,7 @@ Em.I18n.translations = {
       'This allows for an Active-Standby ResourceManager configuration that automatically performs failover.<br/><br/>' +
       '<b>You should plan a cluster maintenance window and prepare for cluster downtime when enabling ResourceManager HA.</b>',
   'admin.rm_highAvailability.wizard.step2.header': 'Select Host',
+  'admin.rm_highAvailability.wizard.step2.body': 'Select a host that will be running the additional ResourceManager',
   'admin.rm_highAvailability.wizard.step3.header': 'Review',
   'admin.rm_highAvailability.wizard.step4.header': 'Configure Components',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/models/stack_service_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service_component.js b/ambari-web/app/models/stack_service_component.js
index f759194..3f42eb6 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -94,7 +94,7 @@ App.StackServiceComponent = DS.Model.extend({
   }.property('isShownOnInstallerAssignMasterPage','App.isHaEnabled'),
 
   isMasterWithMultipleInstances: function() {
-    var masters = ['ZOOKEEPER_SERVER', 'HBASE_MASTER', 'NAMENODE', 'JOURNALNODE'];
+    var masters = ['ZOOKEEPER_SERVER', 'HBASE_MASTER', 'NAMENODE', 'JOURNALNODE', 'RESOURCEMANAGER'];
     return masters.contains(this.get('componentName'));
   }.property('componentName'),
 
@@ -136,7 +136,7 @@ App.StackServiceComponent = DS.Model.extend({
   // default number of master hosts on Assign Master page:
   defaultNoOfMasterHosts: function() {
     var componentName = this.get('componentName');
-     if (this.get('isMasterWithMultipleInstances')) {
+     if (this.get('isMasterAddableInstallerWizard')) {
        return App.StackServiceComponent.cardinality(componentName).min;
      }
   }.property('componentName'),
@@ -145,11 +145,6 @@ App.StackServiceComponent = DS.Model.extend({
     return App.StackServiceComponent.selectionScheme(this.get('componentName'));
   }.property('componentName'),
 
-  isMasterWithMultipleInstancesHaWizard: function() {
-    var masters = ['NAMENODE', 'JOURNALNODE'];
-    return masters.contains(this.get('componentName'));
-  }.property('componentName'),
-
   // components that are co-hosted with this component
   coHostedComponents: function() {
     var componentName = this.get('componentName');

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/routes/rm_high_availability_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/rm_high_availability_routes.js b/ambari-web/app/routes/rm_high_availability_routes.js
index 85843fe..1c70911 100644
--- a/ambari-web/app/routes/rm_high_availability_routes.js
+++ b/ambari-web/app/routes/rm_high_availability_routes.js
@@ -93,6 +93,7 @@ module.exports = App.WizardRoute.extend({
       var controller = router.get('rMHighAvailabilityWizardController');
       controller.setCurrentStep('2');
       controller.dataLoading().done(function () {
+        controller.loadAllPriorSteps();
         controller.connectOutlet('rMHighAvailabilityWizardStep2', controller.get('content'));
       })
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 604f884..f7d35de 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -6581,3 +6581,9 @@ i.icon-asterisks {
     overflow-y: scroll;
   }
 }
+
+#rm-ha-wizard {
+  .rm-host-select {
+    width: 95%;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step2.hbs
index 5cb85cd..9185fc0 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step2.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step2.hbs
@@ -15,10 +15,78 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-<div>
-  <h2>{{t admin.rm_highAvailability.wizard.step2.header}}</h2>
+<h2>{{t admin.rm_highAvailability.wizard.step2.header}}</h2>
+<div class="alert alert-info">
+  {{t admin.rm_highAvailability.wizard.step2.body}}
+</div>
+{{#if controller.isLoaded}}
+  <div class="assign-masters row-fluid">
+    <div class="select-hosts span7">
+      <div class="row-fluid">
+        <div class="clearfix"></div>
+        <div class="row-fluid">
+          <div class="span12 control-group">
+            <form class="form-horizontal" autocomplete="off">
+              <!-- View for array controller -->
+              {{#each servicesMasters}}
+                <div class="row-fluid">
+                  <div class="span5">
+                    <div class="control-group">
+                      <label class="pts pull-right">
+                        {{#if isAdditional}}
+                          {{t common.additional}}
+                        {{else}}
+                          {{t common.current}}
+                        {{/if}}
+                        {{display_name}}:
+                      </label>
+                    </div>
+                  </div>
+                  <div class="span7">
+                    <div class="control-group">
+                      {{#if view.shouldUseInputs}}
+                        {{view App.InputHostView
+                        componentBinding="this"
+                        disabledBinding="isInstalled" }}
+                      {{else}}
+                        {{view App.SelectHostView
+                        componentBinding="this"
+                        class="rm-host-select"
+                        disabledBinding="isInstalled"
+                        optionValuePath="content.host_name"
+                        optionLabelPath="content.host_info" }}
+                      {{/if}}
+                    </div>
+                  </div>
+                </div>
+              {{/each}}
+            </form>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="host-assignments span5">
+      {{#each masterHostMapping}}
+        <div class="mapping-box round-corners well">
+          <div class="hostString"><span>{{hostInfo}}</span></div>
+          {{#each masterServicesToDisplay}}
+            <span {{bindAttr class="isInstalled:assignedService:newService :round-corners"}}>{{display_name}}</span>
+          {{/each}}
+        </div>
+      {{/each}}
 
-  <div class="btn-area">
-    <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
+      {{#if remainingHosts}}
+        <div class="remaining-hosts round-corners well">
+          <span><strong>{{remainingHosts}}</strong> {{t installer.step5.attention}}</span></div>
+      {{/if}}
+    </div>
+    <div class="clearfix"></div>
   </div>
+{{else}}
+  <div class="spinner"></div>
+{{/if}}
+<div class="btn-area">
+  <a class="btn btn-success pull-right" {{bindAttr disabled="submitDisabled"}} {{action submit target="controller"}}>{{t common.next}} &rarr;</a>
 </div>
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/templates/main/admin/highAvailability/resourceManager/wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/wizard.hbs b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/wizard.hbs
index aeec627..9032d4b 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/wizard.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/wizard.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<div class="wizard">
+<div id="rm-ha-wizard" class="wizard">
   <div class="container">
     <div class="container-fluid">
       <div class="row-fluid">

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d3d25f2/ambari-web/app/views/main/admin/highAvailability/resourceManager/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/resourceManager/step2_view.js b/ambari-web/app/views/main/admin/highAvailability/resourceManager/step2_view.js
index 39df3a9..0c2a7d3 100644
--- a/ambari-web/app/views/main/admin/highAvailability/resourceManager/step2_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/resourceManager/step2_view.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 
-App.RMHighAvailabilityWizardStep2View = Em.View.extend({
+App.RMHighAvailabilityWizardStep2View = App.WizardStep5View.extend({
 
   templateName: require('templates/main/admin/highAvailability/resourceManager/step2')