ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject git commit: AMBARI-5432. Add service wizard to add missing service-components for other services. (srimanth)
Date Thu, 10 Apr 2014 22:42:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 79165d685 -> 12ba97fd3


AMBARI-5432. Add service wizard to add missing service-components for other services. (srimanth)


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

Branch: refs/heads/trunk
Commit: 12ba97fd3c7552d49130ca7cb405c890980e087a
Parents: 79165d6
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Thu Apr 10 15:40:49 2014 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Thu Apr 10 15:40:49 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/app.js                           |  4 ++
 .../app/controllers/wizard/step8_controller.js  | 40 ++++++++++++++++++
 ambari-web/app/utils/ajax.js                    |  9 ++++
 ambari-web/test/app_test.js                     | 43 ++++++++++++++++++++
 4 files changed, 96 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/12ba97fd/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index aa1f909..3d1508a 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -70,6 +70,10 @@ module.exports = Em.Application.create({
     return (stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.0") ===
1 ||
       stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.0") === 0)
   }.property('currentStackVersionNumber'),
+  isHadoop21Stack: function(){
+    return (stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.1") ===
1 ||
+      stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.1") === 0)
+  }.property('currentStackVersionNumber'),
 
   /**
    * If High Availability is enabled

http://git-wip-us.apache.org/repos/asf/ambari/blob/12ba97fd/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 5571a36..999b111 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -969,6 +969,46 @@ App.WizardStep8Controller = Em.Controller.extend({
         data: JSON.stringify({"components": componentsData})
       });
     }, this);
+
+    if (this.get('content.controllerName') == 'addServiceController' && !App.testMode)
{
+      // Add service-components which show up in newer versions but did not
+      // exist in older ones.
+      var self = this;
+      var newServiceComponents = {}
+      if (App.get('isHadoop21Stack')) {
+        newServiceComponents['APP_TIMELINE_SERVER'] = 'YARN';
+      }
+      for (var componentName in newServiceComponents) {
+        var serviceName = newServiceComponents[componentName];
+        // Create only if it doesnt exist
+        var serviceComponentChecker = {
+          success: function(){},
+          error: function(){
+            var componentsData = [{
+              "ServiceComponentInfo": {
+                "component_name": componentName
+              }
+            }];
+            self.addRequestToAjaxQueue({
+              type: 'POST',
+              url: App.apiPrefix + '/clusters/' + self.get('clusterName') + '/services?ServiceInfo/service_name='
+ serviceName,
+              data: JSON.stringify({"components": componentsData})
+            });
+          }
+        }
+        App.ajax.send({
+          name: 'service.service_component',
+          sender: serviceComponentChecker,
+          data: {
+            serviceName: serviceName,
+            componentName: componentName,
+            async: false
+          },
+          success: 'success',
+          error: 'error'
+        });
+      }
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/12ba97fd/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index ddd412b..6830607 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -508,6 +508,15 @@ var urls = {
     'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?fields=host_components/{metricName}',
     'mock': '/data/cluster_metrics/cpu_1hr.json'
   },
+  'service.service_component': {
+    'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}',
+    'mock': '',
+    'format': function(data) {
+      return {
+        async: data.async
+      };
+    }
+  },
   'service.metrics.flume.channel_fill_percent': {
     'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_SERVER?fields=host_components/metrics/flume/flume/CHANNEL/*/ChannelFillPercentage[{fromSeconds},{toSeconds},{stepSeconds}]',
     'mock': '/data/services/metrics/flume/channelFillPct.json',

http://git-wip-us.apache.org/repos/asf/ambari/blob/12ba97fd/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index 2a97a3f..d82ab3c 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -23,6 +23,49 @@ require('models/stack_service_component');
 
 describe('#App', function() {
 
+  describe('App.isHadoop21Stack', function() {
+    var tests = [{
+      v:'',
+      e:false
+    }, {
+      v:'HDP',
+      e: false
+    }, {
+      v:'HDP1',
+      e: false
+    }, {
+      v:'HDP-1',
+      e: false
+    }, {
+      v:'HDP-2.0',
+      e: false
+    }, {
+      v:'HDP-2.0.1000',
+      e: false
+    }, {
+      v:'HDP-2.1',
+      e: true
+    }, {
+      v:'HDP-2.1.3434',
+      e: true
+    }, {
+      v:'HDP-2.2',
+      e: true
+    }, {
+      v:'HDP-2.2.1212',
+      e: true
+    }];
+    tests.forEach(function(test){
+      it(test.v, function() {
+        App.QuickViewLinks.prototype.setQuickLinks = function(){};
+        App.set('currentStackVersion', test.v);
+        var calculated = App.get('isHadoop21Stack');
+        var expected = test.e;
+        expect(calculated).to.equal(expected);
+      });
+    });
+  });
+
   describe('Disable/enable components', function() {
 
     var testableComponent =  Em.Object.create({


Mime
View raw message