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 14:52:35 UTC
svn commit: r1418957 [2/2] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-web/app/ ambari-web/app/assets/data/hosts/
ambari-web/app/assets/data/racks/ ambari-web/app/controllers/main/charts/
ambari-web/app/controllers/main/charts/heatmap_metrics...
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/racks_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/racks_mapper.js?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/racks_mapper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/racks_mapper.js Sun Dec 9 13:52:32 2012
@@ -1,19 +1,18 @@
/**
- * 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.
*/
@@ -21,11 +20,11 @@ App.racksMapper = App.QuickDataMapper.cr
model: App.Rack,
config: {
id: "Racks.id",
- name: "Racks.name",
- $hosts: ["host01", "host06", "host05"],
- status: "Racks.status",
- live_hosts_count: "Racks.live_hosts_count",
- critical_hosts_count: "Racks.critical_hosts_count",
- dead_hosts_count: "Racks.dead_hosts_count"
+ name: "Racks.name"
+ //$hosts: ["host01", "host06", "host05"],
+ //status: "Racks.status",
+ //live_hosts_count: "Racks.live_hosts_count",
+ //critical_hosts_count: "Racks.critical_hosts_count",
+ //dead_hosts_count: "Racks.dead_hosts_count"
}
});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js Sun Dec 9 13:52:32 2012
@@ -261,6 +261,11 @@ Em.I18n.translations = {
'charts.horizon.chart.attributes.memory':'Memory',
'charts.horizon.chart.attributes.network':'Network',
'charts.horizon.chart.attributes.io':'I/O',
+
+ 'charts.heatmap.category.host':'Host',
+ 'charts.heatmap.item.host.memory':'Memory Free',
+ 'charts.heatmap.item.host.disk':'Disk Space Used',
+ 'charts.heatmap.item.host.process':'Total Running Processes',
'metric.default':'combined',
'metric.cpu':'cpu',
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/models/rack.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models/rack.js?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models/rack.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models/rack.js Sun Dec 9 13:52:32 2012
@@ -21,11 +21,21 @@ var App = require('app');
App.Rack = DS.Model.extend({
name: DS.attr('string'),
- hosts: DS.hasMany('App.Host'),
status: DS.attr('string'),
- liveHostsCount: DS.attr('number'),
criticalHostsCount: DS.attr('number'),
- deadHostsCount: DS.attr('number')
+ deadHostsCount: DS.attr('number'),
+ hosts: function(){
+ return App.Host.find();
+ }.property('name'),
+ liveHostsCount: function(){
+ var count = 0;
+ this.get('hosts').forEach(function(host){
+ if(host.get('healthStatus')=="HEALTHY"){
+ count++;
+ }
+ });
+ return count;
+ }.property('hosts')
});
App.Rack.FIXTURES = [
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less Sun Dec 9 13:52:32 2012
@@ -1210,7 +1210,7 @@ ul.filter {
/*start charts rack*/
.rack {
- width: 224px;
+ width: 98%;
display: inline-block;
vertical-align: top;
border: 1px solid #D4D4D4;
@@ -1320,23 +1320,23 @@ ul.filter {
.ember-view {
float: left;
- width: 43px;
+ width: 100%;
height: 43px;
.hostBlock {
- margin: 4px;
- width: 35px;
- height: 35px;
+ height: 38px;
position: relative;
+ border: 1px solid #D4D4D4;
+ margin-right: 3px;
}
}
.hostBlock {
border-radius: 4px;
}
- .hostBlock.LIVE {
+ .hostBlock.HEALTHY {
background-color: #87BE73;
}
- .hostBlock.DEAD {
+ .hostBlock.UNHEALTHY {
background-color: #E40024;
}
.hostBlock.CRITICAL {
@@ -1395,12 +1395,34 @@ ul.filter {
line-height: 1.6em;
border: 1px solid #D9D9D9;
background: #f9f9f9;
- width: 100px;
- height: 100px;
+ width: 280px;
+ height: 170px;
padding: 10px 10px;
position: absolute;
z-index: 1000;
}
+ .container-fluid{
+ padding: 0px;
+ }
+ .row-fluid [class*="span"]{
+ margin-left: 0px;
+ }
+ .legend{
+ margin-top: 20px;
+ margin-bottom: 20px;
+ .tile{
+ width: 50px;
+ height: 1em;
+ padding: 4px;
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ margin-right: 10px;
+ }
+ }
+
+ h4{
+ color: #777;
+ }
}
/*End Heatmap*/
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts.hbs?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts.hbs Sun Dec 9 13:52:32 2012
@@ -16,7 +16,4 @@
* limitations under the License.
}}
-{{view App.MetricFilteringWidget controllerBinding="App.router.mainChartsController"}}
-{{view App.TimeRangeWidget controllerBinding="App.router.mainChartsController"}}
-{{view App.MainChartsMenuView}}
{{outlet}}
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap.hbs?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap.hbs Sun Dec 9 13:52:32 2012
@@ -17,8 +17,60 @@
}}
<div class="heatmap">
- {{#each rack in controller.cluster.racks}}
- {{view App.MainChartsHeatmapRackView rackBinding="rack" visualSchemaBinding="controller.visualSchema"}}
- {{/each}}
- {{view App.MainChartsHeatmapHostDetailView}}
+
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span2">
+ <div class="btn-group">
+ <button class="btn">Select Metric...</button>
+ <button class="btn dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {{#each category in controller.allMetrics}}
+ <li class="dropdown-submenu">
+ <a tabindex="-1" href="#">{{category.label}}</a>
+ <ul class="dropdown-menu">
+ {{#each metric in category.items}}
+ <li>
+ <a tabindex="-1" {{action showHeatMapMetric metric target="controller"}}>{{metric.name}}</a>
+ </li>
+ {{/each}}
+ </ul>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
+ {{#if controller.selectedMetric}}
+ <table class="legend">
+ {{#each slot in controller.selectedMetric.slotDefinitions}}
+ <tr>
+ <td>
+ <div class="tile" {{bindAttr style="slot.cssStyle"}}></div>
+ </td>
+ <td>{{slot.label}}</td>
+ </tr>
+ {{/each}}
+ </table>
+ Maximum:
+ <div>
+ {{view Ember.TextField type="text" valueBinding="controller.selectedMetric.maximumValue" class="span6"}}
+ {{controller.selectedMetric.units}}
+ </div>
+ {{/if}}
+ </div>
+ <div class="span10">
+ <h4>{{controller.selectedMetric.name}}</h4>
+ <div class="row-fluid">
+ {{#each rack in controller.cluster.racks}}
+ <div {{bindAttr class="controller.rackClass"}}>
+ {{view App.MainChartsHeatmapRackView rackBinding="rack" }}
+ </div>
+ {{/each}}
+ </div>
+ {{view App.MainChartsHeatmapHostDetailView}}
+ </div>
+ </div>
+ </div>
+
</div>
\ No newline at end of file
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=1418957&r1=1418956&r2=1418957&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 13:52:32 2012
@@ -16,4 +16,4 @@
* limitations under the License.
}}
-<div {{bindAttr class="view.content.healthStatus view.hostClass"}}></div>
\ No newline at end of file
+<div {{bindAttr class="view.content.healthStatus view.hostClass"}} {{bindAttr style="view.hostTemperatureStyle"}}></div>
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host_detail.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host_detail.hbs?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host_detail.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_host_detail.hbs Sun Dec 9 13:52:32 2012
@@ -16,7 +16,12 @@
* limitations under the License.
}}
-<h6>{{view.details.name}}</h6>
+<b>{{view.details.hostName}}</b><br/>
+OS: {{view.details.osType}}<br/>
+IP: {{view.details.ip}}<br/>
+{{#if view.details.metricName}}
+{{view.details.metricName}}: {{view.details.metricValue}}<br/>
+{{/if}}
CPU: {{view.details.cpuUsage}}%<br/>
Memory: {{view.details.memoryUsage}}%<br/>
Network: {{view.details.networkUsage}}%<br/>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_rack.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_rack.hbs?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_rack.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/heatmap/heatmap_rack.hbs Sun Dec 9 13:52:32 2012
@@ -44,6 +44,8 @@
<!--</div>-->
<div {{bindAttr class="view.heatmapTogglerClass view.hostsBlockClass"}}>
{{#each rack.hosts}}
- {{view App.MainChartsHeatmapHostView contentBinding="this"}}
+ <div {{bindAttr style="view.hostCssStyle"}}>
+ {{view App.MainChartsHeatmapHostView contentBinding="this"}}
+ </div>
{{/each}}
</div>
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap.js?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap.js Sun Dec 9 13:52:32 2012
@@ -19,5 +19,9 @@
var App = require('app');
App.MainChartsHeatmapView = Em.View.extend({
- templateName: require('templates/main/charts/heatmap')
+ templateName: require('templates/main/charts/heatmap'),
+ didInsertElement: function(){
+ this._super();
+ $("#heatmapDetailsBlock").hide();
+ }
});
\ 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=1418957&r1=1418956&r2=1418957&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 13:52:32 2012
@@ -33,10 +33,19 @@ App.MainChartsHeatmapHostView = Em.View.
$.each(view.get('details'), function (i) {
view.set('details.' + i, host.get(i));
});
- $("#heatmapDetailsBlock").css('top', e.pageY + 10);
- $("#heatmapDetailsBlock").css('left', e.pageX + 10);
-
- $("#heatmapDetailsBlock").show();
+ var selectedMetric = this.get('controller.selectedMetric');
+ if(selectedMetric){
+ var metricName = selectedMetric.get('name');
+ var h2vMap = selectedMetric.get('hostToValueMap');
+ if(h2vMap && metricName){
+ view.set('details.metricName', metricName);
+ view.set('details.metricValue', h2vMap[host.get('hostName')]+selectedMetric.get('units'));
+ }
+ }
+ var detailsBlock = $("#heatmapDetailsBlock");
+ detailsBlock.css('top', e.pageY + 10);
+ detailsBlock.css('left', e.pageX + 10);
+ detailsBlock.show();
},
/**
@@ -46,5 +55,23 @@ App.MainChartsHeatmapHostView = Em.View.
*/
mouseLeave:function (e) {
$("#heatmapDetailsBlock").hide();
- }
+ },
+
+ hostTemperatureStyle: function(){
+ var controller = this.get('controller');
+ var h2sMap = controller.get('hostToSlotMap');
+ if(h2sMap){
+ var hostname = this.get('content.hostName');
+ if(hostname){
+ var slot = h2sMap[hostname];
+ if(slot>-1){
+ var slotDefs = controller.get('selectedMetric.slotDefinitions');
+ if(slotDefs && slotDefs.length>slot){
+ return slotDefs[slot].get('cssStyle');
+ }
+ }
+ }
+ }
+ return '';
+ }.property('controller.hostToSlotMap')
});
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host_detail.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host_detail.js?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host_detail.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_host_detail.js Sun Dec 9 13:52:32 2012
@@ -20,10 +20,14 @@ var App = require('app');
App.MainChartsHeatmapHostDetailView = Em.View.extend({
templateName: require('templates/main/charts/heatmap/heatmap_host_detail'),
- /** @private */ classNames:['heatmap_host_details', 'hide'],
+ /** @private */ classNames:['heatmap_host_details'],
/** @private */ elementId:'heatmapDetailsBlock',
/** @private */ details:{
hostName:'test node',
+ osType: 'OS',
+ ip: '192.168.0.0',
+ metricName: 'metric-name',
+ metricValue: 'metric-value',
cpuUsage: '10',
memoryUsage: '10',
networkUsage: '30',
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_rack.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_rack.js?rev=1418957&r1=1418956&r2=1418957&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_rack.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/charts/heatmap/heatmap_rack.js Sun Dec 9 13:52:32 2012
@@ -46,5 +46,21 @@ App.MainChartsHeatmapRackView = Em.View.
return "isActive"
}
return "";
- }.property("heatmapIsOpened")
+ }.property("heatmapIsOpened"),
+
+ /**
+ * Provides the CSS style for an individual host.
+ * This can be used as the 'style' attribute of element.
+ */
+ hostCssStyle: function(){
+ var rack = this.get('rack');
+ var widthPercent = 100;
+ var hostCount = rack.get('hosts.length');
+ if(hostCount<11){
+ widthPercent = (100/hostCount)-0.5;
+ }else{
+ widthPercent = 10; // max out at 10%
+ }
+ return "width:"+widthPercent+"%;float:left;";
+ }.property('rack')
});
\ No newline at end of file