You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/07 03:47:15 UTC

svn commit: r1347283 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/js/addNodes.js hmc/php/frontend/addNodes.php

Author: vikram
Date: Thu Jun  7 01:47:14 2012
New Revision: 1347283

URL: http://svn.apache.org/viewvc?rev=1347283&view=rev
Log:
AMBARI-466. Add nodes page alerts removed in case of adding duplicate nodes (Contributed by Vikram)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/js/addNodes.js
    incubator/ambari/branches/ambari-186/hmc/php/frontend/addNodes.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347283&r1=1347282&r2=1347283&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Thu Jun  7 01:47:14 2012
@@ -5,6 +5,8 @@ should be listed by their full name. Ple
 characters wide.
 
 Release 0.1.x - unreleased
+  
+  AMBARI-466. Add nodes page alerts removed in case of adding duplicate nodes (Vikram)
 
   AMBARI-465. Fix suggestions for Map Red Child java opts. (Mahadev via Vikram)
 

Modified: incubator/ambari/branches/ambari-186/hmc/js/addNodes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/addNodes.js?rev=1347283&r1=1347282&r2=1347283&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/addNodes.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/addNodes.js Thu Jun  7 01:47:14 2012
@@ -186,17 +186,44 @@ globalYui.one("#fileUploadTargetId").on(
 
       if (responseJson.result != 0) {
         // This means we hit an error
-
         if (responseJson.result == 2) {
-          alert('Got error : ' + responseJson.error);
           hideLoadingImg();
+          setFormStatus(responseJson.error, true);
           return;
       } else if (responseJson.result == 3) {
-        var confirmed = confirm(responseJson.error + "\n\n" + responseJson.hosts + "\n\nPlease click OK if you want to ignore them and continue.");
-        if (!confirmed) {
+        info =
+          '<p>' +
+            responseJson.error + '. ' +
+            '<a href="javascript:void(null)" id=errorHostInfoLinkId>' +
+            'Show me the duplicates</a>' +
+          '</p>';
+
+          setFormStatus(info, true);
+          var infoPanel = createInformationalPanel("#informationalPanelContainerDivId", "Duplicate nodes");
+          infoPanel.set('centered', true);
+          var infoPanelContent = '<ul>';
+          for (host in responseJson.hosts) {
+            infoPanelContent += '<li>' + responseJson.hosts[host] + '</li>';
+          }
+          infoPanelContent += '</ul>';
+          infoPanel.set('bodyContent', infoPanelContent);
+          infoPanel.addButton({
+            value: 'Close',
+            action: function(e) {
+              e.preventDefault();
+              destroyInformationalPanel(infoPanel);
+            },
+
+            className: '',
+            section: 'footer'
+          });
+
+          globalYui.one('#errorHostInfoLinkId').on("click", function(e) {
+            infoPanel.show();
+          });
           hideLoadingImg();
           return;
-        }
+
       } else {
         alert('Got and error ' + responseJson.error);
         hideLoadingImg();

Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/addNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/addNodes.php?rev=1347283&r1=1347282&r2=1347283&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/addNodes.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/addNodes.php Thu Jun  7 01:47:14 2012
@@ -104,7 +104,7 @@ if (!$freshInstall) {
       if ($numNewHosts == $numDupHosts) {
         print (json_encode(array("result" => 2, "error" => "All the hosts in the given file are already being used in cluster '$clusterName'")));
       } else {
-        print (json_encode(array("result" => 3, "error" => "Some hosts in the given file are already being used in cluster '$clusterName'", "hosts" => implode(",", $duplicateHosts))));
+        print (json_encode(array("result" => 3, "error" => "Some hosts in the given file are already being used in cluster '$clusterName'", "hosts" => $duplicateHosts)));
 
         // Just re-edit the hosts' file in case users says go ahead
         $nodeFileOut = fopen($hostsFileDestination, "w");