You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/09/23 20:31:40 UTC
git commit: AMBARI-7456 Slider View: New HBase app with metrics
enabled should show graphs. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk d09adabcd -> 35075e0af
AMBARI-7456 Slider View: New HBase app with metrics enabled should show graphs. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/35075e0a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/35075e0a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/35075e0a
Branch: refs/heads/trunk
Commit: 35075e0afa81a324c6d67bf4fb755830948b5a1b
Parents: d09adab
Author: atkach <at...@hortonworks.com>
Authored: Tue Sep 23 21:27:24 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Tue Sep 23 21:27:24 2014 +0300
----------------------------------------------------------------------
.../createAppWizard/step1_controller.js | 29 ----------------
.../createAppWizard/step3_controller.js | 1 +
.../ui/app/controllers/slider_controller.js | 36 ++++++++++++++++++++
.../main/resources/ui/app/models/slider_app.js | 4 ---
.../ui/app/templates/slider_app/summary.hbs | 6 ++--
.../resources/ui/app/views/common/chart_view.js | 6 ++--
.../views/slider_app/metrics/app_metric_view.js | 2 +-
.../ui/app/views/slider_app/summary_view.js | 27 ++++++---------
8 files changed, 53 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
index a96dd5d..457817d 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
@@ -89,40 +89,11 @@ App.CreateAppWizardStep1Controller = Ember.Controller.extend({
* @method loadStep
*/
loadStep: function () {
- var sliderConfigs = App.SliderApp.store.all('sliderConfig'),
- gangliaClusters = sliderConfigs.findBy('viewConfigName', 'ganglia.custom.clusters'),
- gangliaHost = sliderConfigs.findBy('viewConfigName', 'ganglia.server.hostname');
- App.set('gangliaClusters', this.formatGangliaClusters(gangliaClusters.get('value')));
- App.set('gangliaHost', gangliaHost.get('value'));
this.initializeNewApp();
this.loadAvailableTypes();
},
/**
- * Format value for <code>gangliaClusters</code>
- * @param {string} prop
- * @returns {Array}
- * @method formatGangliaClusters
- */
- formatGangliaClusters: function(prop) {
- var gangliaCustomClusters = [];
- //parse CSV string with cluster names and ports
- if (!Em.isNone(prop)) {
- prop.replace(/\'/g, "").split(',').forEach(function(item, index){
- if (index % 2 === 0) {
- gangliaCustomClusters.push({
- name: item
- })
- }
- else {
- gangliaCustomClusters[gangliaCustomClusters.length - 1].port = parseInt(item);
- }
- });
- }
- return gangliaCustomClusters;
- },
-
- /**
* Initialize new App and set it to <code>newApp</code>
* @method initializeNewApp
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
index 2dd5b72..ef28d66 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
@@ -155,6 +155,7 @@ App.CreateAppWizardStep3Controller = Ember.ObjectController.extend({
delete configSet.configNames;
if (configSet.name === 'ganglia_metrics') {
configSet.trigger.readOnly = (!App.get('gangliaClusters') || App.get('gangliaClusters').length === 0);
+ configSet.trigger.value = (App.get('gangliaClusters') && App.get('gangliaClusters').length > 0);
}
configSet.trigger = App.ConfigProperty.create(configSet.trigger);
this.initConfigSetDependecies(configSet);
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
index a81854e..3063828 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
@@ -63,6 +63,42 @@ App.SliderController = Ember.Controller.extend({
model.set('value', properties[key]);
});
self.finishSliderConfiguration();
+ self.initGangliaProperties();
+ },
+
+ /**
+ * initialize properties of GANGLIA that required by Slider View
+ */
+ initGangliaProperties: function () {
+ var sliderConfigs = App.SliderApp.store.all('sliderConfig'),
+ gangliaClusters = sliderConfigs.findBy('viewConfigName', 'ganglia.custom.clusters'),
+ gangliaHost = sliderConfigs.findBy('viewConfigName', 'ganglia.server.hostname');
+ App.set('gangliaClusters', this.formatGangliaClusters(gangliaClusters.get('value')));
+ App.set('gangliaHost', gangliaHost.get('value'));
+ },
+
+ /**
+ * Format value for <code>gangliaClusters</code>
+ * @param {string} prop
+ * @returns {Array}
+ * @method formatGangliaClusters
+ */
+ formatGangliaClusters: function(prop) {
+ var gangliaCustomClusters = [];
+ //parse CSV string with cluster names and ports
+ if (!Em.isNone(prop)) {
+ prop.replace(/\'/g, "").split(',').forEach(function(item, index){
+ if (index % 2 === 0) {
+ gangliaCustomClusters.push({
+ name: item
+ })
+ }
+ else {
+ gangliaCustomClusters[gangliaCustomClusters.length - 1].port = parseInt(item);
+ }
+ });
+ }
+ return gangliaCustomClusters;
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
index 0dad13c..aee5fa6 100644
--- a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
+++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
@@ -123,10 +123,6 @@ App.SliderApp = DS.Model.extend({
if (App.get('gangliaHost') != null) {
return true;
}
- //check whether slider has GANGLIA configured if not metrics should be hidden
- if (!(global && global['ganglia_server_host'] && global['ganglia_server_id'] && global['ganglia_server_port'])) {
- return false;
- }
return App.SliderApp.Status.running === this.get('status');
}.property('status', 'configs'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
index 96340f9..655f19f 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
@@ -122,13 +122,11 @@
</div>
</div>
<div class="panel-body">
- {{#each graphs in view.graphs}}
<div class="row">
- {{#each graph in graphs}}
- <div class="col-md-3">{{view graph}}</div>
+ {{#each graph in view.graphs}}
+ <div class="col-md-3">{{view graph.view}}</div>
{{/each}}
</div>
- {{/each}}
</div>
</div>
{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/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 5af5241..880829a 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
@@ -189,7 +189,7 @@ App.ChartView = Ember.View.extend({
if (xhr.readyState == 4 && xhr.status) {
textStatus = xhr.status + " " + textStatus;
}
- this._showMessage('warn', 'graphs.error.title', textStatus + ' ' + errorThrown);
+ this._showMessage('warn', Em.I18n.t('common.error'), textStatus + ' ' + errorThrown);
this.set('isPopup', false);
this.set('hasData', false);
},
@@ -203,7 +203,7 @@ App.ChartView = Ember.View.extend({
* @type: Function
*/
_showMessage: function(type, title, message) {
- var chartOverlay = '#' + this.id;
+ var chartOverlay = '#' + this.get('id');
var chartOverlayId = chartOverlay + '-chart';
var chartOverlayY = chartOverlay + '-yaxis';
var chartOverlayX = chartOverlay + '-xaxis';
@@ -360,7 +360,7 @@ App.ChartView = Ember.View.extend({
this.draw(seriesData);
this.set('hasData', true);
//move yAxis value lower to make them fully visible
- $("#" + this.id + "-container").find('.y_axis text').attr('y',8);
+ $("#" + this.get('id') + "-container").find('.y_axis text').attr('y',8);
}
}
else {
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/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 9d0806c..e8ce0d7 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
@@ -47,7 +47,7 @@ App.AppMetricView = App.ChartView.extend({
getDataForAjaxRequest: function() {
return {
id: this.get('app.id'),
- metricName: this.get('metricName')
+ metric: this.get('metricName')
};
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/35075e0a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
index 85d11c4..cf5188d 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
@@ -46,21 +46,20 @@ App.SliderAppSummaryView = Ember.View.extend({
* @method updateGraphs
*/
updateGraphs: function() {
- // TODO - remove below lines when working.
- if (true)
- return;
-
var model = this.get('controller.model'),
- existingGraphs = this.get('graphs');
+ existingGraphs = this.get('graphs'),
+ graphsBeenChanged = false;
+
if (model) {
var currentGraphIds = [];
var supportedMetrics = model.get('supportedMetricNames');
- if (supportedMetrics && supportedMetrics.length > 0) {
+ if (supportedMetrics) {
var appId = model.get('id');
supportedMetrics.split(',').forEach(function(metricName) {
var graphId = metricName + '_' + appId;
currentGraphIds.push(graphId);
if (!existingGraphs.isAny('id', graphId)) {
+ graphsBeenChanged = true;
var view = App.AppMetricView.extend({
app: model,
metricName: metricName
@@ -73,18 +72,12 @@ App.SliderAppSummaryView = Ember.View.extend({
});
}
// Delete not existed graphs
- var toDeleteGraphs = [];
- existingGraphs.forEach(function(existingGraph) {
- if (currentGraphIds.indexOf(existingGraph.id) == -1) {
- toDeleteGraphs.push(existingGraph);
- }
+ existingGraphs = existingGraphs.filter(function(existingGraph) {
+ graphsBeenChanged = graphsBeenChanged || !currentGraphIds.contains(existingGraph.id);
+ return currentGraphIds.contains(existingGraph.id);
});
- if(toDeleteGraphs.length > 0) {
- var newGraphs = existingGraphs;
- toDeleteGraphs.forEach(function(toDeleteGraph) {
- newGraphs = newGraphs.without(toDeleteGraph);
- });
- this.set('graphs', newGraphs);
+ if (graphsBeenChanged) {
+ this.set('graphs', existingGraphs);
}
}
}.observes('controller.model.supportedMetricNames'),