Procházet zdrojové kódy

AMBARI-2814. NameNode HA Wizard: modify prerequisite checks. (atkach via yusaku)

Yusaku Sako před 11 roky
rodič
revize
915f74b292

+ 21 - 9
ambari-web/app/controllers/main/admin/highAvailability_controller.js

@@ -28,18 +28,25 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
   dataIsLoaded: false,
 
   enableHighAvailability: function () {
+    var message = [];
     //Prerequisite Checks
-    if (App.Host.find().content.length < 3) {
-      this.showErrorPopup(Em.I18n.t('admin.highAvailability.error.hostsNum'));
-      return;
-    }
-    if (App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').length < 3) {
-      this.showErrorPopup(Em.I18n.t('admin.highAvailability.error.zooKeeperNum'));
-      return;
-    }
     if (this.get('securityEnabled')) {
       this.showErrorPopup(Em.I18n.t('admin.highAvailability.error.security'));
       return;
+    } else {
+      if (App.Host.find().content.length < 3) {
+        message.push(Em.I18n.t('admin.highAvailability.error.hostsNum'));
+      }
+      if (App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').length < 3) {
+        message.push(Em.I18n.t('admin.highAvailability.error.zooKeeperNum'));
+      }
+      if (App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('workStatus') !== 'STARTED') {
+        message.push(Em.I18n.t('admin.highAvailability.error.namenodeStarted'));
+      }
+      if (message.length > 0) {
+        this.showErrorPopup(message);
+        return;
+      }
     }
     App.router.transitionTo('enableHighAvailability');
   },
@@ -100,10 +107,15 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
   },
 
   showErrorPopup: function (message) {
+    if(Array.isArray(message)){
+      message = message.join('<br/>');
+    } else {
+      message = '<p>' + message + '</p>';
+    }
     App.ModalPopup.show({
       header: Em.I18n.t('common.error'),
       bodyClass: Ember.View.extend({
-        template: Ember.Handlebars.compile('<p>' + message + '</p>')
+        template: Ember.Handlebars.compile(message)
       }),
       onPrimary: function () {
         this.hide();

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

@@ -636,8 +636,9 @@ Em.I18n.translations = {
   'admin.highAvailability.button.enable':'Enable NameNode HA',
   'admin.highAvailability.disabled':'NameNode HA is disabled',
   'admin.highAvailability.enabled':'NameNode HA is enabled',
-  'admin.highAvailability.error.hostsNum':'You must have at least 3 hosts in your cluster to enable NameNode HA',
-  'admin.highAvailability.error.zooKeeperNum':'You must have at least 3 ZooKeeper Servers in your cluster to enable NameNode HA',
+  'admin.highAvailability.error.hostsNum':'You must have at least 3 hosts in your cluster to enable NameNode HA.',
+  'admin.highAvailability.error.namenodeStarted':'NameNode must be running before you enable NameNode HA.',
+  'admin.highAvailability.error.zooKeeperNum':'You must have at least 3 ZooKeeper Servers in your cluster to enable NameNode HA.',
   'admin.highAvailability.error.security':'You cannot enable NameNode HA via this wizard as your cluster is already secured.  First, disable security by going to Admin > Security, and then run this Enable NameNode HA wizard again.  After NameNode HA is enabled, you can go back to Admin > Security to secure the cluster.',
   'admin.highAvailability.wizard.header':'Enable NameNode HA Wizard',
   'admin.highAvailability.wizard.step1.header':'Get Started',