incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1359995 - in /incubator/ambari/trunk: CHANGES.txt hmc/css/app.css hmc/html/index.php hmc/js/clustersList.js hmc/js/utils.js
Date Wed, 11 Jul 2012 02:40:52 GMT
Author: yusaku
Date: Wed Jul 11 02:40:52 2012
New Revision: 1359995

URL: http://svn.apache.org/viewvc?rev=1359995&view=rev
Log:
AMBARI-621. On Cluster Summary page, show Hadoop stack version information and 'Upgrade available'
link if a newer version of the stack is available (Contributed by yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/hmc/css/app.css
    incubator/ambari/trunk/hmc/html/index.php
    incubator/ambari/trunk/hmc/js/clustersList.js
    incubator/ambari/trunk/hmc/js/utils.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1359995&r1=1359994&r2=1359995&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Jul 11 02:40:52 2012
@@ -12,6 +12,10 @@ Trunk (unreleased changes)
 
   NEW FEATURES
 
+    AMBARI-621. On Cluster Summary page, show Hadoop stack version information
+    and "Upgrade available" link if a newer version of the stack is available
+    (yusaku) 
+
     AMBARI-612. Allow upgrading the database and add versions for ambari and
     hadoop stacks. (mahadev)
 

Modified: incubator/ambari/trunk/hmc/css/app.css
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/css/app.css?rev=1359995&r1=1359994&r2=1359995&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/css/app.css (original)
+++ incubator/ambari/trunk/hmc/css/app.css Wed Jul 11 02:40:52 2012
@@ -52,14 +52,6 @@ footer a:link, footer a:visited {
   text-decoration:underline;
 }
 
-a:link {
-  color: blue;
-}
-
-a:visited {
-  color: blue;
-}
-
 select {
   width:250px;
   background-color:#DBDBDB;
@@ -401,6 +393,7 @@ div.separator {
 }
 #serviceLegend {
   float:right;
+  margin-bottom: 4px;
 }
 #clusterHostRoleMapping {
   margin-top: 20px;
@@ -415,6 +408,14 @@ div.separator {
   margin-bottom:10px;
   font-weight:normal;
 }
+
+#clusterInfo {
+  margin-left:20px;
+}
+#clusterInfo label {
+  display: inline;
+  font-weight:bold;
+}
 /* BEGIN TOP NAV */
 .navbar {
   font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;

Modified: incubator/ambari/trunk/hmc/html/index.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/html/index.php?rev=1359995&r1=1359994&r2=1359995&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/html/index.php (original)
+++ incubator/ambari/trunk/hmc/html/index.php Wed Jul 11 02:40:52 2012
@@ -31,7 +31,10 @@
       <?php require "./_subnav.php"; ?>
       <?php require "./_utils.php"; ?>
 
-      <div id="clusterHostRoleMapping" style="display:none">
+      <div id="clusterInfo">
+        <div id="clusterInfoContent"></div>
+      </div>
+      <div id="clusterHostRoleMapping" style="display:none;margin-top:0">
         <div id="clusterHostRoleMappingContent">
         </div>      
       </div>

Modified: incubator/ambari/trunk/hmc/js/clustersList.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/clustersList.js?rev=1359995&r1=1359994&r2=1359995&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/clustersList.js (original)
+++ incubator/ambari/trunk/hmc/js/clustersList.js Wed Jul 11 02:40:52 2012
@@ -176,34 +176,43 @@ function ClustersList() {
 
                 Y.log("RAW JSON DATA: " + o1.responseText);
 
-                var clusterServicesResponseJson;
+                var responseJson;
 
                 try {
-                  clusterServicesResponseJson = Y.JSON.parse(o1.responseText);
+                  responseJson = Y.JSON.parse(o1.responseText);
                 }
                 catch (e) {
                   alert("JSON Parse failed");
                   return;
                 }
 
-                managerHostName = clusterServicesResponseJson.response.managerHostName;
+                managerHostName = responseJson.response.managerHostName;
 
-                Y.log(Y.Lang.dump(clusterServicesResponseJson));
+                Y.log(Y.Lang.dump(responseJson));
 
-                /* Check that clusterServicesResponseJson actually indicates success. */
-                if( clusterServicesResponseJson.result == 0 ) {
+                /* Check that responseJson actually indicates success. */
+                if (responseJson.result == 0) {
 
-                  var clusterServices = clusterServicesResponseJson.response.services;
+                  var clusterServices = responseJson.response.services;
+                  var versionInfo = responseJson.response.versionInfo;
+
+                  var clusterInfoMarkup =
+                    '<div><label>Cluster:</label> ' + clusterName + '</div>'
+
+                    '<div><label>Hadoop Stack:</label> HDP ' + versionInfo.currentStackVersion
+
+                    ((App.util.compareVersionStrings(versionInfo.currentStackVersion, versionInfo.latestStackVersion)
< 0) ? ' (<a href="upgradeStack">Upgrade available</a>)' : '') +
+                    '</div>' +
+                    '<div style="clear:both"></div>';
 
                   var markup =
                     '<div class="clearfix">' +
-                      '<h2>Cluster: ' +  clusterName + '</h2>' +
                       '<div id="serviceLegend">' +
-                      '<span class="masterLegend">Master</span><span class="clientLegend"
style="margin-right:0">Client</span>' +
+                      '<span class="masterLegend">Master</span><span class="clientLegend">Client</span>'
+
                       '</div>' +
                       '</div>' +
                       '</div>';
 
+                  Y.one('#clusterInfoContent').setContent(clusterInfoMarkup);
+
                   Y.one("#clusterHostRoleMappingContent").setContent(
                     markup + generateHostRoleMappingMarkup(clusterServices) );
                   Y.one("#clusterHostRoleMapping").show();

Modified: incubator/ambari/trunk/hmc/js/utils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/utils.js?rev=1359995&r1=1359994&r2=1359995&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/utils.js (original)
+++ incubator/ambari/trunk/hmc/js/utils.js Wed Jul 11 02:40:52 2012
@@ -278,9 +278,38 @@ if (typeof clusterName !== 'undefined') 
     return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase();
   }
 
+  /**
+   * Compares two version strings.  A version string is defined as
+   * versionString = number [(.|-) versionString]
+   * @param {string} v1 - version string
+   * @param {string} v2 - version string
+   * @returns {number} -1 if v1 < v2; 0 if v1 == v2; 1 if v1 > v2
+   */
+  function compareVersionStrings(v1, v2) {
+    var v1Split = v1.split(/[.-]/);
+    var v2Split = v2.split(/[.-]/);
+
+    var len = Math.min(v1Split.length, v2Split.length);
+
+    for (var i = 0; i < len; i++) {
+      if (v1Split[i] < v2Split[i]) {
+        return -1;
+      } else if (v1Split[i] > v2Split[i]) {
+        return 1;
+      }
+    }
+    if (v1Split.length < v2Split.length) {
+      return -1;
+    } else if (v1Split.length > v2Split.length) {
+      return 1;
+    }
+    return 0;
+  }
+
   // exports
   App.util = {
-    titleCase: titleCase
+    titleCase: titleCase,
+    compareVersionStrings: compareVersionStrings
   };
 
 })();



Mime
View raw message