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 <[email protected]>
Authored: Thu Jan 19 14:03:51 2017 +0200
Committer: Oleg Nechiporenko <[email protected]>
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));
+          });
+        });
+
+      });
+
+    });
+
+
+  });
+
 });

Reply via email to