You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by GitBox <gi...@apache.org> on 2018/11/14 23:26:43 UTC

[GitHub] ishanbha closed pull request #10: [AMBARI-24898] Add cluster drop down to Grafana aggregate dashboards.

ishanbha closed pull request #10: [AMBARI-24898] Add cluster drop down to Grafana aggregate dashboards.
URL: https://github.com/apache/ambari-metrics/pull/10
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ambari-metrics-grafana/ambari-metrics/datasource.js b/ambari-metrics-grafana/ambari-metrics/datasource.js
index 6e14f33..c6885da 100644
--- a/ambari-metrics-grafana/ambari-metrics/datasource.js
+++ b/ambari-metrics-grafana/ambari-metrics/datasource.js
@@ -689,14 +689,9 @@ define([
             });
           }
           // To speed up querying on templatized dashboards.
-          var indexOfHosts = -1;
-          for (var i = 0; i < templateSrv.variables.length; i++) {
-            if (templateSrv.variables[i].name == 'hosts' && templateSrv.index.hosts) {
-              indexOfHosts = i;
-            }
-          }
-          if (indexOfHosts >= 0) {
-            let allHosts = [];
+          let allHosts;
+          if (templateSrv.index.hosts) {
+            allHosts = [];
             const hosts = templateSrv.index.hosts.options
             for (let host of hosts) {
               if (host.text.toLowerCase() === "all" && host.selected) {
@@ -705,13 +700,13 @@ define([
               } else if (host.selected) {
                 allHosts.push(host.text);
               }
-            };
-            metricsPromises.push(_.map(options.targets, function (target) {
-              target.templatedHost = allHosts ? allHosts : '';
-              target.templatedCluster = templatedCluster;
-              return getAllHostData(target);
-            }));
+            }
           }
+          metricsPromises.push(_.map(options.targets, function (target) {
+            target.templatedHost = allHosts ? allHosts : '';
+            target.templatedCluster = templatedCluster;
+            return getAllHostData(target);
+          }));
           metricsPromises = _.flatten(metricsPromises);
         } else {
           // Non Templatized Dashboards


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services