ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [49/50] ambari git commit: Revert "AMBARI-20035. Duration in BGoperation window should display durations in proper time units (alexantonenko)"
Date Fri, 24 Feb 2017 14:19:56 GMT
Revert "AMBARI-20035. Duration in BGoperation window should display durations in proper time
units (alexantonenko)"

This reverts commit ab53946fa63ad209158300ca0907e5a67097e717.


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: cb030a4e5b829d5adbfbffbb1c02aa94caa6d72b
Parents: 56eb5a7
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Feb 23 19:13:49 2017 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Feb 23 19:14:49 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/utils/date/date.js               | 26 ++++++++---------
 .../dashboard/widgets/uptime_text_widget.js     |  9 ++----
 ambari-web/test/mappers/service_mapper_test.js  |  2 +-
 ambari-web/test/utils/date/date_test.js         | 30 ++++++++++----------
 .../stack_upgrade/upgrade_history_view_test.js  |  8 +++---
 .../widgets/hbase_master_uptime_test.js         |  4 +--
 .../dashboard/widgets/namenode_uptime_test.js   |  4 +--
 .../widgets/resource_manager_uptime_test.js     |  4 +--
 .../widgets/uptime_text_widget_test.js          |  4 +--
 9 files changed, 44 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/app/utils/date/date.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/date/date.js b/ambari-web/app/utils/date/date.js
