You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2013/10/03 17:31:54 UTC
git commit: AMBARI-3446 When SSL is enabled on Hadoop JMX endpoints
ResourceManager quick links become unavailable. (ababiichuk)
Updated Branches:
refs/heads/branch-1.4.1 0bc3b087e -> 0b5ca2953
AMBARI-3446 When SSL is enabled on Hadoop JMX endpoints ResourceManager quick links become unavailable. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/0b5ca295
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/0b5ca295
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/0b5ca295
Branch: refs/heads/branch-1.4.1
Commit: 0b5ca29533d3bf29f2c02a2c8c9629a43211f49d
Parents: 0bc3b08
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Thu Oct 3 18:28:21 2013 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Thu Oct 3 18:28:21 2013 +0300
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
ambari-web/app/models/quick_links.js | 16 +++---
.../app/views/common/quick_view_link_view.js | 17 +++++-
.../test/views/common/quick_link_view_test.js | 60 ++++++++++++++++++++
4 files changed, 85 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5ca295/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 62ca5c6..76eb6eb 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -71,6 +71,7 @@ require('test/utils/config_test');
require('test/utils/string_utils_test');
require('test/views/common/chart/linear_time_test');
require('test/views/common/filter_view_test');
+require('test/views/common/quick_link_view_test');
require('test/views/main/dashboard_test');
require('test/views/main/dashboard/widget_test');
require('test/views/main/dashboard/widgets/text_widget_test');
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5ca295/ambari-web/app/models/quick_links.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/quick_links.js b/ambari-web/app/models/quick_links.js
index 068f5bd..43a6bc5 100644
--- a/ambari-web/app/models/quick_links.js
+++ b/ambari-web/app/models/quick_links.js
@@ -184,30 +184,30 @@ App.QuickLinks.FIXTURES = [
{
id:23,
label:'ResourceManager UI',
- url:'%@://%@:8088',
+ url:'%@://%@:%@',
service_id: 'YARN',
- template:'%@://%@:8088'
+ template:'%@://%@:%@'
},
{
id:24,
label:'ResourceManager logs',
- url:'%@://%@:8088/logs',
+ url:'%@://%@:%@/logs',
service_id: 'YARN',
- template:'%@://%@:8088/logs'
+ template:'%@://%@:%@/logs'
},
{
id:25,
label:'ResourceManager JMX',
- url:'%@://%@:8088/jmx',
+ url:'%@://%@:%@/jmx',
service_id: 'YARN',
- template:'%@://%@:8088/jmx'
+ template:'%@://%@:%@/jmx'
},
{
id:26,
label:'Thread Stacks',
- url:'%@://%@:8088/stacks',
+ url:'%@://%@:%@/stacks',
service_id: 'YARN',
- template:'%@://%@:8088/stacks'
+ template:'%@://%@:%@/stacks'
},
{
id:27,
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5ca295/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index 319d7d8..8ccc77e 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -17,6 +17,7 @@
*/
var App = require('app');
+var stringUtils = require('utils/string_utils');
App.QuickViewLinks = Em.View.extend({
@@ -96,6 +97,7 @@ App.QuickViewLinks = Em.View.extend({
var components = this.get('content.hostComponents');
var host;
var self = this;
+ var version = App.get('currentStackVersionNumber');
switch (serviceName) {
case "HDFS":
@@ -155,7 +157,12 @@ App.QuickViewLinks = Em.View.extend({
item.set('disabled', false);
var protocol = self.setProtocol(item.get('service_id'));
if (item.get('template')) {
- item.set('url', item.get('template').fmt(protocol,host));
+ if(item.get('service_id') === 'YARN'){
+ var port = self.setPort(item.get('service_id'),protocol, version);
+ item.set('url', item.get('template').fmt(protocol,host,port));
+ } else {
+ item.set('url', item.get('template').fmt(protocol,host));
+ }
}
}
return item;
@@ -190,6 +197,14 @@ App.QuickViewLinks = Em.View.extend({
}
},
+ setPort: function(service_id, protocol, version) {
+ var port = '';
+ if (service_id === 'YARN') {
+ port = (protocol === 'https' && stringUtils.compareVersions(version,'2.0.5') === 1) ? '8090' : '8088'
+ }
+ return port;
+ },
+
linkTarget: function () {
switch (this.get('content.serviceName').toLowerCase()) {
case "hdfs":
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5ca295/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
new file mode 100644
index 0000000..f17e1b8
--- /dev/null
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/common/quick_view_link_view');
+
+describe('App.QuickViewLinks', function () {
+
+ var quickViewLinks = App.QuickViewLinks.create({});
+
+ describe('#setPort', function () {
+ var testData = [
+ {
+ 'service_id': 'HDFS',
+ 'protocol': 'https',
+ 'version': '2.0.6',
+ 'result': ''
+ },
+ {
+ 'service_id': 'YARN',
+ 'protocol': 'http',
+ 'version': '2.0.6',
+ 'result': '8088'
+ },
+ {
+ 'service_id': 'YARN',
+ 'protocol': 'https',
+ 'version': '2.0.5',
+ 'result': '8088'
+ },
+ {
+ 'service_id': 'YARN',
+ 'protocol': 'https',
+ 'version': '2.0.6',
+ 'result': '8090'
+ },
+ ];
+
+ testData.forEach(function(item) {
+ it('should return empty string if service_id is not YARN, 8090 if protocol is https and stack version higher than 2.0.5, http otherwise', function () {
+ expect(quickViewLinks.setPort(item.service_id, item.protocol, item.version)).to.equal(item.result);
+ })
+ },this);
+ });
+});