ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-14214 Add Service wizard: Browser refresh on "Customize Services page" hides recommendation message and link. (atkach)
Date Fri, 04 Dec 2015 13:31:53 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a8649b0f0 -> 78bfef831


AMBARI-14214 Add Service wizard: Browser refresh on "Customize Services page" hides recommendation
message and link. (atkach)


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

Branch: refs/heads/trunk
Commit: 78bfef83197fd77029d4ead5b6eaf3254f97d173
Parents: a8649b0
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Fri Dec 4 15:31:38 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Fri Dec 4 15:31:38 2015 +0200

----------------------------------------------------------------------
 .../controllers/main/service/add_controller.js  |  5 ++++
 ambari-web/app/mixins/common/serverValidator.js | 28 +-------------------
 ambari-web/app/routes/add_service_routes.js     |  9 ++++---
 ambari-web/app/utils/blueprint.js               |  4 +--
 ambari-web/test/utils/blueprint_test.js         |  9 +++----
 5 files changed, 18 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index 634aa07..1f8133d 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -126,6 +126,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs,
{
             });
             self.loadServiceConfigGroups();
             self.loadServiceConfigProperties();
+            self.loadCurrentHostGroups();
           });
           return dfd.promise();
         }
@@ -153,6 +154,10 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs,
{
     });
   },
 
+  loadCurrentHostGroups: function () {
+    this.set("content.recommendationsHostGroups", this.getDBProperty('recommendationsHostGroups'));
+  },
+
   /**
    * Load services data. Will be used at <code>Select services(step4)</code>
step
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 7cfc918..b3fb3ad 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -191,15 +191,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
     if (this.get('configValidationFailed')) {
       this.warnUser(deferred);
     } else {
-      if (this.get('isInstaller')) {
-        this.runServerSideValidation(deferred);
-      } else {
-        // on Service Configs page we need to load all hosts with componnets
-        this.getAllHostsWithComponents().then(function(data) {
-          self.set('content.recommendationsHostGroups', blueprintUtils.generateHostGroups(App.get('allHostNames'),
self.mapHostsToComponents(data.items)));
-          self.runServerSideValidation(deferred);
-        });
-      }
+      this.runServerSideValidation(deferred);
     }
     return deferred;
   },
@@ -215,24 +207,6 @@ App.ServerValidatorMixin = Em.Mixin.create({
   },
 
   /**
-   * Generate array similar to App.HostComponent which will be used to
-   * create blueprint hostGroups object as well.
-   *
-   * @param {Object[]} jsonData
-   * @returns {Em.Object[]}
-   */
-  mapHostsToComponents: function(jsonData) {
-    var result = [];
-    jsonData.forEach(function(item) {
-      result.push(Em.Object.create({
-        componentName: Em.get(item, 'HostRoles.component_name'),
-        hostName: Em.get(item, 'HostRoles.host_name')
-      }));
-    });
-    return result;
-  },
-
-  /**
    * @method serverSideValidation
    * send request to validate configs
    * @returns {*}

http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 32e9b70..f305b0c 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -192,9 +192,12 @@ module.exports = App.WizardRoute.extend({
         wizardStep6Controller.showValidationIssuesAcceptBox(function () {
           addServiceController.saveSlaveComponentHosts(wizardStep6Controller);
           addServiceController.get('content').set('serviceConfigProperties', null);
-          addServiceController.setDBProperty('serviceConfigProperties', null);
-          addServiceController.setDBProperty('groupsToDelete', []);
-          addServiceController.setDBProperty('recommendationsConfigs', null);
+          addServiceController.setDBProperties({
+            serviceConfigProperties: null,
+            groupsToDelete: null,
+            recommendationsHostGroups: wizardStep6Controller.get('content.recommendationsHostGroups'),
+            recommendationsConfigs: null
+          });
           router.get('wizardStep7Controller').set('recommendationsConfigs', null);
           router.get('wizardStep7Controller').clearDependentConfigs();
           router.transitionTo('step4');

http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/app/utils/blueprint.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/blueprint.js b/ambari-web/app/utils/blueprint.js
index ea908d1..84071ab 100644
--- a/ambari-web/app/utils/blueprint.js
+++ b/ambari-web/app/utils/blueprint.js
@@ -414,8 +414,8 @@ module.exports = {
     App.SlaveComponent.find().forEach(function (c) {
       hostsMap = this._generateHostMap(hostsMap, c.get('hostNames'), c.get('componentName'));
     }, this);
-    App.HostComponent.find().forEach(function (c) {
-      hostsMap = this._generateHostMap(hostsMap, [c.get('hostName')], c.get('componentName'));
+    App.MasterComponent.find().forEach(function (c) {
+      hostsMap = this._generateHostMap(hostsMap, c.get('hostNames'), c.get('componentName'));
     }, this);
     return hostsMap;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/78bfef83/ambari-web/test/utils/blueprint_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js
index 8fa3bcf..5364bb9 100644
--- a/ambari-web/test/utils/blueprint_test.js
+++ b/ambari-web/test/utils/blueprint_test.js
@@ -401,18 +401,17 @@ describe('utils/blueprint', function() {
           hostNames: ["host2", "host3"]
         })
       ]);
-      sinon.stub(App.HostComponent, 'find').returns([
+      sinon.stub(App.MasterComponent, 'find').returns([
         Em.Object.create({
           componentName: "C3",
-          hostName: "host3",
-          isMaster: true
+          hostNames: ["host3"]
         })
       ]);
     });
     afterEach(function() {
       App.ClientComponent.find.restore();
       App.SlaveComponent.find.restore();
-      App.HostComponent.find.restore();
+      App.MasterComponent.find.restore();
     });
 
     it("generate components to host map", function() {
@@ -444,4 +443,4 @@ describe('utils/blueprint', function() {
       });
     });
   });
-});
\ No newline at end of file
+});


Mime
View raw message