You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/04/11 00:28:30 UTC
git commit: AMBARI-5432. Add service wizard to add missing
service-components for other services. (srimanth)
Repository: ambari
Updated Branches:
refs/heads/branch-1.5.1 e61307a90 -> 82e3af213
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/82e3af21
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/82e3af21
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/82e3af21
Branch: refs/heads/branch-1.5.1
Commit: 82e3af213e557f52dbc67a2e4e663d3a274223ea
Parents: e61307a
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Apr 10 14:50:41 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Apr 10 14:51:14 2014 -0700
----------------------------------------------------------------------
ambari-web/app/app.js | 4 ++
.../app/controllers/wizard/step8_controller.js | 39 ++++++++++++++++++
ambari-web/app/utils/ajax.js | 9 ++++
ambari-web/test/app_test.js | 43 ++++++++++++++++++++
4 files changed, 95 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/82e3af21/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index e83319e..fdd3e6e 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/82e3af21/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 960cf57..12103d6 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -934,6 +934,45 @@ App.WizardStep8Controller = Em.Controller.extend({
});
}, 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/82e3af21/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 2017b3f..7bc881a 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/82e3af21/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index 4830b58..5ced078 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -39,6 +39,49 @@ 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 = {
service_name: 'YARN',