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 2016/06/08 18:50:42 UTC

ambari git commit: AMBARI-17119. While enabling RM HA, selecting additional host gives error (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk e241afcf8 -> 56fc6ee14


AMBARI-17119. While enabling RM HA, selecting additional host gives error (akovalenko)


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

Branch: refs/heads/trunk
Commit: 56fc6ee143e45e4bd30dd9902f156e825d6fdd81
Parents: e241afc
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Jun 8 17:34:33 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Jun 8 21:50:21 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/mixins.js                        |  1 +
 .../app/mixins/wizard/wizardHostsLoading.js     | 77 ++++++++++++++++++++
 .../hawq/activateStandby/wizard_view.js         | 46 +-----------
 .../hawq/addStandby/wizard_view.js              | 47 +-----------
 .../hawq/removeStandby/wizard_view.js           | 46 +-----------
 .../resourceManager/wizard_view.js              | 48 +-----------
 .../resourceManager/wizard_view_test.js         |  9 ++-
 7 files changed, 91 insertions(+), 183 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 05f2421..b27751b 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -49,6 +49,7 @@ require('mixins/wizard/selectHost');
 require('mixins/wizard/addSecurityConfigs');
 require('mixins/wizard/wizard_menu_view');
 require('mixins/wizard/assign_master_components');
+require('mixins/wizard/wizardHostsLoading');
 require('mixins/common/configs/config_recommendations');
 require('mixins/common/configs/config_recommendation_parser');
 require('mixins/common/configs/config_with_override_recommendation_parser');

http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/app/mixins/wizard/wizardHostsLoading.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardHostsLoading.js b/ambari-web/app/mixins/wizard/wizardHostsLoading.js
new file mode 100644
index 0000000..93dab02
--- /dev/null
+++ b/ambari-web/app/mixins/wizard/wizardHostsLoading.js
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+/**
+ * Mixin for loading hosts info in wizards
+ * @type {Ember.Mixin}
+ */
+App.WizardHostsLoading = Em.Mixin.create({
+
+
+  /**
+   * @type {boolean}
+   * @default false
+   */
+  isLoaded: false,
+
+  willInsertElement: function() {
+    this.set('isLoaded', false);
+    this.loadHosts();
+  },
+
+  /**
+   * load hosts from server
+   */
+  loadHosts: function () {
+    return App.ajax.send({
+      name: 'hosts.high_availability.wizard',
+      data: {},
+      sender: this,
+      success: 'loadHostsSuccessCallback',
+      error: 'loadHostsErrorCallback'
+    });
+  },
+
+  loadHostsSuccessCallback: function (data, opt, params) {
+    var hosts = {};
+
+    data.items.forEach(function (item) {
+      hosts[item.Hosts.host_name] = {
+        name: item.Hosts.host_name,
+        cpu: item.Hosts.cpu_count,
+        memory: item.Hosts.total_mem,
+        disk_info: item.Hosts.disk_info,
+        bootStatus: "REGISTERED",
+        isInstalled: true,
+        maintenance_state: item.Hosts.maintenance_state
+      };
+    });
+    App.db.setHosts(hosts);
+    this.set('controller.content.hosts', hosts);
+    this.set('isLoaded', true);
+  },
+
+  loadHostsErrorCallback: function(){
+    this.set('isLoaded', true);
+  }
+
+});
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
index 068e78a..3cea254 100644
--- a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 
-App.ActivateHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
+App.ActivateHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, App.WizardHostsLoading, {
 
   didInsertElement: function() {
     var currentStep = this.get('controller.currentStep');
@@ -28,47 +28,5 @@ App.ActivateHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
     }
   },
 
-  templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/wizard'),
-
-  isLoaded: false,
-
-  willInsertElement: function() {
-    this.set('isLoaded', false);
-    this.loadHosts();
-  },
-
-  /**
-   * load hosts from server
-   */
-  loadHosts: function () {
-    App.ajax.send({
-      name: 'hosts.high_availability.wizard',
-      data: {},
-      sender: this,
-      success: 'loadHostsSuccessCallback',
-      error: 'loadHostsErrorCallback'
-    });
-  },
-
-  loadHostsSuccessCallback: function (data, opt, params) {
-    var hosts = {};
-
-    data.items.forEach(function (item) {
-      hosts[item.Hosts.host_name] = {
-        name: item.Hosts.host_name,
-        cpu: item.Hosts.cpu_count,
-        memory: item.Hosts.total_mem,
-        disk_info: item.Hosts.disk_info,
-        bootStatus: "REGISTERED",
-        isInstalled: true
-      };
-    });
-    App.db.setHosts(hosts);
-    this.set('controller.content.hosts', hosts);
-    this.set('isLoaded', true);
-  },
-
-  loadHostsErrorCallback: function(){
-    this.set('isLoaded', true);
-  }
+  templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/wizard')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/app/views/main/admin/highAvailability/hawq/addStandby/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/addStandby/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/addStandby/wizard_view.js
index 3f7d70f..187e7b5 100644
--- a/ambari-web/app/views/main/admin/highAvailability/hawq/addStandby/wizard_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/addStandby/wizard_view.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 
-App.AddHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
+App.AddHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, App.WizardHostsLoading, {
 
   didInsertElement: function() {
     var currentStep = this.get('controller.currentStep');
@@ -28,48 +28,5 @@ App.AddHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
     }
   },
 
-  templateName: require('templates/main/admin/highAvailability/hawq/addStandby/wizard'),
-
-  isLoaded: false,
-
-  willInsertElement: function() {
-    this.set('isLoaded', false);
-    this.loadHosts();
-  },
-
-  /**
-   * load hosts from server
-   */
-  loadHosts: function () {
-    App.ajax.send({
-      name: 'hosts.high_availability.wizard',
-      data: {},
-      sender: this,
-      success: 'loadHostsSuccessCallback',
-      error: 'loadHostsErrorCallback'
-    });
-  },
-
-  loadHostsSuccessCallback: function (data, opt, params) {
-    var hosts = {};
-
-    data.items.forEach(function (item) {
-      hosts[item.Hosts.host_name] = {
-        name: item.Hosts.host_name,
-        cpu: item.Hosts.cpu_count,
-        memory: item.Hosts.total_mem,
-        disk_info: item.Hosts.disk_info,
-        bootStatus: "REGISTERED",
-        isInstalled: true,
-        maintenance_state: item.Hosts.maintenance_state
-      };
-    });
-    App.db.setHosts(hosts);
-    this.set('controller.content.hosts', hosts);
-    this.set('isLoaded', true);
-  },
-
-  loadHostsErrorCallback: function(){
-    this.set('isLoaded', true);
-  }
+  templateName: require('templates/main/admin/highAvailability/hawq/addStandby/wizard')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js
index 0ccb120..a69651e 100644
--- a/ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/removeStandby/wizard_view.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 
-App.RemoveHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
+App.RemoveHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, App.WizardHostsLoading, {
 
   didInsertElement: function() {
     var currentStep = this.get('controller.currentStep');
@@ -28,47 +28,5 @@ App.RemoveHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
     }
   },
 
-  templateName: require('templates/main/admin/highAvailability/hawq/removeStandby/wizard'),
-
-  isLoaded: false,
-
-  willInsertElement: function() {
-    this.set('isLoaded', false);
-    this.loadHosts();
-  },
-
-  /**
-   * load hosts from server
-   */
-  loadHosts: function () {
-    App.ajax.send({
-      name: 'hosts.high_availability.wizard',
-      data: {},
-      sender: this,
-      success: 'loadHostsSuccessCallback',
-      error: 'loadHostsErrorCallback'
-    });
-  },
-
-  loadHostsSuccessCallback: function (data, opt, params) {
-    var hosts = {};
-
-    data.items.forEach(function (item) {
-      hosts[item.Hosts.host_name] = {
-        name: item.Hosts.host_name,
-        cpu: item.Hosts.cpu_count,
-        memory: item.Hosts.total_mem,
-        disk_info: item.Hosts.disk_info,
-        bootStatus: "REGISTERED",
-        isInstalled: true
-      };
-    });
-    App.db.setHosts(hosts);
-    this.set('controller.content.hosts', hosts);
-    this.set('isLoaded', true);
-  },
-
-  loadHostsErrorCallback: function(){
-    this.set('isLoaded', true);
-  }
+  templateName: require('templates/main/admin/highAvailability/hawq/removeStandby/wizard')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
index 97320f6..7dba7a4 100644
--- a/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/resourceManager/wizard_view.js
@@ -19,60 +19,14 @@
 
 var App = require('app');
 
-App.RMHighAvailabilityWizardView = Em.View.extend(App.WizardMenuMixin, {
+App.RMHighAvailabilityWizardView = Em.View.extend(App.WizardMenuMixin, App.WizardHostsLoading, {
 
   templateName: require('templates/main/admin/highAvailability/resourceManager/wizard'),
 
-  /**
-   * @type {boolean}
-   * @default false
-   */
-  isLoaded: false,
-
   didInsertElement: function() {
     var currentStep = this.get('controller.currentStep');
     if (currentStep > 3) {
       this.get('controller').setLowerStepsDisable(currentStep);
     }
-  },
-
-  willInsertElement: function() {
-    this.set('isLoaded', false);
-    this.loadHosts();
-  },
-
-  /**
-   * load hosts from server
-   */
-  loadHosts: function () {
-    return App.ajax.send({
-      name: 'hosts.high_availability.wizard',
-      data: {},
-      sender: this,
-      success: 'loadHostsSuccessCallback',
-      error: 'loadHostsErrorCallback'
-    });
-  },
-
-  loadHostsSuccessCallback: function (data, opt, params) {
-    var hosts = {};
-
-    data.items.forEach(function (item) {
-      hosts[item.Hosts.host_name] = {
-        name: item.Hosts.host_name,
-        cpu: item.Hosts.cpu_count,
-        memory: item.Hosts.total_mem,
-        disk_info: item.Hosts.disk_info,
-        bootStatus: "REGISTERED",
-        isInstalled: true
-      };
-    });
-    App.db.setHosts(hosts);
-    this.set('controller.content.hosts', hosts);
-    this.set('isLoaded', true);
-  },
-
-  loadHostsErrorCallback: function(){
-    this.set('isLoaded', true);
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/56fc6ee1/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js b/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
index ad859f1..d30be42 100644
--- a/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
+++ b/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
@@ -88,7 +88,8 @@ describe('App.RMHighAvailabilityWizardView', function () {
             host_name: 'host1',
             cpu_count: 1,
             total_mem: 1,
-            disk_info: {}
+            disk_info: {},
+            maintenance_state: 'OFF'
           }
         }
       ]
@@ -111,7 +112,8 @@ describe('App.RMHighAvailabilityWizardView', function () {
           "memory": 1,
           "disk_info": {},
           "bootStatus": "REGISTERED",
-          "isInstalled": true
+          "isInstalled": true,
+          "maintenance_state": "OFF"
         }
       });
       expect(App.db.setHosts.calledWith({
@@ -121,7 +123,8 @@ describe('App.RMHighAvailabilityWizardView', function () {
           "memory": 1,
           "disk_info": {},
           "bootStatus": "REGISTERED",
-          "isInstalled": true
+          "isInstalled": true,
+          "maintenance_state": "OFF"
         }
       })).to.be.true;
     });