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/10/29 02:15:14 UTC
svn commit: r1403140 - in /incubator/ambari/branches/AMBARI-666:
AMBARI-666-CHANGES.txt
ambari-web/app/controllers/main/service/info/summary.js
ambari-web/app/templates/main/service/info/summary.hbs
ambari-web/app/views/main/service/info/summary.js
Author: yusaku
Date: Mon Oct 29 01:15:14 2012
New Revision: 1403140
URL: http://svn.apache.org/viewvc?rev=1403140&view=rev
Log:
AMBARI-933. Provide service-specific alerts in the service summary pages. (Srimanth Gunturi via yusaku)
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/summary.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.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=1403140&r1=1403139&r2=1403140&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Mon Oct 29 01:15:14 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
NEW FEATURES
+ AMBARI-933. Provide service-specific alerts in the service summary
+ pages. (Srimanth Gunturi via yusaku)
+
AMBARI-938. Hardcode service name and client component mapping while
awaiting meta data integration. (hitesh)
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/summary.js?rev=1403140&r1=1403139&r2=1403140&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/summary.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/summary.js Mon Oct 29 01:15:14 2012
@@ -1,23 +1,32 @@
/**
- * 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.MainServiceInfoSummaryController = Em.Controller.extend({
- name: 'mainServiceInfoSummaryController'
-})
\ No newline at end of file
+ name: 'mainServiceInfoSummaryController',
+ allAlerts: App.Alert.find(),
+ alerts: function () {
+ var serviceId = this.get('content.serviceName');
+ if (serviceId) {
+ return this.get('allAlerts').filter(function (item) {
+ return item.get('serviceType').toLowerCase() == serviceId;
+ });
+ }
+ return [];
+ }.property('allAlerts', 'content.serviceName')
+});
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs?rev=1403140&r1=1403139&r2=1403140&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs Mon Oct 29 01:15:14 2012
@@ -235,16 +235,34 @@
<a class="btn" href="http://nagiosserver/nagios" target="_blank" rel="tooltip" title="Go to Nagios"><i class="icon-link"></i></a>
</div>
</div>
- <ul class="alerts">
- {{#each controller.content.alerts}}
- <li class="status-{{unbound status}}">
- <p><span class="title">{{title}}</span> <a href="javascript:void(null)">{{service.label}}</a><span class="date-time">{{date}}</span></p>
- <p><span>{{status}}:</span> <span>{{message}}</span></p>
- </li>
+ <ul id='summary-alerts-list' class="alerts">
+ {{#each controller.alerts}}
+ <li class="status-{{unbound status}}">
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span1 status-icon">
+ {{#if isOk}}
+ <i class="icon-ok icon-large"></i>
+ {{else}}
+ <i class="icon-remove icon-large"></i>
+ {{/if}}
+ </div>
+ <div class="span11">
+ <div class="row-fluid">
+ <div class="span7 title">{{title}}
+ </div>
+ <div class="span5 date-time">{{dateDisplay}}</div>
+ </div>
+ <div class="row-fluid message">{{message}}</div>
+ </div>
+ </div>
+ </div>
+ </li>
{{/each}}
</ul>
</div>
</div>
+</div>
<div class="row-fluid">
<div class="span12">
<div class="box">
@@ -253,7 +271,7 @@
</div>
<div class="summary-metric-graphs row-fluid">
- {{#each graph in view.attributes.metricGraphViews}}
+ {{#each graph in view.attributes.metric_graph_views}}
<div class="span3">
{{view graph}}
</div>
@@ -263,4 +281,3 @@
</div>
</div>
</div>
-</div>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js?rev=1403140&r1=1403139&r2=1403140&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js Mon Oct 29 01:15:14 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.
*/
var App = require('app');
@@ -26,21 +25,11 @@ App.MainServiceInfoSummaryView = Em.View
mapreduce: false,
hbase: false
},
-
- alerts: function(){
- var serviceId = this.get('service.id');
- if(serviceId) {
- return App.Alert.find({'service_id':serviceId });
- }
- return [];
-// return App.router.get('mainServiceInfoSummaryController.content.alerts');
- }.property('App.router.mainServiceInfoSummaryController.content.alerts'),
-
- controller: function(){
+ controller: function () {
return App.router.get('mainServiceInfoSummaryController');
}.property(),
- service: function(){
+ service: function () {
return this.get('controller.content');
}.property('controller.content'),
@@ -48,26 +37,26 @@ App.MainServiceInfoSummaryView = Em.View
moreStatsView: Em.View.extend({
tagName: "a",
template: Ember.Handlebars.compile('{{t services.service.summary.moreStats}}'),
- attributeBindings: ['href'],
- classNames: ['more-stats'],
- click: function(event) {
+ attributeBindings: [ 'href' ],
+ classNames: [ 'more-stats' ],
+ click: function (event) {
this._parentView._parentView.set('isHide', false);
this.remove();
},
href: 'javascript:void(null)'
}),
- serviceName: function() {
+ serviceName: function () {
return App.router.mainServiceInfoSummaryController.get('content.serviceName');
}.property('App.router.mainServiceInfoSummaryController.content'),
- init: function() {
+ init: function () {
this._super();
if (this.get('serviceName'))
this.loadServiceSummary(this.get('serviceName'));
},
- loadServiceSummary: function(serviceName) {
+ loadServiceSummary: function (serviceName) {
var summaryView = this;
var serviceStatus = summaryView.get('serviceStatus');
- $.each(serviceStatus, function(key, value) {
+ $.each(serviceStatus, function (key, value) {
if (key == serviceName) {
summaryView.set('serviceStatus.' + key, true);
} else {
@@ -75,47 +64,59 @@ App.MainServiceInfoSummaryView = Em.View
}
});
- jQuery.getJSON('data/services/summary/' + serviceName + '.json',
- function (data) {
- if (data[serviceName]) {
- var summary = data[serviceName];
- if(serviceName == 'hdfs') {
- summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
- summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
- summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
- summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
- summary['dfs_percent_disk_used'] = parseFloat((100 - summary['dfs_percent_remaining']).toFixed(2)) + "%";
- summary['used_bytes'] = (summary['dfs_used_bytes'] + summary['nondfs_used_bytes']).bytesToSize(2, 'parseFloat');
- summary['dfs_total_bytes'] = summary['dfs_total_bytes'].bytesToSize(2, 'parseFloat');
- summary['metricGraphViews'] = [App.ChartServiceMetricsHDFS_JVMThreads.extend(),
- App.ChartServiceMetricsHDFS_JVMHeap.extend(),
- App.ChartServiceMetricsHDFS_IO.extend(),
- App.ChartServiceMetricsHDFS_RPC.extend(),
- App.ChartServiceMetricsHDFS_FileOperations.extend(),
- App.ChartServiceMetricsHDFS_GC.extend()];
- } else if (serviceName == 'mapreduce') {
- summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
- summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
- summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
- summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
- summary['metricGraphViews'] = [App.ChartServiceMetricsMapReduce_JobsStatus.extend(),
- App.ChartServiceMetricsMapReduce_JobsRunningWaiting.extend(),
- App.ChartServiceMetricsMapReduce_MapSlots.extend(),
- App.ChartServiceMetricsMapReduce_ReduceSlots.extend(),
- App.ChartServiceMetricsMapReduce_JVMHeap.extend(),
- App.ChartServiceMetricsMapReduce_JVMThreads.extend(),
- App.ChartServiceMetricsMapReduce_GC.extend(),
- App.ChartServiceMetricsMapReduce_RPC.extend()];
- } else if (serviceName == 'hbase') {
- summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
- summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
- summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
- summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
- summary['active_time'] = summary['active_time'].toDaysHoursMinutes();
- }
- summaryView.set('attributes', summary);
+ jQuery.getJSON('data/services/summary/' + serviceName + '.json', function (data) {
+ if (data[serviceName]) {
+ var summary = data[serviceName];
+ if (serviceName == 'hdfs') {
+ summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
+ summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
+ summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
+ summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
+ summary['dfs_percent_disk_used'] = parseFloat((100 - summary['dfs_percent_remaining']).toFixed(2)) + "%";
+ summary['used_bytes'] = (summary['dfs_used_bytes'] + summary['nondfs_used_bytes']).bytesToSize(2, 'parseFloat');
+ summary['dfs_total_bytes'] = summary['dfs_total_bytes'].bytesToSize(2, 'parseFloat');
+ summary['metric_graph_views'] = [ App.ChartServiceMetricsHDFS_JVMThreads.extend(),
+ App.ChartServiceMetricsHDFS_JVMHeap.extend(),
+ App.ChartServiceMetricsHDFS_IO.extend(),
+ App.ChartServiceMetricsHDFS_RPC.extend(),
+ App.ChartServiceMetricsHDFS_FileOperations.extend(),
+ App.ChartServiceMetricsHDFS_GC.extend() ];
+ } else if (serviceName == 'mapreduce') {
+ summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
+ summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
+ summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
+ summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
+ summary['metric_graph_views'] = [ App.ChartServiceMetricsMapReduce_JobsStatus.extend(),
+ App.ChartServiceMetricsMapReduce_JobsRunningWaiting.extend(),
+ App.ChartServiceMetricsMapReduce_MapSlots.extend(),
+ App.ChartServiceMetricsMapReduce_ReduceSlots.extend(),
+ App.ChartServiceMetricsMapReduce_JVMHeap.extend(),
+ App.ChartServiceMetricsMapReduce_JVMThreads.extend(),
+ App.ChartServiceMetricsMapReduce_GC.extend(),
+ App.ChartServiceMetricsMapReduce_RPC.extend() ];
+ } else if (serviceName == 'hbase') {
+ summary['memory_heap_percent_used'] = summary['memory_heap_used'].countPercentageRatio(summary['memory_heap_max']);
+ summary['memory_heap_used'] = summary['memory_heap_used'].bytesToSize(2, 'parseFloat');
+ summary['memory_heap_max'] = summary['memory_heap_max'].bytesToSize(2, 'parseFloat');
+ summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
+ summary['active_time'] = summary['active_time'].toDaysHoursMinutes();
}
+ summaryView.set('attributes', summary);
+ }
+ })
+ },
+
+ didInsertElement: function () {
+ // We have to make the height of the Alerts section
+ // match the height of the Summary section.
+ var summaryTable = document.getElementById('summary-info');
+ var alertsList = document.getElementById('summary-alerts-list');
+ if (summaryTable && alertsList) {
+ if (summaryTable.clientHeight > alertsList.clientHeight) {
+ $(alertsList).attr('style', "height:" + summaryTable.clientHeight + "px;");
+ } else {
+ $(summaryTable).attr('style', "height:" + alertsList.clientHeight + "px;");
}
- )
+ }
}
});
\ No newline at end of file