AMBARI-14976 Add Grafana QuickLinks for AMS Service in Ambari Web. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a638ccb5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a638ccb5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a638ccb5 Branch: refs/heads/branch-dev-patch-upgrade Commit: a638ccb5345cb7f34e2c42b075c33cf3814565db Parents: 7d1ab29 Author: Andrii Tkach <atk...@hortonworks.com> Authored: Wed Feb 10 16:19:33 2016 +0200 Committer: Andrii Tkach <atk...@hortonworks.com> Committed: Thu Feb 11 21:19:13 2016 +0200 ---------------------------------------------------------------------- .../AMBARI_METRICS/0.1.0/metainfo.xml | 7 ++++ .../0.1.0/quickLinks/quicklinks.json | 34 ++++++++++++++++++++ .../app/mappers/service_metrics_mapper.js | 3 +- ambari-web/app/models/quick_links.js | 12 +++++++ .../app/views/common/quick_view_link_view.js | 3 ++ .../test/views/common/quick_link_view_test.js | 5 +++ 6 files changed, 63 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a638ccb5/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml index 3a832eb..67a93a5 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml @@ -161,6 +161,13 @@ <config-type>storm-site</config-type> </excluded-config-types> + <quickLinksConfigurations> + <quickLinksConfiguration> + <fileName>quicklinks.json</fileName> + <default>true</default> + </quickLinksConfiguration> + </quickLinksConfigurations> + </service> </services> </metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/a638ccb5/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/quickLinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/quickLinks/quicklinks.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/quickLinks/quicklinks.json new file mode 100644 index 0000000..09e7de5 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/quickLinks/quicklinks.json @@ -0,0 +1,34 @@ +{ + "name": "default", + "description": "default quick links configuration", + "configuration": { + "protocol": + { + "type":"https", + "checks":[ + { + "property":"protocol", + "desired":"https", + "site":"ams-grafana-ini" + } + ] + }, + "links": [ + { + "name": "metrics_ui_server", + "label": "Metrics UI Server", + "requires_user_name": "false", + "url":"%@://%@:%@", + "template":"%@://%@:%@", + "port":{ + "http_property": "port", + "http_default_port": "3000", + "https_property": "port", + "https_default_port": "3000", + "regex": "^(\\d+)$", + "site": "ams-grafana-ini" + } + } + ] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/a638ccb5/ambari-web/app/mappers/service_metrics_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js index 1ac2b54..80e86c6 100644 --- a/ambari-web/app/mappers/service_metrics_mapper.js +++ b/ambari-web/app/mappers/service_metrics_mapper.js @@ -387,7 +387,8 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({ RANGER: [33], SPARK: [34], ACCUMULO: [35], - ATLAS: [36] + ATLAS: [36], + AMBARI_METRICS: [37] }; if (quickLinks[item.ServiceInfo.service_name]) finalJson.quick_links = quickLinks[item.ServiceInfo.service_name]; http://git-wip-us.apache.org/repos/asf/ambari/blob/a638ccb5/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 eb9dfd6..f6c1fb5 100644 --- a/ambari-web/app/models/quick_links.js +++ b/ambari-web/app/models/quick_links.js @@ -343,6 +343,18 @@ App.QuickLinks.FIXTURES = [ regex: '^(\\d+)$', default_http_port: 21000, default_https_port: 21443 + }, + { + id:37, + label:'Metrics UI Server', + url:'%@://%@:%@', + service_id: 'AMBARI_METRICS', + template:'%@://%@:%@', + http_config: 'port', + site: 'ams-grafana-ini', + regex: '^(\\d+)$', + default_http_port: 3000, + default_https_port: 3000 } ]; http://git-wip-us.apache.org/repos/asf/ambari/blob/a638ccb5/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 1eef254..2123668 100644 --- a/ambari-web/app/views/common/quick_view_link_view.js +++ b/ambari-web/app/views/common/quick_view_link_view.js @@ -549,6 +549,9 @@ App.QuickViewLinks = Em.View.extend({ case "MAPREDUCE2": hosts = this.findHosts('HISTORYSERVER', response); break; + case "AMBARI_METRICS": + hosts = this.findHosts('METRICS_GRAFANA', response); + break; default: if (this.getWithDefault('content.hostComponents', []).someProperty('isMaster')) { hosts = this.findHosts(this.get('content.hostComponents').findProperty('isMaster').get('componentName'), response); http://git-wip-us.apache.org/repos/asf/ambari/blob/a638ccb5/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 3a604fe..b9050f8 100644 --- a/ambari-web/test/views/common/quick_link_view_test.js +++ b/ambari-web/test/views/common/quick_link_view_test.js @@ -959,6 +959,11 @@ describe('App.QuickViewLinks', function () { expect(quickViewLinks.findHosts.calledWith('HISTORYSERVER', {})).to.be.true; }); + it("AMBARI_METRICS service", function() { + expect(quickViewLinks.getHosts({}, 'AMBARI_METRICS')).to.eql(['host1']); + expect(quickViewLinks.findHosts.calledWith('METRICS_GRAFANA', {})).to.be.true; + }); + it("custom service without master", function() { expect(quickViewLinks.getHosts({}, 'S1')).to.be.empty; });