Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E6D3F200BAE for ; Fri, 28 Oct 2016 16:34:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E56E6160B03; Fri, 28 Oct 2016 14:34:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 18DCC160AF5 for ; Fri, 28 Oct 2016 16:34:17 +0200 (CEST) Received: (qmail 98426 invoked by uid 500); 28 Oct 2016 14:34:02 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 93203 invoked by uid 99); 28 Oct 2016 14:33:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2016 14:33:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CA701F1714; Fri, 28 Oct 2016 14:33:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sunilg@apache.org To: common-commits@hadoop.apache.org Date: Fri, 28 Oct 2016 14:34:41 -0000 Message-Id: <4900c99f64f741e1a4a1ed007eb95679@git.apache.org> In-Reply-To: <18f182dd1b994742940b8aff63f4246c@git.apache.org> References: <18f182dd1b994742940b8aff63f4246c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [45/50] [abbrv] hadoop git commit: YARN-5145. [YARN-3368] Move new YARN UI configuration to HADOOP_CONF_DIR. (Sunil G and Kai Sasaki via wangda) archived-at: Fri, 28 Oct 2016 14:34:19 -0000 YARN-5145. [YARN-3368] Move new YARN UI configuration to HADOOP_CONF_DIR. (Sunil G and Kai Sasaki via wangda) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d4d90357 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d4d90357 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d4d90357 Branch: refs/heads/YARN-3368 Commit: d4d9035770180d7b4b27c2c3f0c803395e1c5e24 Parents: b5cb611 Author: Wangda Tan Authored: Mon Oct 17 11:30:16 2016 -0700 Committer: sunilg Committed: Fri Oct 28 20:02:27 2016 +0530 ---------------------------------------------------------------------- .../src/main/webapp/app/initializers/loader.js | 86 ++++++++++++++++++++ .../tests/unit/initializers/loader-test.js | 40 +++++++++ 2 files changed, 126 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/d4d90357/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js new file mode 100644 index 0000000..08e4dbd --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js @@ -0,0 +1,86 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +function getTimeLineURL(parameters) { + return '/conf?name=yarn.timeline-service.webapp.address'; +} + +function updateConfigs(application) { + var hostname = window.location.hostname; + var rmhost = hostname + + (window.location.port ? ':' + window.location.port: ''); + + Ember.Logger.log("RM Address:" + rmhost); + + if(!ENV.hosts.rmWebAddress) { + ENV = { + hosts: { + rmWebAddress: rmhost, + }, + }; + } + + if(!ENV.hosts.timelineWebAddress) { + var result = []; + var timelinehost = ""; + $.ajax({ + type: 'GET', + dataType: 'json', + async: true, + context: this, + url: getTimeLineURL(), + success: function(data) { + timelinehost = data.property.value; + ENV.hosts.timelineWebAddress = timelinehost; + + var address = timelinehost.split(":")[0]; + var port = timelinehost.split(":")[1]; + + Ember.Logger.log("Timeline Address from RM:" + address + ":" + port); + + if(address == "0.0.0.0" || address == "localhost") { + var updatedAddress = hostname + ":" + port; + + /* Timeline v2 is not supporting CORS, so make as default*/ + ENV = { + hosts: { + rmWebAddress: rmhost, + timelineWebAddress: updatedAddress, + }, + }; + Ember.Logger.log("Timeline Updated Address:" + updatedAddress); + } + application.advanceReadiness(); + }, + }); + } else { + application.advanceReadiness(); + } +} + +export function initialize( application ) { + application.deferReadiness(); + updateConfigs(application); +} + +export default { + name: 'loader', + before: 'env', + initialize +}; http://git-wip-us.apache.org/repos/asf/hadoop/blob/d4d90357/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/loader-test.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/loader-test.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/loader-test.js new file mode 100644 index 0000000..cc32e92 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tests/unit/initializers/loader-test.js @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ember from 'ember'; +import LoaderInitializer from '../../../initializers/loader'; +import { module, test } from 'qunit'; + +let application; + +module('Unit | Initializer | loader', { + beforeEach() { + Ember.run(function() { + application = Ember.Application.create(); + application.deferReadiness(); + }); + } +}); + +// Replace this with your real tests. +test('it works', function(assert) { + LoaderInitializer.initialize(application); + + // you would normally confirm the results of the initializer here + assert.ok(true); +}); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org