You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/10/01 17:27:33 UTC
[35/50] [abbrv] git commit: AMBARI-7456. Slider View: New HBase app
with metrics enabled should show graphs (srimanth)
AMBARI-7456. Slider View: New HBase app with metrics enabled should show graphs (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/eee03845
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/eee03845
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/eee03845
Branch: refs/heads/branch-alerts-dev
Commit: eee03845e85ab7cf64707446007a315ff5352434
Parents: 95ac1d6
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Tue Sep 30 19:15:21 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Tue Sep 30 19:15:27 2014 -0700
----------------------------------------------------------------------
.../src/main/resources/ui/app/helpers/ajax.js | 8 ++++++--
.../src/main/resources/ui/app/helpers/helper.js | 17 +++++++++++++++--
.../resources/ui/app/views/common/chart_view.js | 6 +++++-
.../views/slider_app/metrics/app_metric_view.js | 6 +++---
4 files changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/eee03845/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js b/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
index dfee360..5c6146f 100644
--- a/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
+++ b/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
@@ -189,8 +189,12 @@ var urls = {
},
'metrics': {
- real: 'apps/{id}/metrics/{metric}',
- mock: '/data/metrics/metric.json'
+ real: 'apps/{id}?fields=metrics/{metric}',
+ mock: '/data/metrics/metric.json',
+ headers: {
+ "Accept": "text/plain; charset=utf-8",
+ "Content-Type": "text/plain; charset=utf-8"
+ }
},
'metrics2': {
http://git-wip-us.apache.org/repos/asf/ambari/blob/eee03845/contrib/views/slider/src/main/resources/ui/app/helpers/helper.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/helpers/helper.js b/contrib/views/slider/src/main/resources/ui/app/helpers/helper.js
index 3f47ffd..ab72661 100644
--- a/contrib/views/slider/src/main/resources/ui/app/helpers/helper.js
+++ b/contrib/views/slider/src/main/resources/ui/app/helpers/helper.js
@@ -25,6 +25,20 @@ String.prototype.format = function () {
};
/**
+ * Return formatted string with inserted spaces before upper case and replaced '_' to spaces
+ * Also capitalize first letter
+ *
+ * Examples:
+ * 'apple' => 'Apple'
+ * 'apple_banana' => 'Apple banana'
+ * 'apple_bananaUranium' => 'Apple banana Uranium'
+ */
+String.prototype.humanize = function () {
+ var content = this;
+ return content && (content[0].toUpperCase() + content.slice(1)).replace(/([A-Z])/g, ' $1').replace(/_/g, ' ');
+}
+
+/**
* Helper function for bound property helper registration
* @memberof App
* @method registerBoundHelper
@@ -38,7 +52,6 @@ App.registerBoundHelper = function(name, view) {
});
};
-
/**
* Return formatted string with inserted <code>wbr</code>-tag after each dot
*
@@ -98,7 +111,7 @@ App.registerBoundHelper('humanize', Em.View.extend({
*/
result: function() {
var content = this.get('content');
- return content && (content[0].toUpperCase() + content.slice(1)).replace(/([A-Z])/g, ' $1').replace(/_/g, ' ');
+ return content && content.humanize();
}.property('content')
}));
http://git-wip-us.apache.org/repos/asf/ambari/blob/eee03845/contrib/views/slider/src/main/resources/ui/app/views/common/chart_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/common/chart_view.js b/contrib/views/slider/src/main/resources/ui/app/views/common/chart_view.js
index 880829a..c3cf900 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/common/chart_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/common/chart_view.js
@@ -166,9 +166,13 @@ App.ChartView = Ember.View.extend({
this.set('chartClass', this.get('chartId'));
this.set('titleId', idTemplate.replace('{element}', 'title'));
this.set('titleClass', this.get('titleId'));
- this.loadData();
+ this.set('interval', 6000);
+ this.run('loadData', true);
},
+ willDestroyElement: function() {
+ this.stop(); // Stop periodic load
+ },
loadData: function() {
App.ajax.send({
http://git-wip-us.apache.org/repos/asf/ambari/blob/eee03845/contrib/views/slider/src/main/resources/ui/app/views/slider_app/metrics/app_metric_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/metrics/app_metric_view.js b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/metrics/app_metric_view.js
index e8ce0d7..6baea38 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/metrics/app_metric_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/metrics/app_metric_view.js
@@ -24,7 +24,7 @@
* @extends Ember.Object
* @extends Ember.View
*/
-App.AppMetricView = App.ChartView.extend({
+App.AppMetricView = App.ChartView.extend(App.RunPeriodically, {
app: null,
@@ -35,10 +35,10 @@ App.AppMetricView = App.ChartView.extend({
}.property('app.id', 'metricName'),
title: function() {
- return this.get('metricName');
+ return this.get('metricName').humanize();
}.property('metricName'),
- yAxisFormatter: App.ChartView.BytesFormatter,
+ yAxisFormatter: App.ChartView.DefaultFormatter,
renderer: 'line',