Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A30961041E for ; Thu, 10 Apr 2014 22:42:33 +0000 (UTC) Received: (qmail 99646 invoked by uid 500); 10 Apr 2014 22:42:29 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 98505 invoked by uid 500); 10 Apr 2014 22:42:18 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 98454 invoked by uid 99); 10 Apr 2014 22:42:17 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2014 22:42:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EF4F8989DC3; Thu, 10 Apr 2014 22:42:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: srimanth@apache.org To: commits@ambari.apache.org Message-Id: <679beaf4963b4973bf93442d09e63ee7@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) 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 Authored: Thu Apr 10 15:40:49 2014 -0700 Committer: Srimanth Gunturi 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({