Преглед на файлове

AMBARI-3848. Remove Host JS Error in 'add host wizard'. (xiwang via yusaku)

Yusaku Sako преди 11 години
родител
ревизия
85206b97a6
променени са 2 файла, в които са добавени 16 реда и са изтрити 4 реда
  1. 3 4
      ambari-web/app/controllers/installer.js
  2. 13 0
      ambari-web/app/controllers/main/host/add_controller.js

+ 3 - 4
ambari-web/app/controllers/installer.js

@@ -75,13 +75,12 @@ App.InstallerController = App.WizardController.extend({
    * @param hosts Array of hosts, which we want to delete
    */
   removeHosts: function (hosts) {
-    //todo Replace this code with real logic
-    var DBhosts = this.getDBProperty('hosts');
+    var dbHosts = this.getDBProperty('hosts');
     hosts.forEach(function (_hostInfo) {
       var host = _hostInfo.hostName;
-      delete DBhosts[host];
+      delete dbHosts[host];
     });
-    this.setDBProperty('hosts', DBhosts);
+    this.setDBProperty('hosts', dbHosts);
   },
 
   /**

+ 13 - 0
ambari-web/app/controllers/main/host/add_controller.js

@@ -91,6 +91,19 @@ App.AddHostController = App.WizardController.extend({
     return [];
   },
 
+  /**
+   * Remove host from model. Used at <code>Confirm hosts</code> step
+   * @param hosts Array of hosts, which we want to delete
+   */
+  removeHosts: function (hosts) {
+    var dbHosts = this.getDBProperty('hosts');
+    hosts.forEach(function (_hostInfo) {
+      var host = _hostInfo.hostName;
+      delete dbHosts[host];
+    });
+    this.setDBProperty('hosts', dbHosts);
+  },
+
   /**
    * Load services data from server.
    */