You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by vr...@apache.org on 2017/10/17 20:19:57 UTC
[14/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)
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/4fa01aa6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4fa01aa6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4fa01aa6
Branch: refs/heads/YARN-5355_branch2
Commit: 4fa01aa66498ebe0d1667624fe6d695589886ffe
Parents: e4b0f22
Author: Wangda Tan <wa...@apache.org>
Authored: Mon Oct 17 11:30:16 2016 -0700
Committer: vrushali <vr...@apache.org>
Committed: Tue Oct 17 11:39:49 2017 -0700
----------------------------------------------------------------------
.../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/4fa01aa6/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/4fa01aa6/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