You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/10/12 15:15:37 UTC
ambari git commit: AMBARI-13387. Improve time for transforming data
on the graphs (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 633242cce -> e8dbb1327
AMBARI-13387. Improve time for transforming data on the graphs (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e8dbb132
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e8dbb132
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e8dbb132
Branch: refs/heads/trunk
Commit: e8dbb1327d5a6bd98538fc5f35d69775677aa85b
Parents: 633242c
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Oct 9 16:44:07 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Mon Oct 12 16:13:38 2015 +0300
----------------------------------------------------------------------
.../app/views/common/chart/linear_time.js | 8 +++--
.../test/views/common/chart/linear_time_test.js | 38 ++++++++++++++------
2 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8dbb132/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index 8e903d6..fcb686c 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -325,10 +325,10 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, {
var series = {};
series.name = displayName;
series.data = [];
+ var timeDiff = App.dateTimeWithTimeZone(seriesData[0][1] * 1000) / 1000 - seriesData[0][1];
for (var index = 0; index < seriesData.length; index++) {
- var x = App.dateTimeWithTimeZone(seriesData[index][1] * 1000) / 1000;
series.data.push({
- x: x,
+ x: seriesData[index][1] + timeDiff,
y: seriesData[index][0]
});
}
@@ -394,6 +394,7 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, {
if (this.get('isDestroyed')) {
return;
}
+ console.time('_refreshGraph');
var seriesData = this.transformToSeries(jsonData);
//if graph opened as modal popup
@@ -438,6 +439,7 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, {
graph_container = null;
container = null;
popup_path = null;
+ console.timeEnd('_refreshGraph');
},
/**
@@ -1226,9 +1228,11 @@ App.ChartLinearTimeView.LoadAggregator = Em.Object.create({
hostName: hostName
}
}).done(function (response) {
+ console.time('==== runRequestsDone');
_request.subRequests.forEach(function (subRequest) {
subRequest.context._refreshGraph.call(subRequest.context, response);
}, this);
+ console.timeEnd('==== runRequestsDone');
}).fail(function (jqXHR, textStatus, errorThrown) {
_request.subRequests.forEach(function (subRequest) {
subRequest.context.loadDataErrorCallback.call(subRequest.context, jqXHR, textStatus, errorThrown);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8dbb132/ambari-web/test/views/common/chart/linear_time_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/chart/linear_time_test.js b/ambari-web/test/views/common/chart/linear_time_test.js
index 7730e9c..8ac7703 100644
--- a/ambari-web/test/views/common/chart/linear_time_test.js
+++ b/ambari-web/test/views/common/chart/linear_time_test.js
@@ -23,24 +23,35 @@ describe('App.ChartLinearTimeView', function () {
var chartLinearTimeView = App.ChartLinearTimeView.create({});
- describe('#transformData ([[1, 2], [2, 3], [3, 4]], "abc")', function () {
+ describe('#transformData', function () {
+
+ var result;
+
+ beforeEach(function () {
+ var data = [[1, 1200000000], [2, 1200000000], [3, 1200000000]];
+ var name = 'abc';
+ sinon.stub(App.router, 'get').withArgs('userSettingsController.userSettings.timezone').returns('Canada/Atlantic');
+ result = chartLinearTimeView.transformData(data, name);
+ });
+
+ afterEach(function () {
+ App.router.get.restore();
+ });
- var data = [[1, 2], [2, 3], [3, 4]];
- var name = 'abc';
- var result = chartLinearTimeView.transformData(data, name);
it('"name" should be "abc" ', function () {
expect(result.name).to.equal('abc');
});
+
it('data size should be 3 ', function () {
expect(result.data.length).to.equal(3);
});
- it('data[0].x should be 2 ', function () {
- expect(result.data[0].x).to.equal(2);
- });
+
it('data[0].y should be 1 ', function () {
expect(result.data[0].y).to.equal(1);
})
- }),
+
+ });
+
describe('#yAxisFormatter', function() {
var tests = [
{m:'undefined to 0',i:undefined,e:0},
@@ -58,7 +69,8 @@ describe('App.ChartLinearTimeView', function () {
expect(chartLinearTimeView.yAxisFormatter(test.i)).to.equal(test.e);
});
});
- }),
+ });
+
describe('#checkSeries', function() {
var tests = [
{m:'undefined - false',i:undefined,e:false},
@@ -73,7 +85,8 @@ describe('App.ChartLinearTimeView', function () {
expect(chartLinearTimeView.checkSeries(test.i)).to.equal(test.e);
});
});
- }),
+ });
+
describe('#BytesFormatter', function() {
var tests = [
{m:'undefined to "0 B"',i:undefined,e:'0 B'},
@@ -94,6 +107,7 @@ describe('App.ChartLinearTimeView', function () {
});
});
});
+
describe('#PercentageFormatter', function() {
var tests = [
{m:'undefined to "0 %"',i:undefined,e:'0 %'},
@@ -110,6 +124,7 @@ describe('App.ChartLinearTimeView', function () {
});
});
});
+
describe('#TimeElapsedFormatter', function() {
var tests = [
{m:'undefined to "0 ms"',i:undefined,e:'0 ms'},
@@ -250,10 +265,12 @@ describe('App.ChartLinearTimeView', function () {
});
});
+
});
describe('App.ChartLinearTimeView.LoadAggregator', function () {
+
var aggregator = App.ChartLinearTimeView.LoadAggregator;
describe("#add()", function () {
@@ -368,4 +385,5 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
expect(aggregator.formatRequestData(request)).to.equal('f3[400,4000,15],f4[400,4000,15]');
});
});
+
});