ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-16184. Fix widget creation screen metrics list bug (Miklos Gergely via oleewere)
Date Tue, 03 May 2016 19:48:34 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 7d0d33a49 -> 311619306


AMBARI-16184. Fix widget creation screen metrics list bug (Miklos Gergely via oleewere)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/31161930
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/31161930
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/31161930

Branch: refs/heads/trunk
Commit: 3116193060c93a676980b74c92d7a752c5f85633
Parents: 7d0d33a
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Tue May 3 21:43:55 2016 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Tue May 3 21:47:00 2016 +0200

----------------------------------------------------------------------
 .../service/widgets/create/expression_view.js   | 33 ++++++++++----------
 1 file changed, 17 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/31161930/ambari-web/app/views/main/service/widgets/create/expression_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/widgets/create/expression_view.js b/ambari-web/app/views/main/service/widgets/create/expression_view.js
index 3688270..32c664f 100644
--- a/ambari-web/app/views/main/service/widgets/create/expression_view.js
+++ b/ambari-web/app/views/main/service/widgets/create/expression_view.js
@@ -312,25 +312,26 @@ App.AddMetricExpressionView = Em.View.extend({
     if (this.get('controller.filteredMetrics')) {
       this.get('controller.filteredMetrics').forEach(function (metric) {
         var service = servicesMap[metric.service_name];
+        if (!service) {
+          service = {
+              count: 0,
+              components: {}
+          };
+          servicesMap[metric.service_name] = service;
+        }
+
         var componentId = masterNames.contains(metric.component_name) ? metric.component_name
+ '_' + metric.level : metric.component_name;
-        if (service) {
-          service.count++;
-          if (service.components[componentId]) {
-            service.components[componentId].count++;
-            service.components[componentId].metrics.push(metric.name);
-          } else {
-            service.components[componentId] = {
-              component_name: metric.component_name,
-              level: metric.level,
-              count: 1,
-              hostComponentCriteria: metric.host_component_criteria,
-              metrics: [metric.name]
-            };
-          }
+        service.count++;
+        if (service.components[componentId]) {
+          service.components[componentId].count++;
+          service.components[componentId].metrics.push(metric.name);
         } else {
-          servicesMap[metric.service_name] = {
+          service.components[componentId] = {
+            component_name: metric.component_name,
+            level: metric.level,
             count: 1,
-            components: {}
+            hostComponentCriteria: metric.host_component_criteria,
+            metrics: [metric.name]
           };
         }
       }, this);


Mime
View raw message