ambari git commit: AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with Background Operations (onechiporenko)

2017-01-19 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 a29f1499b -> 6061a677e


AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with 
Background Operations (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6061a677
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6061a677
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6061a677

Branch: refs/heads/branch-2.5
Commit: 6061a677ed43cc354715de934789fa1b590897a0
Parents: a29f149
Author: Oleg Nechiporenko 
Authored: Thu Jan 19 14:06:17 2017 +0200
Committer: Oleg Nechiporenko 
Committed: Thu Jan 19 14:06:17 2017 +0200

--
 .../admin/stack_upgrade/upgrade_history_view.js |  4 +-
 .../stack_upgrade/upgrade_history_view_test.js  | 76 ++--
 2 files changed, 72 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6061a677/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
--
diff --git 
a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js 
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index 2137f46..5954673 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -133,8 +133,8 @@ App.MainAdminStackUpgradeHistoryView = 
App.TableView.extend(App.TableServerViewM
   item.setProperties({
 directionLabel: direction,
 upgradeTypeLabel: method ? method.get('displayName') : method,
-startTimeLabel: App.dateTimeWithTimeZone(item.get('startTime')),
-endTimeLabel: App.dateTimeWithTimeZone(item.get('endTime')),
+startTimeLabel: 
date.startTime(App.dateTimeWithTimeZone(item.get('startTime'))),
+endTimeLabel: 
date.startTime(App.dateTimeWithTimeZone(item.get('endTime'))),
 duration: date.durationSummary(item.get('startTime'), 
item.get('endTime'))
   });
   processedContent.push(item);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6061a677/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
--
diff --git 
a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js 
b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
index d68a854..d13ccd5 100644
--- 
a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
+++ 
b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
@@ -19,7 +19,6 @@
 
 var App = require('app');
 require('views/main/admin/stack_upgrade/upgrade_history_view');
-var testHelpers = require('test/helpers');
 
 describe('App.MainAdminStackUpgradeHistoryView', function () {
   var view;
@@ -64,31 +63,31 @@ describe('App.MainAdminStackUpgradeHistoryView', function 
() {
 it('All should return all records', function(){
   this.mock.returns(records);
   var filteredResults = view.filterBy('ALL')
-  expect(filteredResults.length == 4).to.be.true
+  expect(filteredResults.length).to.be.equal(4);
 });
 
 it('Filter aborted upgrades', function(){
   this.mock.returns(records);
   var filteredResults = view.filterBy('UPGRADE_ABORTED')
-  expect(filteredResults.length == 1).to.be.true
+  expect(filteredResults.length).to.be.equal(1);
 });
 
 it('Filter completed upgrades', function(){
   this.mock.returns(records);
   var filteredResults = view.filterBy('UPGRADE_COMPLETED')
-  expect(filteredResults.length == 1).to.be.true
+  expect(filteredResults.length).to.be.equal(1);
 });
 
 it('Filter aborted downgrades', function(){
   this.mock.returns(records);
   var filteredResults = view.filterBy('DOWNGRADE_ABORTED')
-  expect(filteredResults.length == 1).to.be.true
+  expect(filteredResults.length).to.be.equal(1);
 });
 
 it('Filter completed downgrades', function(){
   this.mock.returns(records);
   var filteredResults = view.filterBy('DOWNGRADE_COMPLETED')
-  expect(filteredResults.length == 1).to.be.true
+  expect(filteredResults.length).to.be.equal(1);
 });
   });
 
@@ -170,4 +169,69 @@ describe('App.MainAdminStackUpgradeHistoryView', function 
() {
   
expect(view.get('controller').loadStackUpgradeHistoryToModel.calledOnce).to.be.true;
 });
   });
+
+  describe('#processForDisplay', function () {
+
+var timestamp = 1484698121448;
+
+var content = [
+  Em.Object.create({
+direction: 'UPGRADE',
+upgradeType: 'ROLLING',
+startTime: timestamp,
+endTime: timestamp + 

ambari git commit: AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with Background Operations (onechiporenko)

2017-01-19 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/trunk a06c44c6f -> ee8bbfb00


AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with 
Background Operations (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ee8bbfb0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ee8bbfb0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ee8bbfb0

Branch: refs/heads/trunk
Commit: ee8bbfb008c1d261bc726c17b7fcc917fbf5a862
Parents: a06c44c
Author: Oleg Nechiporenko 
Authored: Thu Jan 19 14:03:51 2017 +0200
Committer: Oleg Nechiporenko 
Committed: Thu Jan 19 15:00:28 2017 +0200

--
 .../admin/stack_upgrade/upgrade_history_view.js |  4 +-
 .../stack_upgrade/upgrade_history_view_test.js  | 65 
 2 files changed, 67 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ee8bbfb0/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
--
diff --git 
a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js 
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index dbdfc55..e259e3f 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -133,8 +133,8 @@ App.MainAdminStackUpgradeHistoryView = 
App.TableView.extend(App.TableServerViewM
   item.setProperties({
 directionLabel: direction,
 upgradeTypeLabel: method ? method.get('displayName') : method,
-startTimeLabel: App.dateTimeWithTimeZone(item.get('startTime')),
-endTimeLabel: App.dateTimeWithTimeZone(item.get('endTime')),
+startTimeLabel: 
date.startTime(App.dateTimeWithTimeZone(item.get('startTime'))),
+endTimeLabel: 
date.startTime(App.dateTimeWithTimeZone(item.get('endTime'))),
 duration: date.durationSummary(item.get('startTime'), 
item.get('endTime'))
   });
   processedContent.push(item);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ee8bbfb0/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
--
diff --git 
a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js 
b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
index bb25d09..cecf98f 100644
--- 
a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
+++ 
b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
@@ -168,4 +168,69 @@ describe('App.MainAdminStackUpgradeHistoryView', function 
() {
   
expect(view.get('controller').loadStackUpgradeHistoryToModel.calledOnce).to.be.true;
 });
   });
+
+  describe('#processForDisplay', function () {
+
+var timestamp = 1484698121448;
+
+var content = [
+  Em.Object.create({
+direction: 'UPGRADE',
+upgradeType: 'ROLLING',
+startTime: timestamp,
+endTime: timestamp + 3600 * 1000
+  }),
+  Em.Object.create({
+direction: 'DOWNGRADE',
+upgradeType: 'HOST_ORDERED',
+startTime: timestamp,
+endTime: timestamp + 3600 * 1000 * 2
+  })
+];
+
+var expected = [
+  Em.Object.create({
+directionLabel: Em.I18n.t('common.upgrade'),
+upgradeTypeLabel: Em.I18n.t('common.rolling'),
+duration: '1.00 hours'
+  }),
+  Em.Object.create({
+directionLabel: Em.I18n.t('common.downgrade'),
+upgradeTypeLabel: Em.I18n.t('common.hostOrdered'),
+duration: '2.00 hours'
+  })
+];
+
+var fields = ['directionLabel', 'upgradeTypeLabel', 'duration'];
+
+var processedContent;
+
+beforeEach(function () {
+  sinon.stub(App, 'dateTimeWithTimeZone', function (ts) {
+return ts - 3600 * 1000 * 2
+  });
+  processedContent = view.processForDisplay(content);
+});
+
+afterEach(function () {
+  App.dateTimeWithTimeZone.restore();
+});
+
+expected.forEach(function (item, index) {
+
+  describe('test #' + (index + 1), function () {
+
+fields.forEach(function (field) {
+  it('#' + field, function () {
+
expect(processedContent[index].get(field)).to.be.equal(item.get(field));
+  });
+});
+
+  });
+
+});
+
+
+  });
+
 });



ambari git commit: AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with Background Operations (onechiporenko)

2017-01-16 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/trunk a4015da1b -> 1f55ea3b0


AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with 
Background Operations (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1f55ea3b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f55ea3b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f55ea3b

Branch: refs/heads/trunk
Commit: 1f55ea3b0f741521f55d737de2e535767fa2f2e0
Parents: a4015da
Author: Oleg Nechiporenko 
Authored: Mon Jan 16 11:21:29 2017 +0200
Committer: Oleg Nechiporenko 
Committed: Mon Jan 16 17:47:31 2017 +0200

--
 .../app/views/main/admin/stack_upgrade/upgrade_history_view.js   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f55ea3b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
--
diff --git 
a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js 
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index 8df8349..dbdfc55 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -133,8 +133,8 @@ App.MainAdminStackUpgradeHistoryView = 
App.TableView.extend(App.TableServerViewM
   item.setProperties({
 directionLabel: direction,
 upgradeTypeLabel: method ? method.get('displayName') : method,
-startTimeLabel: date.startTime(item.get('startTime')),
-endTimeLabel: date.startTime(item.get('endTime')),
+startTimeLabel: App.dateTimeWithTimeZone(item.get('startTime')),
+endTimeLabel: App.dateTimeWithTimeZone(item.get('endTime')),
 duration: date.durationSummary(item.get('startTime'), 
item.get('endTime'))
   });
   processedContent.push(item);



ambari git commit: AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with Background Operations (onechiporenko)

2017-01-16 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 ce8e1bd4a -> 6f63e8426


AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with 
Background Operations (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6f63e842
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6f63e842
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6f63e842

Branch: refs/heads/branch-2.5
Commit: 6f63e8426c79a59451d05ac4f5628a3163a17679
Parents: ce8e1bd
Author: Oleg Nechiporenko 
Authored: Mon Jan 16 11:21:29 2017 +0200
Committer: Oleg Nechiporenko 
Committed: Mon Jan 16 17:43:12 2017 +0200

--
 .../app/views/main/admin/stack_upgrade/upgrade_history_view.js   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6f63e842/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
--
diff --git 
a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js 
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index f6a419e..2137f46 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -133,8 +133,8 @@ App.MainAdminStackUpgradeHistoryView = 
App.TableView.extend(App.TableServerViewM
   item.setProperties({
 directionLabel: direction,
 upgradeTypeLabel: method ? method.get('displayName') : method,
-startTimeLabel: date.startTime(item.get('startTime')),
-endTimeLabel: date.startTime(item.get('endTime')),
+startTimeLabel: App.dateTimeWithTimeZone(item.get('startTime')),
+endTimeLabel: App.dateTimeWithTimeZone(item.get('endTime')),
 duration: date.durationSummary(item.get('startTime'), 
item.get('endTime'))
   });
   processedContent.push(item);