You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/01/05 07:56:31 UTC

[35/45] ambari git commit: AMBARI-22449. Improved service/component dependency support (amagyar)

AMBARI-22449. Improved service/component dependency support (amagyar)


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

Branch: refs/heads/branch-feature-AMBARI-22008-isilon
Commit: 7b3207e1f76dc37dd423e20b3cff41dac17ad90f
Parents: 80e8359
Author: Attila Magyar <am...@hortonworks.com>
Authored: Thu Nov 16 15:35:41 2017 +0100
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Fri Jan 5 08:54:45 2018 +0100

----------------------------------------------------------------------
 .../app/controllers/wizard/step4_controller.js  |  4 +--
 ambari-web/app/messages.js                      |  3 +-
 ambari-web/app/models/stack_service.js          | 30 +++++++++++---------
 3 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7b3207e1/ambari-web/app/controllers/wizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js
index d39164b..8a62f3b 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -480,11 +480,11 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   needToAddMissingDependency: function (missingDependency, i18nSuffix, callback, id) {
     var self = this;
     var displayName = missingDependency.get('displayName');
-    if (missingDependency.hasMultipleOptions()) {
+    if (missingDependency.get('hasMultipleOptions')) {
       return this.showDependencyPopup(
         id,
         Em.I18n.t('installer.step4.' + i18nSuffix + '.popup.header').format(displayName),
-        Em.I18n.t('installer.step4.' + i18nSuffix + '.popup.body2').format(displayName, missingDependency.displayOptions()),
+        Em.I18n.t('installer.step4.' + i18nSuffix + '.popup.body.multiOptions').format(displayName, missingDependency.get('displayOptions')),
         callback
       );
     } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/7b3207e1/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 9b9bd9f..e59f5fd 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -885,7 +885,8 @@ Em.I18n.translations = {
   'installer.step4.multipleDFS.popup.body':'You selected more than one file system. We will automatically select only {0}. Is this OK?',
   'installer.step4.serviceCheck.popup.header':'{0} Needed',
   'installer.step4.serviceCheck.popup.body':'You did not select {0}, but it is needed by other services you selected. We will automatically add {1}. Is this OK?',
-  'installer.step4.serviceCheck.popup.body2':'You did not select {0}, but it is needed by other services you selected. Select a compatible service from the following list: {1}',
+  'installer.step4.serviceCheck.popup.body.multiOptions':'You did not select {0}, but it is needed by other services you selected. Select a compatible service from the following list: {1}',
+  'installer.step4.hcfs.displayName':'a Hadoop Compatible File System',
   'installer.step4.limitedFunctionality.popup.header':'Limited Functionality Warning',
   'installer.step4.ambariMetricsCheck.popup.body':'Ambari Metrics collects metrics from the cluster and makes them available to Ambari.  If you do not install Ambari Metrics service, metrics will not be accessible from Ambari.  Are you sure you want to proceed without Ambari Metrics?',
   'installer.step4.ambariInfraCheck.popup.body':'Since Ambari Infra is not selected, you must supply your own Solr to make Atlas work. Are you sure you want to proceed?',

http://git-wip-us.apache.org/repos/asf/ambari/blob/7b3207e1/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 46dfee5..a84816e 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -23,11 +23,11 @@ require('models/configs/objects/service_config_category');
 
 var Dependency = Ember.Object.extend({
   name: Ember.computed('service', function() {
-    return this.get('service').get('serviceName');
+    return this.get('service.serviceName');
   }),
 
   displayName: Ember.computed('service', function() {
-    return this.get('service').get('displayNameOnSelectServicePage');
+    return this.get('service.displayNameOnSelectServicePage');
   }),
 
   compatibleServices: function(services) {
@@ -40,8 +40,8 @@ var Dependency = Ember.Object.extend({
 });
 
 var HcfsDependency = Dependency.extend({
-  displayName: Ember.computed('service', function() {
-    return 'a Hadoop Compatible File System';
+  displayName: Ember.computed(function() {
+    return Em.I18n.t('installer.step4.hcfs.displayName');
   }),
 
   compatibleServices: function(services) {
@@ -58,17 +58,17 @@ Dependency.reopenClass({
 });
 
 var MissingDependency = Ember.Object.extend({
-  hasMultipleOptions: function() {
+  hasMultipleOptions: Ember.computed('compatibleServices', function() {
     return this.get('compatibleServices').length > 1;
-  },
+  }),
 
   selectFirstCompatible: function() {
     this.get('compatibleServices')[0].set('isSelected', true);
   },
 
-  displayOptions: function() {
+  displayOptions: Ember.computed('compatibleServices', function() {
     return this.get('compatibleServices').mapProperty('serviceName').join(', ');
-  }
+  })
 });
 
 /**
@@ -122,10 +122,14 @@ App.StackService = DS.Model.extend({
   dependentServiceNames: DS.attr('array', {defaultValue: []}),
 
   dependencies: function(availableServices) {
-    return this.get('requiredServices')
-      .map(function (serviceName) { return availableServices.findProperty('serviceName', serviceName)})
-      .filter(function (each) { return !!each })
-      .map(function (service) { return Dependency.fromService(service); });
+    var result = [];
+    this.get('requiredServices').forEach(function(serviceName) {
+      var service = availableServices.findProperty('serviceName', serviceName);
+      if (service) {
+        result.push(Dependency.fromService(service));
+      }
+    });
+    return result;
   },
 
   /**
@@ -144,7 +148,7 @@ App.StackService = DS.Model.extend({
   },
 
   _addMissingDependency: function(dependency, availableServices, missingDependencies) {
-    if(!missingDependencies.some(function(each) { return each.get('serviceName') == dependency.get('name'); })) {
+    if(!missingDependencies.someProperty('serviceName', dependency.get('name'))) {
       missingDependencies.push(MissingDependency.create({
          serviceName: dependency.get('name'),
          displayName: dependency.get('displayName'),