index 986815e..d461d21 100644
--- a/ambari-web/app/utils/date/date.js
+++ b/ambari-web/app/utils/date/date.js
@@ -153,13 +153,13 @@ module.exports = {
    * 30 ms = 30 ms
    * 300 ms = 300 ms
    * 999 ms = 999 ms
-   * 1000 ms = 1 secs
-   * 3000 ms = 3 secs
-   * 35000 ms = 35 secs
-   * 350000 ms = 350 secs
-   * 999999 ms = 999 secs
-   * 1000000 ms = 17 mins
-   * 3500000 secs = 58 mins
+   * 1000 ms = 1.00 secs
+   * 3000 ms = 3.00 secs
+   * 35000 ms = 35.00 secs
+   * 350000 ms = 350.00 secs
+   * 999999 ms = 999.99 secs
+   * 1000000 ms = 16.66 mins
+   * 3500000 secs = 58.33 mins
    *
    * @param {number} time
    * @param {bool} [zeroValid] for the case to show 0 when time is 0, not null
@@ -175,7 +175,6 @@ module.exports = {
       return null;
     }
     var timeStr = intTime.toString();
-    var date = new Date(intTime);
     var lengthOfNumber = timeStr.length;
     var oneMinMs = 60000;
     var oneHourMs = 3600000;
@@ -185,18 +184,19 @@ module.exports = {
       return time + ' ms';
     }
     if (lengthOfNumber < 7) {
-      time = (time / 1000).toFixed(0);
+      time = (time / 1000).toFixed(2);
       return time + ' secs';
     }
     if (time < oneHourMs) {
-      time = (time / oneMinMs).toFixed(0);
+      time = (time / oneMinMs).toFixed(2);
       return time + ' mins';
     }
     if (time < oneDayMs) {
-      return date.getUTCHours() + 'h '+ date.getUTCMinutes() + 'm ' + date.getUTCSeconds()
+'s';
+      time = (time / oneHourMs).toFixed(2);
+      return time + ' hours';
     }
-
-    return ((date.getUTCFullYear() - 1970) * 365 + date.getUTCMonth() * 31 + date.getUTCDate()-1)
+ 'd ' + date.getUTCHours() + 'h ' + date.getUTCMinutes() + 'm';
+    time = (time / oneDayMs).toFixed(2);
+    return time + ' days';
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
index e1b9c42..74d59f1 100644
--- a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
@@ -76,23 +76,20 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
   uptimeProcessing: function (uptime) {
     var uptimeString = this.timeConverter(uptime);
     var diff = App.dateTimeWithTimeZone() - uptime;
-    var valueType = "";
     if (diff < 0) {
       diff = 0;
     }
     var formatted = date.timingFormat(diff); //17.67 days
     var timeUnit = null;
     if (formatted) {
-      valueType = formatted.split(" ")[0];
-      switch (valueType[valueType.length-1]) {
+      switch (formatted.split(" ")[1]) {
         case 'secs':
           timeUnit = 's';
           break;
-        case 'h':
+        case 'hours':
           timeUnit = 'hr';
-
           break;
-        case 'd':
+        case 'days':
           timeUnit = 'd';
           break;
         case 'mins':

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/test/mappers/service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/service_mapper_test.js b/ambari-web/test/mappers/service_mapper_test.js
index c5a0b10..4a8d49d 100644
--- a/ambari-web/test/mappers/service_mapper_test.js
+++ b/ambari-web/test/mappers/service_mapper_test.js
@@ -220,7 +220,7 @@ describe('App.serviceMetricsMapper', function () {
         message: 'Storm mapper, stack version 2.1',
         expectedValues: {
           total_executors: 2,
-          nimbus_uptime: "3h 57m 30s",
+          nimbus_uptime: "3.96 hours",
           free_slots: 2,
           used_slots: 0,
           total_slots: 2,

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/test/utils/date/date_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/date/date_test.js b/ambari-web/test/utils/date/date_test.js
index c005222..5289fdd 100644
--- a/ambari-web/test/utils/date/date_test.js
+++ b/ambari-web/test/utils/date/date_test.js
@@ -90,23 +90,23 @@ describe('date', function () {
       {i: '30', e:'30 ms'},
       {i: '300', e:'300 ms'},
       {i: '999', e:'999 ms'},
-      {i: '1000', e:'1 secs'},
-      {i: '3000', e:'3 secs'},
-      {i: '35000', e:'35 secs'},
-      {i: '350000', e:'350 secs'},
-      {i: '999999', e:'1000 secs'},
-      {i: '1000000', e:'17 mins'},
-      {i: '3500000', e:'58 mins'},
-      {i: '35000000', e:'9h 43m 20s'},
-      {i: '350000000', e:'4d 1h 13m'},
-      {i: '3500000000', e:'40d 12h 13m'},
-      {i: '35000000000', e:'405d 2h 13m'}
+      {i: '1000', e:'1.00 secs'},
+      {i: '3000', e:'3.00 secs'},
+      {i: '35000', e:'35.00 secs'},
+      {i: '350000', e:'350.00 secs'},
+      {i: '999999', e:'1000.00 secs'},
+      {i: '1000000', e:'16.67 mins'},
+      {i: '3500000', e:'58.33 mins'},
+      {i: '35000000', e:'9.72 hours'},
+      {i: '350000000', e:'4.05 days'},
+      {i: '3500000000', e:'40.51 days'},
+      {i: '35000000000', e:'405.09 days'}
     ]);
 
     describe('Correct data', function(){
       tests.forEach(function(test) {
         it(test.i, function() {
-          expect(date.timingFormat(test.i)).to.be.equal(test.e);
+          expect(date.timingFormat(test.i)).to.equal(test.e);
         });
       });
     });
@@ -148,12 +148,12 @@ describe('date', function () {
       {
         startTimestamp: 1349752195000,
         endTimestamp: 1349752199000,
-        e: '4 secs'
+        e: '4.00 secs'
       },
       {
         startTimestamp: 1349752195000,
         endTimestamp: 1367752195000,
-        e: '213d 8h 0m'
+        e: '208.33 days'
       },
       {
         startTimestamp: -10000000,
@@ -170,7 +170,7 @@ describe('date', function () {
         startTimestamp: 100000000,
         endTimestamp: -1,
         stubbed: true,
-        e: '19 secs'
+        e: '19.00 secs'
       }
     ];
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/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 13da96e..0ca7080 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
@@ -135,13 +135,13 @@ describe('App.MainAdminStackUpgradeHistoryView', function () {
       event = {
         context: Em.Object.create({
           isSelected: false,
-          value: 'ALL'
+          value: 'ALL',
         })
       };
       view.set('categories', [
         Em.Object.create({
           isSelected: true,
-          value: 'UPGRADE_COMPLETED'
+          value: 'UPGRADE_COMPLETED',
         }),
         event.context
       ]);
@@ -192,12 +192,12 @@ describe('App.MainAdminStackUpgradeHistoryView', function () {
       Em.Object.create({
         directionLabel: Em.I18n.t('common.upgrade'),
         upgradeTypeLabel: Em.I18n.t('common.rolling'),
-        duration: '1h 0m 0s'
+        duration: '1.00 hours'
       }),
       Em.Object.create({
         directionLabel: Em.I18n.t('common.downgrade'),
         upgradeTypeLabel: Em.I18n.t('common.hostOrdered'),
-        duration: '2h 0m 0s'
+        duration: '2.00 hours'
       })
     ];
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js b/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
index 15b1ce3..4f19a35 100644
--- a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
@@ -33,8 +33,8 @@ describe('App.HBaseMasterUptimeView', function () {
       e: {
         isGreen: true,
         isNA: false,
-        content: '197.0 d',
-        data: 197
+        content: '192.1 d',
+        data: 192.1
       }
     },
     {

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js b/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
index 50a39c7..bfd101c 100644
--- a/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
@@ -35,8 +35,8 @@ describe('App.NameNodeUptimeView', function() {
         isOrange: false,
         isGreen: true,
         isNA: false,
-        content: '197.0 d',
-        data: 197
+        content: '192.1 d',
+        data: 192.1
       }
     },
     {

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
b/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
index 828133e..d4a9b34 100644
--- a/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
@@ -33,8 +33,8 @@ describe('App.ResourceManagerUptimeView', function() {
       e: {
         isGreen: true,
         isNA: false,
-        content: '197.0 d',
-        data: 197
+        content: '192.1 d',
+        data: 192.1
       }
     },
     {

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb030a4e/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
index 00d224c..fa20593 100644
--- a/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
@@ -60,7 +60,7 @@ describe('App.UptimeTextDashboardWidgetView', function() {
       {
         diff: 10*1000,
         e: {
-          timeUnit: 'secs'
+          timeUnit: 's'
         }
       },
       {
@@ -78,7 +78,7 @@ describe('App.UptimeTextDashboardWidgetView', function() {
       {
         diff: 1800*1000,
         e: {
-          timeUnit: 'mins'
+          timeUnit: 'min'
         }
       }
     ];


Mime
View raw message