瀏覽代碼

AMBARI-6593. Hide Enable RM HA button and menu option after enabling. (akovalenko)

Aleksandr Kovalenko 10 年之前
父節點
當前提交
8ec953d690

+ 12 - 1
ambari-web/app/app.js

@@ -77,7 +77,7 @@ module.exports = Em.Application.create({
   }.property('currentStackVersionNumber'),
 
   /**
-   * If High Availability is enabled
+   * If NameNode High Availability is enabled
    * Based on <code>clusterStatus.isInstalled</code>, stack version, <code>SNameNode</code> availability
    *
    * @type {bool}
@@ -87,6 +87,17 @@ module.exports = Em.Application.create({
     return !this.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE');
   }.property('router.clusterController.isLoaded', 'isHadoop2Stack'),
 
+  /**
+   * If ResourceManager High Availability is enabled
+   * Based on number of ResourceManager components host components installed
+   *
+   * @type {bool}
+   */
+  isRMHaEnabled: function () {
+    if (!this.get('isHadoop2Stack')) return false;
+    return this.HostComponent.find().filterProperty('componentName', 'RESOURCEMANAGER').length > 1;
+  }.property('router.clusterController.isLoaded', 'isHadoop2Stack'),
+
   /**
    * Object with utility functions for list of service names with similar behavior
    */

+ 2 - 1
ambari-web/app/messages.js

@@ -827,6 +827,7 @@ Em.I18n.translations = {
   'admin.highAvailability.disabled':'NameNode HA is disabled',
   'admin.highAvailability.enabled':'NameNode HA is enabled',
   'admin.rm_highAvailability.disabled':'ResourceManager HA is disabled',
+  'admin.rm_highAvailability.enabled':'ResourceManager HA is enabled',
   'admin.highAvailability.confirmRollbackHeader':'Confirm Rollback',
   'admin.highAvailability.confirmRollbackBody':'This will rollback all operations that were done in HA wizard',
   'admin.highAvailability.confirmManualRollbackBody':'You are in the process of enabling NameNode HA. If you exit now, you must follow manual instructions to revert back to the non-HA setup as documented in the Ambari User Guide\'s <i>Rolling Back NameNode HA</i> section.  Are you sure you want to exit the wizard?',
@@ -999,7 +1000,7 @@ Em.I18n.translations = {
   'admin.rm_highAvailability.wizard.step4.task2.title': 'Reconfigure YARN',
   'admin.rm_highAvailability.wizard.step4.task3.title': 'Start All Services',
   'admin.rm_highAvailability.wizard.step4.notice.inProgress':'Please wait while ResourceManager HA is being deployed.',
-  'admin.rm_highAvailability.wizard.step4.notice.completed':'NameNode HA has been enabled successfully.',
+  'admin.rm_highAvailability.wizard.step4.notice.completed':'ResourceManager HA has been enabled successfully.',
 
   'admin.security.title':'Kerberos security has not been enabled',
   'admin.security.enabled': 'Kerberos security is enabled',

+ 11 - 5
ambari-web/app/templates/main/admin/highAvailability.hbs

@@ -40,11 +40,17 @@
     {{/if}}
   {{/if}}
   {{#if App.supports.resourceManagerHighAvailability}}
+    {{#if App.isRMHaEnabled}}
     <div class="rm-ha">
-      <p class="muted">
-        {{t admin.rm_highAvailability.disabled}}
-      </p>
-      <a class="btn btn-padding btn-success ha-btn" {{action enableRMHighAvailability target="controller"}}>{{t admin.rm_highAvailability.button.enable}}</a>
-    </div>
+        <p class="text-success">
+          {{t admin.rm_highAvailability.enabled}}
+        </p>
+    {{else}}
+        <p class="muted">
+          {{t admin.rm_highAvailability.disabled}}
+        </p>
+        <a class="btn btn-padding btn-success ha-btn" {{action enableRMHighAvailability target="controller"}}>{{t admin.rm_highAvailability.button.enable}}</a>
+    {{/if}}
+  </div>
   {{/if}}
 </div>

+ 1 - 1
ambari-web/app/views/main/service/item.js

@@ -78,7 +78,7 @@ App.MainServiceItemView = Em.View.extend({
         action: 'enableRMHighAvailability',
         label: Em.I18n.t('admin.rm_highAvailability.button.enable'),
         cssClass: 'icon-arrow-up',
-        isHidden: !App.get('supports.resourceManagerHighAvailability')
+        isHidden: !App.get('supports.resourceManagerHighAvailability') || App.get('isRMHaEnabled')
       },
       MOVE_COMPONENT: {
         action: 'reassignMaster',