You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/12/09 15:55:27 UTC
svn commit: r1418992 - in /incubator/ambari/branches/AMBARI-666: ./
ambari-web/app/controllers/main/charts/heatmap_metrics/
ambari-web/app/templates/main/charts/heatmap/
ambari-web/app/views/main/charts/heatmap/
Author: yusaku
Date: Sun Dec 9 14:55:26 2012
New Revision: 1418992
URL: http://svn.apache.org/viewvc?rev=1418992&view=rev
Log:
AMBARI-1042. Heatmap UI fluctuates between white and green colors intermittently. (Srimanth Gunturi via yusaku)
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_dfs.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_gctime.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_mapsRunning.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_memHeapUsed.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_reducesRunning.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_memoryused.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_processrun.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host.js
Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Sun Dec 9 14:55:26 2012
@@ -512,6 +512,9 @@ AMBARI-666 branch (unreleased changes)
BUG FIXES
+ AMBARI-1042. Heatmap UI fluctuates between white and green colors
+ intermittently. (Srimanth Gunturi via yusaku)
+
AMBARI-1032. Host hover in cluster heatmap showing mock data. (Srimanth
Gunturi via yusaku)
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js Sun Dec 9 14:55:26 2012
@@ -36,11 +36,43 @@ App.MainChartHeatmapMetric = Em.Object.e
name: null,
/**
- * Number of slots this metric will be mapped into.
+ * Number of slots this metric will be mapped into. When changing this value,
+ * the color count in 'slotColors' should also be changed.
*/
numberOfSlots: 5,
/**
+ * Colors for the each of the number of slots defined above. When changing the
+ * number of slots, the number of colors also should be updated.
+ *
+ * @type {Array}
+ */
+ slotColors: [ {
+ r: 0x00,
+ g: 0xcc,
+ b: 0x00
+ }, // Green
+ {
+ r: 0x9f,
+ g: 0xee,
+ b: 0x00
+ }, {
+ r: 0xff,
+ g: 0xff,
+ b: 0x00
+ }, // Yellow
+ {
+ r: 0xff,
+ g: 0xc0,
+ b: 0x00
+ }, // Orange
+ {
+ r: 0xff,
+ g: 0x00,
+ b: 0x00
+ } ],// Red
+
+ /**
* Minimum value of this metric. Default is 0.
*/
minimumValue: 0,
@@ -52,13 +84,12 @@ App.MainChartHeatmapMetric = Em.Object.e
* 'numberOfSlots'.
*/
maximumValue: 100,
-
+
/**
- * Units of the maximum value which is shown in UI
- * {String}
+ * Units of the maximum value which is shown in UI {String}
*/
units: '',
-
+
/**
* Indicates whether this metric is currently loading data from the server.
* {Boolean}
@@ -71,7 +102,8 @@ App.MainChartHeatmapMetric = Em.Object.e
* <li> from: {number} Slot starts from this value
* <li> to: {number} Slot ends at this value (inclusive)
* <li> label: {String} Slot name to be shown
- * <li> cssStyle: {String} style to be embedded on hosts which fall into this slot.
+ * <li> cssStyle: {String} style to be embedded on hosts which fall into this
+ * slot.
* </ul>
*
* Slot count will be the same as specified in 'numberOfSlots'. Slot
@@ -87,29 +119,29 @@ App.MainChartHeatmapMetric = Em.Object.e
var delta = (max - min) / slotCount;
var defs = [];
var fractions = max < 5;
- var red = 0;
- var green = 255;
+ var slotColors = this.get('slotColors');
+ var slotColorIndex = 0;
for ( var c = 0; c < slotCount - 1; c++) {
var from = this.formatLegendNumber(c * delta);
var to = this.formatLegendNumber((c + 1) * delta);
- var label = from + labelSuffix + " - " + to + labelSuffix
+ var label = from + labelSuffix + " - " + to + labelSuffix;
+ var slotColor = slotColors[slotColorIndex++];
defs.push(Em.Object.create({
from: from,
to: to,
label: label,
- cssStyle: "background-color:rgb(" + red + "," + green + ",0)"
+ cssStyle: "background-color:rgb(" + slotColor.r + "," + slotColor.g + "," + slotColor.b + ")"
}));
- red += 51;
- green -= 51;
}
- var from = this.formatLegendNumber((slotCount - 1) * delta);
- var to = this.formatLegendNumber(max);
- var label = from + labelSuffix + " - " + to + labelSuffix
+ from = this.formatLegendNumber((slotCount - 1) * delta);
+ to = this.formatLegendNumber(max);
+ label = from + labelSuffix + " - " + to + labelSuffix
+ slotColor = slotColors[slotColorIndex++];
defs.push(Em.Object.create({
from: from,
to: to,
label: label,
- cssStyle: "background-color:rgb(" + red + "," + green + ",0)"
+ cssStyle: "background-color:rgb(" + slotColor.r + "," + slotColor.g + "," + slotColor.b + ")"
}));
return defs;
}.property('minimumValue', 'maximumValue', 'numberOfSlots'),
@@ -120,10 +152,10 @@ App.MainChartHeatmapMetric = Em.Object.e
* definition label being '0% - 10%'.
*/
slotDefinitionLabelSuffix: '',
-
+
/**
- * URL template from which metrics will be gotten for all hosts.
- * The {metricName} param will be replaced by the 'defaultMetric' value.
+ * URL template from which metrics will be gotten for all hosts. The
+ * {metricName} param will be replaced by the 'defaultMetric' value.
*/
metricUrlTemplate: "/clusters/{clusterName}/hosts?fields={metricName}",
@@ -158,18 +190,24 @@ App.MainChartHeatmapMetric = Em.Object.e
json.items.forEach(function (item) {
var value = item;
props.forEach(function (prop) {
- value = value[prop];
+ if (value != null && prop in value) {
+ value = value[prop];
+ } else {
+ value = null;
+ }
});
- var hostName = item.Hosts.host_name;
- hostToValueMap[hostName] = value;
+ if (value != null) {
+ var hostName = item.Hosts.host_name;
+ hostToValueMap[hostName] = value;
+ }
});
}
return hostToValueMap;
},
hostToValueMap: null,
-
- hostToSlotMap: function(){
+
+ hostToSlotMap: function () {
var hostToValueMap = this.get('hostToValueMap');
var slotDefs = this.get('slotDefinitions');
var hostToSlotMap = {}
@@ -202,7 +240,7 @@ App.MainChartHeatmapMetric = Em.Object.e
jQuery.ajax({
url: this.get('metricUrl'),
dataType: 'json',
- error: jQuery.proxy(function (xhr, textStatus, error) {
+ error: jQuery.proxy(function () {
this.set('loading', false);
}, this),
success: jQuery.proxy(function (data) {
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_dfs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_dfs.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_dfs.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_dfs.js Sun Dec 9 14:55:26 2012
@@ -35,15 +35,19 @@ App.MainChartHeatmapDFSMetrics = App.Mai
json.host_components.forEach(function (hc) {
var value = hc;
props.forEach(function (prop) {
- value = value[prop];
+ if (value != null && prop in value) {
+ value = value[prop];
+ } else {
+ value = null;
+ }
});
-
- if (transformValueFunction) {
- value = transformValueFunction(value);
+ if (value != null) {
+ if (transformValueFunction) {
+ value = transformValueFunction(value);
+ }
+ var hostName = hc.HostRoles.host_name;
+ hostToValueMap[hostName] = value;
}
-
- var hostName = hc.HostRoles.host_name;
- hostToValueMap[hostName] = value;
});
}
return hostToValueMap;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_diskspaceused.js Sun Dec 9 14:55:26 2012
@@ -34,15 +34,19 @@ App.MainChartHeatmapDiskSpaceUsedMetric
json.items.forEach(function (item) {
var value = item;
props.forEach(function (prop) {
- value = value[prop];
+ if (value != null && prop in value) {
+ value = value[prop];
+ } else {
+ value = null;
+ }
});
-
- var total = value.disk_total;
- var free = value.disk_free;
- value = (((total - free) * 100) / total).toFixed(1);
-
- var hostName = item.Hosts.host_name;
- hostToValueMap[hostName] = value;
+ if (value != null) {
+ var total = value.disk_total;
+ var free = value.disk_free;
+ value = (((total - free) * 100) / total).toFixed(1);
+ var hostName = item.Hosts.host_name;
+ hostToValueMap[hostName] = value;
+ }
});
}
return hostToValueMap;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce.js Sun Dec 9 14:55:26 2012
@@ -35,15 +35,19 @@ App.MainChartHeatmapMapreduceMetrics = A
json.host_components.forEach(function (hc) {
var value = hc;
props.forEach(function (prop) {
- value = value[prop];
+ if (value != null && prop in value) {
+ value = value[prop];
+ } else {
+ value = null;
+ }
});
-
- if (transformValueFunction) {
- value = transformValueFunction(value);
+ if (value != null) {
+ if (transformValueFunction) {
+ value = transformValueFunction(value);
+ }
+ var hostName = hc.HostRoles.host_name;
+ hostToValueMap[hostName] = value;
}
-
- var hostName = hc.HostRoles.host_name;
- hostToValueMap[hostName] = value;
});
}
return hostToValueMap;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_gctime.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_gctime.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_gctime.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_gctime.js Sun Dec 9 14:55:26 2012
@@ -20,7 +20,7 @@ var App = require('app');
/**
*
*/
-App.MainChartHeatmapMapreduceGCTimeMillisMetric = App.MainChartHeatmapDFSMetrics.extend({
+App.MainChartHeatmapMapreduceGCTimeMillisMetric = App.MainChartHeatmapMapreduceMetrics.extend({
name: 'Garbage Collection Time',
maximumValue: 10000,
defaultMetric: 'metrics.jvm.gcTimeMillis',
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_mapsRunning.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_mapsRunning.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_mapsRunning.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_mapsRunning.js Sun Dec 9 14:55:26 2012
@@ -20,7 +20,7 @@ var App = require('app');
/**
*
*/
-App.MainChartHeatmapMapreduceMapsRunningMetric = App.MainChartHeatmapDFSMetrics.extend({
+App.MainChartHeatmapMapreduceMapsRunningMetric = App.MainChartHeatmapMapreduceMetrics.extend({
name: 'Maps Running',
maximumValue: 100,
defaultMetric: 'metrics.mapred.tasktracker.maps_running',
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_memHeapUsed.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_memHeapUsed.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_memHeapUsed.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_memHeapUsed.js Sun Dec 9 14:55:26 2012
@@ -20,7 +20,7 @@ var App = require('app');
/**
*
*/
-App.MainChartHeatmapMapreduceMemHeapUsedMetric = App.MainChartHeatmapDFSMetrics.extend({
+App.MainChartHeatmapMapreduceMemHeapUsedMetric = App.MainChartHeatmapMapreduceMetrics.extend({
name: 'JVM Heap Memory Used',
maximumValue: 512,
defaultMetric: 'metrics.jvm.memHeapUsedM',
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_reducesRunning.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_reducesRunning.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_reducesRunning.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_mapreduce_reducesRunning.js Sun Dec 9 14:55:26 2012
@@ -20,7 +20,7 @@ var App = require('app');
/**
*
*/
-App.MainChartHeatmapMapreduceReducesRunningMetric = App.MainChartHeatmapDFSMetrics.extend({
+App.MainChartHeatmapMapreduceReducesRunningMetric = App.MainChartHeatmapMapreduceMetrics.extend({
name: 'Reduces Running',
maximumValue: 100,
defaultMetric: 'metrics.mapred.tasktracker.reduces_running',
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_memoryused.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_memoryused.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_memoryused.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_memoryused.js Sun Dec 9 14:55:26 2012
@@ -43,15 +43,19 @@ App.MainChartHeatmapMemoryUsedMetric = A
json.items.forEach(function (item) {
var value = item;
props.forEach(function (prop) {
- value = value[prop];
+ if (value != null && prop in value) {
+ value = value[prop];
+ } else {
+ value = null;
+ }
});
-
- var total = value.mem_total;
- var used = value.mem_total - value.mem_free;
- value = ((used * 100) / total).toFixed(1);
-
- var hostName = item.Hosts.host_name;
- hostToValueMap[hostName] = value;
+ if (value != null) {
+ var total = value.mem_total;
+ var used = value.mem_total - value.mem_free;
+ value = ((used * 100) / total).toFixed(1);
+ var hostName = item.Hosts.host_name;
+ hostToValueMap[hostName] = value;
+ }
});
}
return hostToValueMap;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_processrun.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_processrun.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_processrun.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_processrun.js Sun Dec 9 14:55:26 2012
@@ -37,8 +37,10 @@ App.MainChartHeatmapProcessRunMetric = A
metricMapper: function (json) {
var map = this._super(json);
for ( var host in map) {
- var val = map[host];
- map[host] = val.toFixed(1);
+ if (host in map) {
+ var val = map[host];
+ map[host] = val.toFixed(1);
+ }
}
return map;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host.hbs?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host.hbs Sun Dec 9 14:55:26 2012
@@ -16,6 +16,6 @@
* limitations under the License.
}}
-<div {{bindAttr class="view.content.healthStatus view.hostClass"}} {{bindAttr style="view.hostTemperatureStyle"}}>
+<div {{bindAttr class="view.hostClass"}} {{bindAttr style="view.hostTemperatureStyle"}}>
<a href="#" class="heatmap-host" {{action "routeHostDetail" view.content target="controller"}}></a>
</div>
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host.js?rev=1418992&r1=1418991&r2=1418992&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host.js Sun Dec 9 14:55:26 2012
@@ -1,45 +1,53 @@
/**
- * 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
- *
+ * 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.
+ * 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');
App.MainChartsHeatmapHostView = Em.View.extend({
templateName: require('templates/main/charts/heatmap/heatmap_host'),
- /** @private */ hostClass: 'hostBlock',
+ /** @private */
+ hostClass: 'hostBlock',
/**
* show Host details block and move it near the cursor
- * @param {Object} e
+ *
+ * @param {Object}
+ * e
* @this App.MainChartsHeatmapHostView
*/
- mouseEnter:function (e) {
+ mouseEnter: function (e) {
var host = this.get('content');
var view = App.MainChartsHeatmapHostDetailView.create();
$.each(view.get('details'), function (i) {
view.set('details.' + i, host.get(i));
});
var selectedMetric = this.get('controller.selectedMetric');
- if(selectedMetric){
+ if (selectedMetric) {
var metricName = selectedMetric.get('name');
var h2vMap = selectedMetric.get('hostToValueMap');
- if(h2vMap && metricName){
+ if (h2vMap && metricName) {
+ var value = h2vMap[host.get('hostName')];
+ if (value == undefined || value == null) {
+ value = "Unknown";
+ } else {
+ value = value + selectedMetric.get('units')
+ }
view.set('details.metricName', metricName);
- view.set('details.metricValue', h2vMap[host.get('hostName')]+selectedMetric.get('units'));
+ view.set('details.metricValue', value);
}
}
var detailsBlock = $("#heatmapDetailsBlock");
@@ -50,23 +58,25 @@ App.MainChartsHeatmapHostView = Em.View.
/**
* hide Host details block
- * @param {Object} e
+ *
+ * @param {Object}
+ * e
* @this App.MainChartsHeatmapHostView
*/
- mouseLeave:function (e) {
+ mouseLeave: function (e) {
$("#heatmapDetailsBlock").hide();
},
-
- hostTemperatureStyle: function(){
+
+ hostTemperatureStyle: function () {
var controller = this.get('controller');
var h2sMap = controller.get('hostToSlotMap');
- if(h2sMap){
+ if (h2sMap) {
var hostname = this.get('content.hostName');
- if(hostname){
+ if (hostname) {
var slot = h2sMap[hostname];
- if(slot>-1){
+ if (slot > -1) {
var slotDefs = controller.get('selectedMetric.slotDefinitions');
- if(slotDefs && slotDefs.length>slot){
+ if (slotDefs && slotDefs.length > slot) {
return slotDefs[slot].get('cssStyle');
}
}