ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: AMBARI-3867. JS error after switch to Dashboard page during HDFS starting. (xiwang via yusaku)
Date Thu, 05 Dec 2013 19:01:27 GMT
Updated Branches:
  refs/heads/trunk 629cf39a7 -> 953262cef


AMBARI-3867. JS error after switch to Dashboard page during HDFS starting. (xiwang via yusaku)


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

Branch: refs/heads/trunk
Commit: 953262cef25da0861902b9997ae29e9abe75bb00
Parents: 629cf39
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Thu Dec 5 10:57:49 2013 -0800
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Thu Dec 5 10:57:49 2013 -0800

----------------------------------------------------------------------
 .../dashboard/widgets/uptime_text_widget.js     | 46 +++++++++++---------
 1 file changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/953262ce/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 251ef2d..f34c6e1 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
@@ -102,27 +102,29 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
     }
     var formatted = date.timingFormat(diff); //17.67 days
     var timeUnit = null;
-    switch (formatted.split(" ")[1]) {
-      case 'secs':
-        timeUnit = 's';
-        break;
-      case 'hours':
-        timeUnit = 'hr';
-        break;
-      case 'days':
-        timeUnit = 'd';
-        break;
-      case 'mins':
-        timeUnit = 'min';
-        break;
-      default:
-        timeUnit = formatted.split(" ")[1];
+    if (formatted != null) {
+      switch (formatted.split(" ")[1]) {
+        case 'secs':
+          timeUnit = 's';
+          break;
+        case 'hours':
+          timeUnit = 'hr';
+          break;
+        case 'days':
+          timeUnit = 'd';
+          break;
+        case 'mins':
+          timeUnit = 'min';
+          break;
+        default:
+          timeUnit = formatted.split(" ")[1];
+      }
+      this.set('timeUnit', timeUnit);
+      this.set('hiddenInfo', []);
+      this.get('hiddenInfo').pushObject(formatted);
+      this.get('hiddenInfo').pushObject(uptimeString[0]);
+      this.get('hiddenInfo').pushObject(uptimeString[1]);
     }
-    this.set('timeUnit', timeUnit);
-    this.set('hiddenInfo', []);
-    this.get('hiddenInfo').pushObject(formatted);
-    this.get('hiddenInfo').pushObject(uptimeString[0]);
-    this.get('hiddenInfo').pushObject(uptimeString[1]);
     return formatted;
   },
 
@@ -131,7 +133,9 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
     var uptime = this.get('model').get(field);
     if (uptime && uptime > 0) {
       var formatted = this.uptimeProcessing(uptime);
-      return parseFloat(formatted.split(" ")[0]);
+      if (formatted != null) {
+        return parseFloat(formatted.split(" ")[0]);
+      }
     }
     this.set('hiddenInfo', [this.get('component'),'Not Running']);
     return null;


Mime
View raw message