Bladeren bron

AMBARI-1327. Add Hosts: Remove existing hosts display

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1441261 13f79535-47bb-0310-9956-ffa450edef68
John Speidel 12 jaren geleden
bovenliggende
commit
77813035ca
3 gewijzigde bestanden met toevoegingen van 23 en 4 verwijderingen
  1. 2 0
      CHANGES.txt
  2. 20 4
      ambari-web/app/controllers/wizard/step2_controller.js
  3. 1 0
      ambari-web/app/messages.js

+ 2 - 0
CHANGES.txt

@@ -38,6 +38,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
  
+ AMBARI-1327. Add Hosts. Remove existig hosts display. (Alexandr Antonenko via jspeidel)
+
  AMBARI-1326. Remake clearFilters function in app_view (part 3). (srimanth)
  
  AMBARI-1305. Make sure that Ambari Web renders all elements correctly when

+ 20 - 4
ambari-web/app/controllers/wizard/step2_controller.js

@@ -25,7 +25,7 @@ App.WizardStep2Controller = Em.Controller.extend({
   isPattern: false,
   bootRequestId:  null,
   hasSubmitted: false,
-
+  inputtedAgainHostNames: [],
   hostNames: function () {
     return this.get('content.installOptions.hostNames');
   }.property('content.installOptions.hostNames'),
@@ -54,11 +54,14 @@ App.WizardStep2Controller = Em.Controller.extend({
   updateHostNameArr: function(){
     this.hostNameArr = this.get('hostNames').trim().split(new RegExp("\\s+", "g"));
     this.patternExpression();
+    this.get('inputtedAgainHostNames').clear();
     var installedHostNames = App.Host.find().mapProperty('hostName');
     var tempArr = [];
     for (i = 0; i < this.hostNameArr.length; i++) {
       if (!installedHostNames.contains(this.hostNameArr[i])) {
         tempArr.push(this.hostNameArr[i]);
+      } else {
+        this.get('inputtedAgainHostNames').push(this.hostNameArr[i]);
       }
     }
     this.set('hostNameArr', tempArr);
@@ -164,7 +167,7 @@ App.WizardStep2Controller = Em.Controller.extend({
     this.updateHostNameArr();
 
     if (!this.hostNameArr.length) {
-      this.set('hostsError', Em.I18n.t('installer.step2.hostName.error.required'));
+      this.set('hostsError', Em.I18n.t('installer.step2.hostName.error.already_installed'));
       return false;
     }
 
@@ -173,8 +176,21 @@ App.WizardStep2Controller = Em.Controller.extend({
       this.hostNamePatternPopup(this.hostNameArr);
       return false;
     }
-
-    this.proceedNext();
+    if (this.get('inputtedAgainHostNames').length) {
+      var self = this;
+      App.ModalPopup.show({
+        header: 'Warning',
+        onPrimary: function () {
+          self.proceedNext();
+          this.hide();
+        },
+        bodyClass: Ember.View.extend({
+          template: Ember.Handlebars.compile('<p>These hosts are already installed on the cluster and will be ignored:</p><p>' + self.get('inputtedAgainHostNames').join(', ') + '</p><p>Do you want to continue?</p>')
+        })
+      });
+    } else {
+      this.proceedNext();
+    }
   },
   /**
    * check is there a pattern expression in host name textarea

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

@@ -76,6 +76,7 @@ Em.I18n.translations = {
   'installer.step2.hostPattern.tooltip.title':'Pattern Expressions',
   'installer.step2.hostPattern.tooltip.content':'You can use pattern expressions to specify a number of target hosts. For example, to specify host01.domain thru host10.domain, enter host[01-10].domain in the target hosts textarea.',
   'installer.step2.hostName.error.required':'You must specify at least one host name',
+  'installer.step2.hostName.error.already_installed':'all these hosts are already installed',
   'installer.step2.hostName.error.notRequired':'Host Names will be ignored if not using SSH to automatically configure hosts',
   'installer.step2.hostName.error.invalid':'Invalid Host Name(s)',
   'installer.step2.hostName.pattern.header':'Host name pattern expressions',