You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/08/07 00:07:09 UTC

git commit: AMBARI-2822. Alerts and Health Checks window can be larger for easy readability/scrollability. (xiwang via yusaku)

Updated Branches:
  refs/heads/trunk 378d0dddf -> 4aa12f4a7


AMBARI-2822. Alerts and Health Checks window can be larger for easy readability/scrollability. (xiwang via yusaku)


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

Branch: refs/heads/trunk
Commit: 4aa12f4a7cdc7533791fffecea0fbfcc3c54d190
Parents: 378d0dd
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Tue Aug 6 15:06:57 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Tue Aug 6 15:06:57 2013 -0700

----------------------------------------------------------------------
 .../app/views/main/service/info/summary.js      | 32 ++++++++++++++++----
 1 file changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/4aa12f4a/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 741b2e1..5df9414 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -436,18 +436,38 @@ App.MainServiceInfoSummaryView = Em.View.extend({
       var rows = $(summaryTable).find('tr');
       if (rows != null && rows.length > 0) {
         var minimumHeightSum = 20;
-        var minimumHeightAlert = 50;
-        var calculatedHeight = summaryTable.clientHeight;
-        if (calculatedHeight < minimumHeightAlert) {
-          $(alertsList).attr('style', "height:" + minimumHeightAlert + "px;");
+        var summaryActualHeight = summaryTable.clientHeight;
+        // for summary window
+        if (summaryActualHeight <= minimumHeightSum) {
           $(summaryTable).attr('style', "height:" + minimumHeightSum + "px;");
-        } else {
-          $(alertsList).attr('style', "height:" + calculatedHeight + "px;");
         }
       } else if (alertsList.clientHeight > 0) {
         $(summaryTable).append('<tr><td></td></tr>');
         $(summaryTable).attr('style', "height:" + alertsList.clientHeight + "px;");
       }
+      Ember.run.next(this, 'setAlertsWindowSize');
+    }
+  },
+  setAlertsWindowSize: function() {
+    // for alerts window
+    var summaryTable = document.getElementById('summary-info');
+    var alertsList = document.getElementById('summary-alerts-list');
+    var summaryActualHeight = summaryTable.clientHeight;
+    var alertsNum = App.router.get('mainServiceInfoSummaryController.alerts.length');
+    var alertsActualHeight = alertsNum * 60;
+    var alertsMinHeight = 58;
+    if (alertsNum == 0) {
+      $(alertsList).attr('style', "height:" + alertsMinHeight + "px;");
+    } else if ( alertsNum <= 4) {
+      // set window size to actual alerts height
+      $(alertsList).attr('style', "height:" + alertsActualHeight + "px;");
+    } else {
+      // set window size : sum of first 4 alerts height
+      $(alertsList).attr('style', "height:" + 240 + "px;");
+    }
+    var curSize = alertsList.clientHeight;
+    if ( summaryActualHeight >= curSize) {
+      $(alertsList).attr('style', "height:" + summaryActualHeight + "px;");
     }
   },