Repository: ambari Updated Branches: refs/heads/trunk acf45f862 -> ef9106762
AMBARI-15956. Add quick links to the hs2 interactive UI on Ambari. (Jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ef910676 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ef910676 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ef910676 Branch: refs/heads/trunk Commit: ef9106762da3f55b66704af6d21e92efcde84448 Parents: acf45f8 Author: Jaimin Jetly <[email protected]> Authored: Mon Apr 18 16:52:57 2016 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Mon Apr 18 16:53:07 2016 -0700 ---------------------------------------------------------------------- .../configuration/hive-interactive-site.xml | 2 +- .../stacks/HDP/2.5/services/HIVE/metainfo.xml | 6 ++ .../services/HIVE/quicklinks/quicklinks.json | 26 +++++++ .../app/models/quicklinks/quick_links_config.js | 18 +++++ .../main/dashboard/widgets/hbase_links.hbs | 4 +- .../main/dashboard/widgets/hdfs_links.hbs | 4 +- .../main/dashboard/widgets/yarn_links.hbs | 4 +- .../info/metrics/hive/hive_quick_links.hbs | 41 +++++++++++ ambari-web/app/templates/main/service/item.hbs | 6 +- .../app/views/common/quick_view_link_view.js | 74 +++++--------------- .../test/views/common/quick_link_view_test.js | 13 ---- 11 files changed, 119 insertions(+), 79 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml index f656aaf..0b3de15 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml @@ -262,7 +262,7 @@ limitations under the License. </property> <property> - <name>hive.server2.webui.port </name> + <name>hive.server2.webui.port</name> <value>10502</value> <description>Web UI port address</description> </property> http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml index fcd05a4..be55bb0 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/metainfo.xml @@ -113,6 +113,12 @@ <default>true</default> </theme> </themes> + <quickLinksConfigurations> + <quickLinksConfiguration> + <fileName>quicklinks.json</fileName> + <default>true</default> + </quickLinksConfiguration> + </quickLinksConfigurations> <requiredServices> <service>ZOOKEEPER</service> http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/quicklinks/quicklinks.json b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/quicklinks/quicklinks.json new file mode 100644 index 0000000..9863dc4 --- /dev/null +++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/quicklinks/quicklinks.json @@ -0,0 +1,26 @@ +{ + "name": "default", + "description": "default quick links configuration", + "configuration": { + "protocol": { + "type":"HTTP_ONLY" + }, + + "links": [ + { + "name": "hiveserver2_ui", + "label": "HiveServer2 Interactive UI", + "requires_user_name": "false", + "url": "%@://%@:%@/llap/llap0", + "port":{ + "http_property": "hive.server2.webui.port", + "http_default_port": "10502", + "https_property": "hive.server2.webui.port", + "https_default_port": "10502", + "regex": "\\w*:(\\d+)", + "site": "hive-interactive-site" + } + } + ] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-web/app/models/quicklinks/quick_links_config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/quicklinks/quick_links_config.js b/ambari-web/app/models/quicklinks/quick_links_config.js index d7d98e2..c9b2709 100644 --- a/ambari-web/app/models/quicklinks/quick_links_config.js +++ b/ambari-web/app/models/quicklinks/quick_links_config.js @@ -33,3 +33,21 @@ App.QuickLinksConfig = DS.Model.extend({ }); App.QuickLinksConfig.FIXTURES = []; + +/** + * key = service name and value = master component name + * @type {{OOZIE: string, HDFS: string, HBASE: string, YARN: string, HIVE: string, STORM: string, ACCUMULO: string, ATLAS: string, MAPREDUCE2: string, AMBARI_METRICS: string, LOGSEARCH: string}} + */ +App.QuickLinksConfig.ServiceComponentMap = { + 'OOZIE': 'OOZIE_SERVER', + 'HDFS': 'NAMENODE', + 'HBASE':'HBASE_MASTER', + 'YARN' : 'RESOURCEMANAGER', + 'HIVE' : 'HIVE_SERVER_INTERACTIVE', + 'STORM': 'STORM_UI_SERVER', + 'ACCUMULO': 'ACCUMULO_MONITOR', + 'ATLAS': 'ATLAS_SERVER', + 'MAPREDUCE2': 'HISTORYSERVER', + 'AMBARI_METRICS': 'METRICS_GRAFANA', + 'LOGSEARCH': 'LOGSEARCH_SERVER' +}; http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs b/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs index 5c686a8..cb97978 100644 --- a/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs +++ b/ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs @@ -73,14 +73,14 @@ <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} </a> <ul class="dropdown-menu"> {{#each quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} </ul> </li> {{/each}} {{else}} {{#each view.quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} {{/if}} {{else}} http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs b/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs index 83d49b1..96f64ba 100644 --- a/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs +++ b/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs @@ -94,14 +94,14 @@ <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} </a> <ul class="dropdown-menu"> {{#each quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} </ul> </li> {{/each}} {{else}} {{#each view.quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} {{/if}} {{else}} http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-web/app/templates/main/dashboard/widgets/yarn_links.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/widgets/yarn_links.hbs b/ambari-web/app/templates/main/dashboard/widgets/yarn_links.hbs index b6f1087..884f322 100644 --- a/ambari-web/app/templates/main/dashboard/widgets/yarn_links.hbs +++ b/ambari-web/app/templates/main/dashboard/widgets/yarn_links.hbs @@ -61,14 +61,14 @@ <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} </a> <ul class="dropdown-menu"> {{#each quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} </ul> </li> {{/each}} {{else}} {{#each view.quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} {{/if}} {{else}} http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-web/app/templates/main/service/info/metrics/hive/hive_quick_links.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/metrics/hive/hive_quick_links.hbs b/ambari-web/app/templates/main/service/info/metrics/hive/hive_quick_links.hbs new file mode 100644 index 0000000..37f28b9 --- /dev/null +++ b/ambari-web/app/templates/main/service/info/metrics/hive/hive_quick_links.hbs @@ -0,0 +1,41 @@ +{{! +* 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. +}} + +<div class="widget span2p4"> + <div class="thumbnail quick-link-widget"> + + {{#if view.isLoaded}} + <div class="caption title span11"> {{view.title}}</div> + + <div class="content"> + <table> + <tr class="grafana-link"> + <td> + <a href="#" {{action showDetails view.model.nameNode.host}}>{{t dashboard.service.hive.grafana}}</a> + </td> + </tr> + <tr class="hive-interactive-server-link"> + <td> + <a href="#" {{action showDetails view.model.snameNode.host}}>{{t dashboard.service.hive.interactive.server}}</a> + </td> + </tr> + </table> + </div> + {{/if}} + </div> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/ambari-web/app/templates/main/service/item.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/item.hbs b/ambari-web/app/templates/main/service/item.hbs index bc7f05f..c22424b 100644 --- a/ambari-web/app/templates/main/service/item.hbs +++ b/ambari-web/app/templates/main/service/item.hbs @@ -19,7 +19,7 @@ {{view App.MainServiceInfoMenuView configTabBinding="view.hasConfigTab" heatmapTabBinding="view.hasHeatmapTab"}} <div class="span3 quick-links-wrapper"> {{#view App.QuickViewLinks contentBinding="view.service"}} - {{#if view.hasQuickLinksConfiged}} + {{#if view.showQuickLinks}} <ul class="nav nav-pills move"> <li class="dropdown quick-links-dropdown"> <a class="dropdown-toggle" id="quick-links-dropdown-btn" data-toggle="dropdown" href="#">{{t common.quickLinks}}<b class="caret"></b></a> @@ -32,7 +32,7 @@ <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} </a> <ul class="dropdown-menu"> {{#each quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} </ul> </li> @@ -40,7 +40,7 @@ {{else}} {{#if view.quickLinks}} {{#each view.quickLinks}} - <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li> + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> {{/each}} {{else}} <div class="alert alert-danger"><small>{{t quick.links.error.quicklinks.unavailable.label}}</small></div> http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/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 3a99d7a..e164df3 100644 --- a/ambari-web/app/views/common/quick_view_link_view.js +++ b/ambari-web/app/views/common/quick_view_link_view.js @@ -23,31 +23,11 @@ App.QuickViewLinks = Em.View.extend({ isLoaded: false, - hasQuickLinksConfiged: false, + showQuickLinks: false, quickLinksErrorMessage: '', /** - * service which has blank target of link - * @type {Array} - */ - servicesHasBlankTarget: [ - 'HDFS', - 'YARN', - 'MAPREDUCE2', - 'HBASE', - 'OOZIE', - 'STORM', - 'SPARK', - 'FALCON', - 'ACCUMULO', - 'ATLAS', - 'RANGER', - 'AMBARI_METRICS', - 'LOGSEARCH' - ], - - /** * Updated quick links. Here we put correct hostname to url * @type {Array} */ @@ -61,17 +41,6 @@ App.QuickViewLinks = Em.View.extend({ * list of files that contains properties for enabling/disabling ssl */ requiredSiteNames: [], - - /** - * @type {string} - */ - linkTarget: function () { - if (this.get('servicesHasBlankTarget').contains(this.get('content.serviceName'))) { - return "_blank"; - } - return ""; - }.property('content.serviceName'), - /** * @type {object} */ @@ -213,8 +182,17 @@ App.QuickViewLinks = Em.View.extend({ setQuickLinksSuccessCallback: function (response) { var serviceName = this.get('content.serviceName'); var hosts = this.getHosts(response, serviceName); - var hasQuickLinks = this.hasQuickLinksConfig(serviceName); - this.set('hasQuickLinksConfiged', hasQuickLinks); // no need to set quicklinks if current service does not have quick links configured... + var hasQuickLinks = this.hasQuickLinksConfig(serviceName, hosts); + var componentName = App.QuickLinksConfig.ServiceComponentMap[serviceName]; + var masterComponent = App.MasterComponent.find().findProperty('componentName', componentName); + var hasHosts = false; + if (masterComponent) { + hasHosts = !!masterComponent.get('totalCount'); + } + // no need to set quicklinks if + // 1)current service does not have quick links configured + // 2)No host component present for the configured quicklink + this.set('showQuickLinks', hasQuickLinks && hasHosts); if (hosts.length === 0){ this.setEmptyLinks(); @@ -253,9 +231,8 @@ App.QuickViewLinks = Em.View.extend({ getQuickLinksConfiguration: function(){ var serviceName = this.get('content.serviceName'); var self = this; - if(self.hasQuickLinksConfig(serviceName)){ - var quickLinksConfiguration = App.QuickLinksConfig.find().findProperty("id", serviceName); - return quickLinksConfiguration; + if (self.hasQuickLinksConfig(serviceName)) { + return App.QuickLinksConfig.find().findProperty("id", serviceName); } return null; }, @@ -539,26 +516,11 @@ App.QuickViewLinks = Em.View.extend({ case "YARN": hosts = this.processYarnHosts(this.findHosts('RESOURCEMANAGER', response)); break; - case "STORM": - hosts = this.findHosts('STORM_UI_SERVER', response); - break; - case "ACCUMULO": - hosts = this.findHosts('ACCUMULO_MONITOR', response); - break; - case "ATLAS": - hosts = this.findHosts('ATLAS_SERVER', response); - break; - case "MAPREDUCE2": - hosts = this.findHosts('HISTORYSERVER', response); - break; - case "AMBARI_METRICS": - hosts = this.findHosts('METRICS_GRAFANA', response); - break; - case "LOGSEARCH": - hosts = this.findHosts('LOGSEARCH_SERVER', response); - break; default: - if (this.getWithDefault('content.hostComponents', []).someProperty('isMaster')) { + var componentName = App.QuickLinksConfig.ServiceComponentMap[serviceName]; + if (componentName) { + hosts = this.findHosts(componentName, response); + } else if (this.getWithDefault('content.hostComponents', []).someProperty('isMaster')) { hosts = this.findHosts(this.get('content.hostComponents').findProperty('isMaster').get('componentName'), response); } break; http://git-wip-us.apache.org/repos/asf/ambari/blob/ef910676/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 index 2b1c08f..a76b1ac 100644 --- a/ambari-web/test/views/common/quick_link_view_test.js +++ b/ambari-web/test/views/common/quick_link_view_test.js @@ -26,19 +26,6 @@ describe('App.QuickViewLinks', function () { content: Em.Object.create() }); - describe("#linkTarget", function () { - it("blank link", function () { - quickViewLinks.set('content.serviceName', 'HDFS'); - quickViewLinks.propertyDidChange('linkTarget'); - expect(quickViewLinks.get('linkTarget')).to.equal('_blank'); - }); - it("non-blank link", function () { - quickViewLinks.set('content.serviceName', 'S1'); - quickViewLinks.propertyDidChange('linkTarget'); - expect(quickViewLinks.get('linkTarget')).to.be.empty; - }); - }); - describe("#ambariProperties", function () { beforeEach(function () { sinon.stub(App.router, 'get').returns({p: 1});
