ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [25/34] git commit: AMBARI-7381 Slider View: FE - status of alerts shows as UNKNOWN. (atkach)
Date Thu, 18 Sep 2014 14:44:14 GMT
AMBARI-7381 Slider View: FE - status of alerts shows as UNKNOWN. (atkach)


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

Branch: refs/heads/branch-alerts-dev
Commit: 731d7b4a7beca2d7a3ab810b5f83f96ee301a15c
Parents: a14ca23
Author: atkach <atkach@hortonworks.com>
Authored: Thu Sep 18 14:14:03 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Thu Sep 18 14:16:26 2014 +0300

----------------------------------------------------------------------
 .../resources/ui/app/models/slider_app_alert.js | 43 +++++---------------
 .../ui/app/templates/slider_app/summary.hbs     |  2 +-
 .../ui/app/views/slider_app/summary_view.js     |  2 +-
 3 files changed, 12 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/731d7b4a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_alert.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_alert.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_alert.js
index c8cf0bd..f62c3ab 100644
--- a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_alert.js
+++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_alert.js
@@ -85,46 +85,23 @@ App.SliderAppAlert = DS.Model.extend({
   timeSinceAlert: function () {
     var d = this.get('date');
     var timeFormat;
+    var statusMap = Em.Object.create({
+      'OK': 'OK',
+      'WARNING': 'WARN',
+      'CRITICAL': 'CRIT',
+      'PASSIVE': 'MAINT'
+    });
+    var messageKey = statusMap.getWithDefault(this.get('status'), 'UNKNOWN');
+
     if (d) {
-      switch (this.get('status')) {
-        case "0":
-          timeFormat = Em.I18n.t('sliderApp.alerts.OK.timePrefix');
-          break;
-        case "1":
-          timeFormat = Em.I18n.t('sliderApp.alerts.WARN.timePrefix');
-          break;
-        case "2":
-          timeFormat = Em.I18n.t('sliderApp.alerts.CRIT.timePrefix');
-          break;
-        case "3":
-          timeFormat = Em.I18n.t('sliderApp.alerts.MAINT.timePrefix');
-          break;
-        default:
-          timeFormat = Em.I18n.t('sliderApp.alerts.UNKNOWN.timePrefix');
-          break;
-      }
+      timeFormat = Em.I18n.t('sliderApp.alerts.' + messageKey + '.timePrefix');
       var prevSuffix = $.timeago.settings.strings.suffixAgo;
       $.timeago.settings.strings.suffixAgo = '';
       var since = timeFormat.format($.timeago(this.makeTimeAtleastMinuteAgo(d)));
       $.timeago.settings.strings.suffixAgo = prevSuffix;
       return since;
     } else if (d == 0) {
-      switch (this.get('status')) {
-        case "0":
-          timeFormat = Em.I18n.t('sliderApp.alerts.OK.timePrefixShort');
-          break;
-        case "1":
-          timeFormat = Em.I18n.t('sliderApp.alerts.WARN.timePrefixShort');
-          break;
-        case "2":
-          timeFormat = Em.I18n.t('sliderApp.alerts.CRIT.timePrefixShort');
-          break;
-        case "3":
-          timeFormat = Em.I18n.t('sliderApp.alerts.MAINT.timePrefixShort');
-          break;
-        default:
-          timeFormat = Em.I18n.t('sliderApp.alerts.UNKNOWN.timePrefixShort');
-      }
+      timeFormat = Em.I18n.t('sliderApp.alerts.' + messageKey + '.timePrefixShort');
       return timeFormat;
     } else {
       return "";

http://git-wip-us.apache.org/repos/asf/ambari/blob/731d7b4a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
index ae056a6..2add6ec 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
@@ -90,7 +90,7 @@
                   <div class="col-md-11">
                     <div class="row">
                       <div class="col-md-7 title">{{title}}</div>
-                      <div {{bs-bind-tooltip view.tooltip}} data-placement="left" class="col-md-5
date-time">{{timeSinceAlert}}</div>
+                      <div {{bs-bind-tooltip view.tooltip}} class="col-md-5 date-time">{{timeSinceAlert}}</div>
                     </div>
                     <div class="message">{{message}}</div>
                   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/731d7b4a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
index 6351f77..1709757 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
@@ -52,7 +52,7 @@ App.SliderAppSummaryView = Ember.View.extend({
       return Ember.Object.create({
         trigger: 'hover',
         content: this.get('content.timeSinceAlertDetails'),
-        placement: "right"
+        placement: "bottom"
       });
     }.property('content')
   })


Mime
View raw message