Browse Source

AMBARI-1072. Change text on alerts "about XX hours ago". (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431589 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
4309db897f
3 changed files with 22 additions and 2 deletions
  1. 3 0
      CHANGES.txt
  2. 4 0
      ambari-web/app/messages.js
  3. 15 2
      ambari-web/app/models/alert.js

+ 3 - 0
CHANGES.txt

@@ -455,6 +455,9 @@ AMBARI-666 branch (unreleased changes)
 
   IMPROVEMENTS
 
+  AMBARI-1072. Change text on alerts "about XX hours ago". (Srimanth Gunturi
+  via yusaku)
+
   AMBARI-1145. Cluster Management refactoring. (yusaku)
 
   AMBARI-984. Add support for exposing filesystem type for mount points

+ 4 - 0
ambari-web/app/messages.js

@@ -39,6 +39,10 @@ Em.I18n.translations = {
   'services.oozie.description':'System for workflow coordination and execution of Apache Hadoop jobs',
   'services.zookeeper.description':'ZooKeeper desc',
   'services.hbase.description':'Non-relational distributed database and centralized service for configuration management & synchronization',
+  
+  'services.alerts.OK.timePrefix': 'OK for ',
+  'services.alerts.WARN.timePrefix': 'WARN for ',
+  'services.alerts.CRIT.timePrefix': 'CRIT for ',
 
   'topnav.logo.href':'http://incubator.apache.org/ambari/',
   'topnav.help.href':'https://cwiki.apache.org/confluence/display/AMBARI/Ambari',

+ 15 - 2
ambari-web/app/models/alert.js

@@ -68,10 +68,23 @@ App.Alert = DS.Model.extend({
   timeSinceAlert: function () {
     var d = this.get('date');
     if (d) {
-      return $.timeago(d);
+      var prefix = this.t('services.alerts.OK.timePrefix');
+      switch (this.get('status')) {
+        case "1":
+          prefix = this.t('services.alerts.WARN.timePrefix');
+          break;
+        case "2":
+          prefix = this.t('services.alerts.CRIT.timePrefix');
+          break;
+      }
+      var prevSuffix = $.timeago.settings.strings.suffixAgo;
+      $.timeago.settings.strings.suffixAgo = '';
+      var since = prefix + $.timeago(d);
+      $.timeago.settings.strings.suffixAgo = prevSuffix;
+      return since;
     }
     return "";
-  }.property('date'),
+  }.property('date', 'status'),
 
   /**
    * Provides more details about when this alert happened.