Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 81DA911B52 for ; Thu, 18 Sep 2014 14:43:51 +0000 (UTC) Received: (qmail 61885 invoked by uid 500); 18 Sep 2014 14:43:51 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 61792 invoked by uid 500); 18 Sep 2014 14:43:51 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 61179 invoked by uid 99); 18 Sep 2014 14:43:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Sep 2014 14:43:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C462BA1B101; Thu, 18 Sep 2014 14:43:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jonathanhurley@apache.org To: commits@ambari.apache.org Date: Thu, 18 Sep 2014 14:44:14 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [25/34] git commit: AMBARI-7381 Slider View: FE - status of alerts shows as UNKNOWN. (atkach) 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 Authored: Thu Sep 18 14:14:03 2014 +0300 Committer: atkach 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 @@
{{title}}
-
{{timeSinceAlert}}
+
{{timeSinceAlert}}
{{message}}
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') })