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 2015/04/28 11:43:50 UTC
ambari git commit: AMBARI-10783 Implement time range for graph widget
type. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 70c66cbd8 -> f00c0f142
AMBARI-10783 Implement time range for graph widget type. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f00c0f14
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f00c0f14
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f00c0f14
Branch: refs/heads/trunk
Commit: f00c0f1422020b38877756e3564cff91b1c055f0
Parents: 70c66cb
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Tue Apr 28 11:59:16 2015 +0300
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Tue Apr 28 11:59:16 2015 +0300
----------------------------------------------------------------------
.../data/widget_layouts/HBASE_SUMMARY.json | 5 +-
.../service/widgets/create/step2_controller.js | 6 ++-
.../service/widgets/create/step3_controller.js | 3 +-
ambari-web/app/models/widget.js | 2 +-
ambari-web/app/models/widget_property.js | 48 ++++++++++++++++++--
.../app/templates/main/service/info/summary.hbs | 23 +++++-----
.../views/common/widget/graph_widget_view.js | 10 +++-
.../main/service/widgets/create/step2_view.js | 16 ++++++-
8 files changed, 88 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/assets/data/widget_layouts/HBASE_SUMMARY.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/widget_layouts/HBASE_SUMMARY.json b/ambari-web/app/assets/data/widget_layouts/HBASE_SUMMARY.json
index 5e02e7d..d4d3ff0 100644
--- a/ambari-web/app/assets/data/widget_layouts/HBASE_SUMMARY.json
+++ b/ambari-web/app/assets/data/widget_layouts/HBASE_SUMMARY.json
@@ -1,4 +1,3 @@
-
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/users/admin/activeWidgetLayouts?WidgetLayoutInfo/section_name=HBASE_SUMMARY",
"items" : [
@@ -20,7 +19,7 @@
"author" : "ambari",
"description" : "Widget shows 95% Read Latency",
"scope" : "CLUSTER",
- "properties" : "{\"display_unit\":\"ms\",\"graph_type\":\"LINE\",\"time_range\":\"1\"}",
+ "properties" : "{\"display_unit\":\"ms\",\"graph_type\":\"LINE\",\"time_range\":\"4\"}",
"widget_name" : "Read Latency",
"widget_type" : "GRAPH",
"time_created" : 1429906622306,
@@ -36,7 +35,7 @@
"author" : "ambari",
"description" : "This widget shows 95th percentile of the write latency.",
"scope" : "CLUSTER",
- "properties" : "{\"display_unit\":\"ms\",\"graph_type\":\"LINE\",\"time_range\":\"1\"}",
+ "properties" : "{\"display_unit\":\"ms\",\"graph_type\":\"LINE\",\"time_range\":\"2\"}",
"widget_name" : "Write Latency",
"widget_type" : "GRAPH",
"time_created" : 1429906622306,
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js b/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
index 0d5f414..d870433 100644
--- a/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
+++ b/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
@@ -434,7 +434,8 @@ App.WidgetWizardStep2Controller = Em.Controller.extend({
isMetric: true,
componentName: metric.component_name,
serviceName: metric.service_name,
- metricPath: metric.metric_path
+ metricPath: metric.metric_path,
+ hostComponentCriteria: metric.host_component_criteria
}));
str = '';
}
@@ -455,7 +456,8 @@ App.WidgetWizardStep2Controller = Em.Controller.extend({
isMetric: true,
componentName: metric.component_name,
serviceName: metric.service_name,
- metricPath: metric.metric_path
+ metricPath: metric.metric_path,
+ hostComponentCriteria: metric.host_component_criteria
}));
}
return data;
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js b/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
index e460ccf..a8134a9 100644
--- a/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
+++ b/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
@@ -120,7 +120,8 @@ App.WidgetWizardStep3Controller = Em.Controller.extend({
"name": metric.name,
"service_name": metric.serviceName,
"component_name": metric.componentName,
- "metric_path": metric.metricPath
+ "metric_path": metric.metricPath,
+ "host_component_criteria": metric.hostComponentCriteria
}
}),
values: this.get('widgetValues'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/models/widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/widget.js b/ambari-web/app/models/widget.js
index f0b604d..be71b2f 100644
--- a/ambari-web/app/models/widget.js
+++ b/ambari-web/app/models/widget.js
@@ -135,7 +135,7 @@ App.WidgetType.FIXTURES = [
{
name : 'time_range',
isRequired: true,
- value: 'Last 1 hour'
+ value: "1"
},
{
name : 'display_unit',
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/models/widget_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/widget_property.js b/ambari-web/app/models/widget_property.js
index 9b72c1e..1d5e27a 100644
--- a/ambari-web/app/models/widget_property.js
+++ b/ambari-web/app/models/widget_property.js
@@ -108,18 +108,58 @@ App.WidgetPropertyTypes = [
name: 'graph_type',
label: 'Graph Type',
displayType: 'select',
- options: ["LINE", "STACK"],
+ options: [
+ {
+ label: "LINE",
+ value: "LINE"
+ },
+ {
+ label: "STACK",
+ value: "STACK"
+ }
+ ],
valueMap: {
"value": "graph_type"
}
},
-
{
name: 'time_range',
label: 'Time Range',
displayType: 'select',
- options: ["Last 1 hour", "Last 2 hours", "Last 4 hours", "Last 12 hours", "Last 24 hours",
- "Last 1 week", "Last 1 month", "Last 1 year"],
+ options: [
+ {
+ label: "Last 1 hour",
+ value: "1"
+ },
+ {
+ label: "Last 2 hours",
+ value: "2"
+ },
+ {
+ label: "Last 4 hour",
+ value: "4"
+ },
+ {
+ label: "Last 12 hour",
+ value: "12"
+ },
+ {
+ label: "Last 24 hour",
+ value: "24"
+ },
+ {
+ label: "Last 1 week",
+ value: "168"
+ },
+ {
+ label: "Last 1 month",
+ value: "720"
+ },
+ {
+ label: "Last 1 year",
+ value: "8760"
+ }
+ ],
valueMap: {
"value": "time_range"
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/templates/main/service/info/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs
index 8567b76..033d054 100644
--- a/ambari-web/app/templates/main/service/info/summary.hbs
+++ b/ambari-web/app/templates/main/service/info/summary.hbs
@@ -79,17 +79,18 @@
<div class="box">
<div class="box-header">
<h4>{{t services.service.metrics}}</h4>
-
- <div class="btn-group pull-right">
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
- {{view.currentTimeRange.name}} <span class="caret"></span>
- </button>
- <ul class="dropdown-menu">
- {{#each option in view.timeRangeOptions}}
- <li><a href="#" {{action setTimeRange option target="view"}}>{{option.name}}</a></li>
- {{/each}}
- </ul>
- </div>
+ {{#unless isServiceWithEnhancedWidgets}}
+ <div class="btn-group pull-right">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+ {{view.currentTimeRange.name}} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {{#each option in view.timeRangeOptions}}
+ <li><a href="#" {{action setTimeRange option target="view"}}>{{option.name}}</a></li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/unless}}
{{#if isServiceWithEnhancedWidgets}}
<div class="btn-group pull-right actions">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/views/common/widget/graph_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/graph_widget_view.js b/ambari-web/app/views/common/widget/graph_widget_view.js
index 9bd167e..bfe8306 100644
--- a/ambari-web/app/views/common/widget/graph_widget_view.js
+++ b/ambari-web/app/views/common/widget/graph_widget_view.js
@@ -28,10 +28,18 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, {
metrics: [],
/**
+ * 3600000 ms in 1 hour
+ * @const
+ */
+ TIME_FACTOR: 3600000,
+
+ /**
* value in ms
* @type {number}
*/
- timeRange: 3600000,
+ timeRange: function () {
+ return parseInt(this.get('content.properties.time_range')) * this.get('TIME_FACTOR');
+ }.property('content.properties.time_range'),
/**
* value in ms
http://git-wip-us.apache.org/repos/asf/ambari/blob/f00c0f14/ambari-web/app/views/main/service/widgets/create/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/widgets/create/step2_view.js b/ambari-web/app/views/main/service/widgets/create/step2_view.js
index 4559a20..a9aeb5f 100644
--- a/ambari-web/app/views/main/service/widgets/create/step2_view.js
+++ b/ambari-web/app/views/main/service/widgets/create/step2_view.js
@@ -61,9 +61,21 @@ App.WidgetPropertyThresholdView = Em.View.extend({
});
App.WidgetPropertySelectView = Em.Select.extend({
- selectionBinding: 'property.value',
contentBinding: 'property.options',
- classNameBindings: ['property.classNames', 'parentView.basicClass']
+ classNameBindings: ['property.classNames', 'parentView.basicClass'],
+ optionLabelPath: "content.label",
+ optionValuePath: "content.value",
+ didInsertElement: function () {
+ var selection = this.get('content').findProperty('value', this.get('property.value'));
+ if (selection) {
+ this.set('selection', selection);
+ }
+ this.addObserver('selection.value', this, 'setValue');
+ this.setValue();
+ },
+ setValue: function () {
+ this.set('property.value', this.get('selection.value'));
+ }
});