incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1359871 - in /incubator/ambari/trunk: ./ hmc/html/ hmc/js/ hmc/php/frontend/
Date Tue, 10 Jul 2012 20:02:26 GMT
Author: yusaku
Date: Tue Jul 10 20:02:25 2012
New Revision: 1359871

URL: http://svn.apache.org/viewvc?rev=1359871&view=rev
Log:
AMBARI-620. Put common Javascript utility functions into appropriate namespace/packages (Contributed by yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/hmc/html/_utils.php
    incubator/ambari/trunk/hmc/js/addNodes.js
    incubator/ambari/trunk/hmc/js/addNodesProgress.js
    incubator/ambari/trunk/hmc/js/addNodesWizard.js
    incubator/ambari/trunk/hmc/js/addNodesWizardInit.js
    incubator/ambari/trunk/hmc/js/assignMasters.js
    incubator/ambari/trunk/hmc/js/configureCluster.js
    incubator/ambari/trunk/hmc/js/configureServices.js
    incubator/ambari/trunk/hmc/js/configureServicesUtils.js
    incubator/ambari/trunk/hmc/js/createCluster.js
    incubator/ambari/trunk/hmc/js/installationWizard.js
    incubator/ambari/trunk/hmc/js/manageServices.js
    incubator/ambari/trunk/hmc/js/reviewAndDeploy.js
    incubator/ambari/trunk/hmc/js/selectComponents.js
    incubator/ambari/trunk/hmc/js/selectServices.js
    incubator/ambari/trunk/hmc/js/showDeployAddedNodesProgress.js
    incubator/ambari/trunk/hmc/js/showDeployProgress.js
    incubator/ambari/trunk/hmc/js/showManageServicesProgress.js
    incubator/ambari/trunk/hmc/js/showUninstallProgress.js
    incubator/ambari/trunk/hmc/js/txnUtils.js
    incubator/ambari/trunk/hmc/js/uninstall.js
    incubator/ambari/trunk/hmc/js/utils.js
    incubator/ambari/trunk/hmc/php/frontend/fetchClusterServices.php

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Jul 10 20:02:25 2012
@@ -20,6 +20,9 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
 
+    AMBARI-620. Put common Javascript utility functions into appropriate
+    namespace/packages (yusaku)
+
     AMBARI-615. Eliminate redundant and unused definition for the columns in the
     table ConfigProperties (yusaku) 
 

Modified: incubator/ambari/trunk/hmc/html/_utils.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/html/_utils.php?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/html/_utils.php (original)
+++ incubator/ambari/trunk/hmc/html/_utils.php Tue Jul 10 20:02:25 2012
@@ -25,7 +25,7 @@
 <!-- The image we use to let users know something is loading, and 
      that they should wait. Starts off showing by default, so it's
      up to the container application to hide this using the 
-     hideLoadingImg() method from utils.js. -->
+     App.ui.hideLoadingOverlay() method from utils.js. -->
 <div id="loadingDivId">
   <div id="loadingBlackScreenDivId"></div>
   <img id="loadingImgId" src="/hmc/images/loadingLarge.gif"/>

Modified: incubator/ambari/trunk/hmc/js/addNodes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/addNodes.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/addNodes.js (original)
+++ incubator/ambari/trunk/hmc/js/addNodes.js Tue Jul 10 20:02:25 2012
@@ -43,7 +43,7 @@ InstallationWizard.AddNodes = {
       }
       globalYui.one("#addNodesCoreDivId").setStyle('display', 'block');
 
-      hideLoadingImg();
+      App.ui.hideLoadingOverlay();
     }
 };
 
@@ -123,13 +123,13 @@ globalYui.one('#addNodesSubmitButtonId')
 
   if (errCount != 0) {
     globalYui.one(focusId).focus();
-    setFormStatus(message, true);
+    App.ui.setFormStatus(message, true);
     return;
   }
 
-  clearFormStatus();
+  App.ui.clearFormStatus();
 
-  showLoadingImg();
+  App.ui.showLoadingOverlay();
 
   globalYui.log("About to upload files.");
   e.target.set('disabled', true);
@@ -185,8 +185,8 @@ globalYui.one("#fileUploadTargetId").on(
             'Show me the duplicates</a>' +
           '</p>';
 
-          setFormStatus(info, true);
-          var infoPanel = createInformationalPanel("#informationalPanelContainerDivId", "Duplicate nodes");
+          App.ui.setFormStatus(info, true);
+          var infoPanel = App.ui.createInfoPanel("Duplicate nodes");
           infoPanel.set('centered', true);
           var infoPanelContent = '';
           for (cluster in responseJson.hosts) {
@@ -202,7 +202,7 @@ globalYui.one("#fileUploadTargetId").on(
             value: 'Close',
             action: function(e) {
               e.preventDefault();
-              destroyInformationalPanel(infoPanel);
+              infoPanel.hide();
             },
 
             className: '',
@@ -212,12 +212,12 @@ globalYui.one("#fileUploadTargetId").on(
           globalYui.one('#errorHostInfoLinkId').on("click", function(e) {
             infoPanel.show();
           });
-          hideLoadingImg();
+          App.ui.hideLoadingOverlay();
           return;
 
       } else {
         alert('Got and error ' + responseJson.error);
-        hideLoadingImg();
+        App.ui.hideLoadingOverlay();
         return;
       }
       }
@@ -247,7 +247,7 @@ globalYui.one("#fileUploadTargetId").on(
     globalYui.io(url, {
       method: 'POST',
       data: addNodesRequestData,
-      timeout : 10000,
+      timeout : App.io.DEFAULT_AJAX_TIMEOUT_MS,
       on: {
         success: function (x,o) {
           	
@@ -263,13 +263,13 @@ globalYui.one("#fileUploadTargetId").on(
           if (setupNodesJson.result != 0) {
             // Error!
             alert("Got error! " + setupNodesJson.error);
-            hideLoadingImg();
+            App.ui.hideLoadingOverlay();
             return;
           }
           setupNodesJson = setupNodesJson.response;
 
 
-          hideLoadingImg();
+          App.ui.hideLoadingOverlay();
 
           globalYui.one("#blackScreenDivId").setStyle("display", "block");
 
@@ -277,7 +277,7 @@ globalYui.one("#fileUploadTargetId").on(
 
         },
         failure: function (x,o) {
-          alert("Async call failed!");
+          alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
         }
       }
     });

Modified: incubator/ambari/trunk/hmc/js/addNodesProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/addNodesProgress.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/addNodesProgress.js (original)
+++ incubator/ambari/trunk/hmc/js/addNodesProgress.js Tue Jul 10 20:02:25 2012
@@ -220,7 +220,7 @@ function renderProgress (discoverProgres
                 globalYui.one('#txnProgressStatusMessageDivId').setContent(statusContent);    
                 globalYui.one("#successInfoLinkId").on( "click", function(e) {
                   cleanUpTxnProgress();
-                  transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo, 
+                  App.transition.transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo,
                     "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
               });
             } else {
@@ -257,7 +257,7 @@ function renderProgress (discoverProgres
                     errorInfoPanel.destroy();
                     //REZYYY globalYui.one("#progressErrorInfoNavigateDivId").setContent("");
                     globalYui.one("#txnProgressStatusActionsDivId").setContent("");
-                    transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo, 
+                    App.transition.transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo,
                       "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
                   });
                 }
@@ -265,8 +265,7 @@ function renderProgress (discoverProgres
                 
                 /* Create the panel that'll display our error info. */
                 var errorInfoPanel = 
-                  createInformationalPanel( '#informationalPanelContainerDivId',
-                    'Node Discovery and Preparation Logs' );
+                  App.ui.createInfoPanel('Node Discovery and Preparation Logs');
     
                   globalYui.one("#errorInfoLinkId").on( "click", function(err) {
                     var bodyContent = "";

Modified: incubator/ambari/trunk/hmc/js/addNodesWizard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/addNodesWizard.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/addNodesWizard.js (original)
+++ incubator/ambari/trunk/hmc/js/addNodesWizard.js Tue Jul 10 20:02:25 2012
@@ -31,16 +31,16 @@ var addNodesWizardStages = {
     },
     'selectServicesStageId' : {
       divSelector : '#selectServicesCoreDivId'
-    },
+    }
   },
 
   transitionToCachedStage : 
     function (currentStageId, cachedStageId) {
 
-      clearFormStatus();
+      App.ui.clearFormStatus();
 
       globalYui.log("In transitionToCachedStage: " + currentStageId + "->" + cachedStageId);
-      swapStageVisibilities( this.stages[currentStageId].divSelector, 
+      App.transition.swapStageVisibilities( this.stages[currentStageId].divSelector,
       this.stages[cachedStageId].divSelector );
     }
 };

Modified: incubator/ambari/trunk/hmc/js/addNodesWizardInit.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/addNodesWizardInit.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/addNodesWizardInit.js (original)
+++ incubator/ambari/trunk/hmc/js/addNodesWizardInit.js Tue Jul 10 20:02:25 2012
@@ -28,4 +28,4 @@ var addNodesRequestData = {
 InstallationWizard.AddNodes.render(addNodesRequestData);
 
 /* Signify that the containing application is ready for business. */
-hideLoadingImg();
+App.ui.hideLoadingOverlay();

Modified: incubator/ambari/trunk/hmc/js/assignMasters.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/assignMasters.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/assignMasters.js (original)
+++ incubator/ambari/trunk/hmc/js/assignMasters.js Tue Jul 10 20:02:25 2012
@@ -120,7 +120,7 @@ function AssignMasters() {
   
   this.render = function (clusterInfo) {
   
-    hideLoadingImg();
+    App.ui.hideLoadingOverlay();
     globalYui.log("Render assign hosts data " + globalYui.Lang.dump(clusterInfo));
     globalYui.one('#assignHostsCoreDivId').setStyle("display", "block");
     globalClusterName = clusterInfo.clusterName;
@@ -151,14 +151,14 @@ function AssignMasters() {
   
           method: 'POST',
           data: globalYui.JSON.stringify(assignHostsRequestData),
-          timeout : 10000,
+          timeout : App.io.DEFAULT_AJAX_TIMEOUT_MS,
           on: {
             start: function(x, o) {
-              showLoadingImg();
+              App.ui.showLoadingOverlay();
             },
             complete: function(x, o) {
               e.target.set('disabled', false);
-              hideLoadingImg();
+              App.ui.hideLoadingOverlay();
             },
   
             success: function (x,o) {
@@ -185,12 +185,12 @@ function AssignMasters() {
               clusterConfigJson = clusterConfigJson.response;
   
               /* Done with this stage, transition to the next. */
-              transitionToNextStage( "#assignHostsCoreDivId", assignHostsRequestData,
+              App.transition.transitionToNextStage( "#assignHostsCoreDivId", assignHostsRequestData,
               "#configureClusterCoreDivId", clusterConfigJson, renderConfigureCluster );
             },
             failure: function (x,o) {
               e.target.set('disabled', false);
-              alert("Async call failed!");
+              alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
             }
           }
         });

Modified: incubator/ambari/trunk/hmc/js/configureCluster.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/configureCluster.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/configureCluster.js (original)
+++ incubator/ambari/trunk/hmc/js/configureCluster.js Tue Jul 10 20:02:25 2012
@@ -222,18 +222,18 @@ function renderConfigureCluster (cluster
         var thisScreenId = "#configureClusterCoreDivId";
         var nextScreenId = "#configureClusterAdvancedCoreDivId";
         var nextScreenRenderFunction = renderOptionsPage;
-        submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
+        App.transition.submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
      });
     
     globalYui.one('#previewLinkId').on('click', function(e) {
-      previewPanel = createInformationalPanel('#informationalPanelContainerDivId', 'Preview Directories to be used by Hadoop');
+      previewPanel = App.ui.createInfoPanel('Preview Directories to be used by Hadoop');
       previewPanel.set('centered', true);
       previewPanel.set('bodyContent', globalYui.one('#configureClusterDisplayDivId').getContent());
       var okButton = {
           value: 'OK',
           action: function (e) {
             e.preventDefault();
-            destroyInformationalPanel(previewPanel);
+            App.ui.destroyInfoPanel(previewPanel);
           },
           section: 'footer'
         };
@@ -269,7 +269,7 @@ function renderConfigureCluster (cluster
   /* Link the newly-generated clusterConfigInputMarkup into the DOM. */
   globalYui.one("#configureClusterMountPointsDynamicRenderDivId").setContent( clusterConfigInputMarkup );
 
-  hideLoadingImg();
+  App.ui.hideLoadingOverlay();
   globalYui.one('#configureClusterCoreDivId').setStyle("display", "block");
 
   renderEffectiveClusterConfig(generateServiceDirs(globalServicesInfo));

Modified: incubator/ambari/trunk/hmc/js/configureServices.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/configureServices.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/configureServices.js (original)
+++ incubator/ambari/trunk/hmc/js/configureServices.js Tue Jul 10 20:02:25 2012
@@ -35,7 +35,7 @@ Y.one('#configureClusterAdvancedSubmitBu
   var nextScreenId = "#deployCoreDivId";
   var nextScreenRenderFunction = renderDeploy;
   var errorFunction = App.ui.configureServicesUtil.handleConfigureServiceErrors;
-  submitDataAndProgressToNextScreen(url, requestData, submitButton,
+  App.transition.submitDataAndProgressToNextScreen(url, requestData, submitButton,
       thisScreenId, nextScreenId, nextScreenRenderFunction, errorFunction);
 });
 
@@ -72,5 +72,5 @@ function renderConfigureServicesInternal
 function renderOptionsPage (optionsInfo) {
   App.props.clusterName = optionsInfo.clusterName;
   var inputUrl = "../php/frontend/fetchClusterServices.php?clusterName=" + optionsInfo.clusterName + "&getConfigs=true";
-  executeStage(inputUrl, renderConfigureServicesInternal);
+  App.transition.executeStage(inputUrl, renderConfigureServicesInternal);
 }

Modified: incubator/ambari/trunk/hmc/js/configureServicesUtils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/configureServicesUtils.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/configureServicesUtils.js (original)
+++ incubator/ambari/trunk/hmc/js/configureServicesUtils.js Tue Jul 10 20:02:25 2012
@@ -263,7 +263,7 @@
 
       });
 
-      clearFormStatus();
+      App.ui.clearFormStatus();
       this.clearErrorReasons(desiredOptions);
 
       return desiredOptions;
@@ -293,7 +293,7 @@
         // if no errors at all, enable the submit button and clear error message at the top
         if (this.getTotalErrorCount() === 0) {
           submitButton.removeClass('disabled');
-          clearFormStatus();
+          App.ui.clearFormStatus();
         }
       }
     };
@@ -312,7 +312,7 @@
       var errorCounts = {};
       var message = errorResponse.error;
       var serviceName = '';
-      setFormStatus(message, true, true);
+      App.ui.setFormStatus(message, true, true);
       for (propKey in errorResponse.properties)  {
         var errorReason = errorResponse.properties[propKey].error;
         var propDom = Y.one('#' + propKey);

Modified: incubator/ambari/trunk/hmc/js/createCluster.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/createCluster.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/createCluster.js (original)
+++ incubator/ambari/trunk/hmc/js/createCluster.js Tue Jul 10 20:02:25 2012
@@ -20,9 +20,8 @@
 */
 
 function handleCreateClusterError (errorResponse) {
-
   globalYui.one("#clusterNameId").addClass('formInputError');
-  setFormStatus(errorResponse.error, true);
+  App.ui.setFormStatus(errorResponse.error, true);
   globalYui.one("#clusterNameId").focus();
 }
 
@@ -35,17 +34,17 @@ globalYui.one('#createClusterSubmitButto
       globalYui.log("Cluster Name: "+globalYui.Lang.dump(createClusterData));
 
       /* Always clear the slate with each submit. */
-      clearFormStatus();
+      App.ui.clearFormStatus();
       globalYui.one("#clusterNameId").removeClass('formInputError');
 
-      submitDataAndProgressToNextScreen(
+      App.transition.submitDataAndProgressToNextScreen(
         '../php/frontend/createCluster.php', createClusterData, e.target, 
         '#createClusterCoreDivId', '#addNodesCoreDivId', InstallationWizard.AddNodes.render,
         handleCreateClusterError );
 });
 
 /* Signify that the containing application is ready for business. */
-hideLoadingImg();
+App.ui.hideLoadingOverlay();
 
 /* At the end of the installation wizard, we hide 
  * #installationWizardProgressBarDivId, so make sure we explicitly show

Modified: incubator/ambari/trunk/hmc/js/installationWizard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/installationWizard.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/installationWizard.js (original)
+++ incubator/ambari/trunk/hmc/js/installationWizard.js Tue Jul 10 20:02:25 2012
@@ -52,10 +52,10 @@ var InstallationWizardStages = {
   transitionToCachedStage : 
     function (currentStageId, cachedStageId) {
 
-      clearFormStatus();
+      App.ui.clearFormStatus();
 
       globalYui.log("In transitionToCachedStage: " + currentStageId + "->" + cachedStageId);
-      swapStageVisibilities( this.stages[currentStageId].divSelector, 
+      App.transition.swapStageVisibilities( this.stages[currentStageId].divSelector,
       this.stages[cachedStageId].divSelector );
     }
 };

Modified: incubator/ambari/trunk/hmc/js/manageServices.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/manageServices.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/manageServices.js (original)
+++ incubator/ambari/trunk/hmc/js/manageServices.js Tue Jul 10 20:02:25 2012
@@ -67,7 +67,7 @@ function hidePanel(postHideFn) {
 function hideAndDestroyPanel() {
   hidePanel(function() {
     confirmationDataPanel.hide();
-    destroyInformationalPanel(confirmationDataPanel);
+    confirmationDataPanel.destroy();
   });
 }
 
@@ -122,12 +122,12 @@ function getAffectedDependenciesMarkup(a
   var dependencyMarkup = "";
   for (affectedSrvc in affectedServices) {
     if (clusterServices[affectedServices[affectedSrvc]].attributes.runnable) {
-      dependencyMarkup += '<tr><td>' + clusterServices[affectedServices[affectedSrvc]].displayName + '</td><td>' + titleCase(clusterServices[affectedServices[affectedSrvc]].state) + '</td></tr>';
+      dependencyMarkup += '<tr><td>' + clusterServices[affectedServices[affectedSrvc]].displayName + '</td><td>' + App.util.titleCase(clusterServices[affectedServices[affectedSrvc]].state) + '</td></tr>';
     }
   }
   if (dependencyMarkup != '') {
     // Add this service at the top of the list
-    dependencyMarkup = '<table><thead><th>Service name</th><th>Current state</th></thead><tr><td>' + serviceDisplayName + '</td><td>' + titleCase(clusterServices[serviceName].state) + '</td></tr>' + dependencyMarkup + '</table>';
+    dependencyMarkup = '<table><thead><th>Service name</th><th>Current state</th></thead><tr><td>' + serviceDisplayName + '</td><td>' + App.util.titleCase(clusterServices[serviceName].state) + '</td></tr>' + dependencyMarkup + '</table>';
     affectedDependenciesMarkup += 'Including this service and all its recursive dependencies, the following is the list of services that will be affected by ' + action + ' of ' + serviceName + ' :' +
       '<br/>' +
       '<div id="manageServicesDisplayDepsOnAction">' +
@@ -265,7 +265,7 @@ function setupReconfigureScreens(service
   confirmationDataPanel.set( 'bodyContent', confirmationDataPanelBodyContent );
   showPanel();
 
-  executeStage( '../php/frontend/fetchClusterServices.php?clusterName=' + clusterName + 
+  App.transition.executeStage( '../php/frontend/fetchClusterServices.php?clusterName=' + clusterName +
     '&getConfigs=true&serviceName=' + serviceName, function (serviceConfigurationData) {
 
     // Store the remote data
@@ -331,7 +331,7 @@ function performServiceManagement( actio
   globalYui.io( "../php/frontend/manageServices.php?clusterName=" + clusterName, {
     method: 'POST',
     data: globalYui.JSON.stringify(manageServicesRequestData),
-    timeout: 10000,
+    timeout: App.io.DEFAULT_AJAX_TIMEOUT_MS,
     on: {
       success: function(x, o) {
 
@@ -379,7 +379,7 @@ function performServiceManagement( actio
         }
       },
       failure: function(x, o) {
-        alert("Async call failed!");
+        alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
       }
     }
   });
@@ -399,7 +399,7 @@ function serviceManagementActionClickHan
 
   /* Create the panel that'll display our confirmation/data dialog. */
   confirmationDataPanel = 
-      createInformationalPanel( '#informationalPanelContainerDivId', confirmationDataPanelTitle );
+      App.ui.createInfoPanel(confirmationDataPanelTitle);
 
   panelYesButton = {
     value: 'OK',
@@ -474,7 +474,7 @@ function generateServiceManagementEntryM
             '</a>' +
           '</span>' +
           '<div class="serviceManagementEntryStateContainer">' +
-            titleCase(serviceInfo.state) +
+            App.util.titleCase(serviceInfo.state) +
           '</div>' +
           '<div class="serviceManagementEntryActionsContainer">';
 
@@ -570,14 +570,14 @@ var fetchClusterServicesPollerContext = 
   },
   request: '?clusterName=' + clusterName,
   /* TODO XXX Change this from 5 seconds to 1 minute. */
-  pollInterval: 5000,
+  pollInterval: App.io.DEFAULT_POLLING_INTERVAL_MS,
   maxFailedAttempts: 5
 };
 
 var fetchClusterServicesPollerResponseHandler = {
   success: function (e, pdp) {
     /* Clear the screen of the loading image (in case it's currently showing). */
-    hideLoadingImg();
+    App.ui.hideLoadingOverlay();
 
     /* The data from our backend. */
     clusterServices = e.response.meta.services;
@@ -625,13 +625,13 @@ var fetchClusterServicesPollerResponseHa
 
   failure: function (e, pdp) {
     /* Clear the screen of the loading image (in case it's currently showing). */
-    hideLoadingImg();
+    App.ui.hideLoadingOverlay();
 
     alert('Failed to fetch cluster services!');
   }
 };
 
-fetchClusterServicesPoller = new PeriodicDataPoller
+fetchClusterServicesPoller = new App.io.PeriodicDataPoller
   ( fetchClusterServicesPollerContext, fetchClusterServicesPollerResponseHandler );
 
 /* Kick the polling loop off. */

Modified: incubator/ambari/trunk/hmc/js/reviewAndDeploy.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/reviewAndDeploy.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/reviewAndDeploy.js (original)
+++ incubator/ambari/trunk/hmc/js/reviewAndDeploy.js Tue Jul 10 20:02:25 2012
@@ -42,11 +42,11 @@ Y.one('#deploySubmitButtonId').on('click
     var thisScreenId = "#deployCoreDivId";
     var nextScreenId = "#txnProgressCoreDivId";
     var nextScreenRenderFunction = renderDeployProgress;
-    submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
+    App.transition.submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
 });
 
 function renderDeploy (deployInfo) {
   App.props.clusterName = deployInfo.clusterName
   var inputUrl = "../php/frontend/fetchClusterServices.php?clusterName=" + App.props.clusterName + "&getConfigs=true&getComponents=true";
-  executeStage(inputUrl, renderDeploySummary);
+  App.transition.executeStage(inputUrl, renderDeploySummary);
 }

Modified: incubator/ambari/trunk/hmc/js/selectComponents.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/selectComponents.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/selectComponents.js (original)
+++ incubator/ambari/trunk/hmc/js/selectComponents.js Tue Jul 10 20:02:25 2012
@@ -30,7 +30,7 @@ InstallationWizard.SelectServicesForNewN
 function getServiceComponentListAndRender(clusterName) {
   globalYui.io("../php/frontend/fetchClusterServices.php?clusterName=" + clusterName + "&getComponents=true", {
   method: 'GET',
-  timeout: 10000,
+  timeout: App.io.DEFAULT_AJAX_TIMEOUT_MS,
   on: {
     success: function (x,o) {
     globalYui.log("RAW JSON DATA: " + o.responseText);
@@ -90,7 +90,7 @@ function getServiceComponentListAndRende
     },
    
     failure: function (x,o) {
-      alert("Async call failed!");
+      alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
     }
   }
   });
@@ -127,5 +127,5 @@ globalYui.one('#deployAddedNodesSubmitBu
     var thisScreenId = "#selectServicesCoreDivId";
     var nextScreenId = "#txnProgressCoreDivId";
     var nextScreenRenderFunction = renderDeployAddedNodesProgress;
-    submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
+    App.transition.submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
 });

Modified: incubator/ambari/trunk/hmc/js/selectServices.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/selectServices.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/selectServices.js (original)
+++ incubator/ambari/trunk/hmc/js/selectServices.js Tue Jul 10 20:02:25 2012
@@ -192,7 +192,7 @@ function displayStatusOnSuccess(serviceN
       statusString += "Also added  " + dependencies + " as dependencies.";
     }
   }
-  setFormStatus(statusString, false);
+  App.ui.setFormStatus(statusString, false);
 }
 
 function updateRendering() {
@@ -242,10 +242,10 @@ function displayStatusOnSelectDeselectAl
   }
   if (setFormStatusAlso) {
     if (selectAll) {
-      setFormStatus("Selected all services", false);
-  } else {
-    setFormStatus("Deselected all optional services", false);
-  }
+      App.ui.setFormStatus("Selected all services", false);
+    } else {
+      App.ui.setFormStatus("Deselected all optional services", false);
+    }
   }
 }
 
@@ -294,7 +294,7 @@ globalYui.one('#selectServicesCoreDivId'
         }
       }
       if (invalidDep) {
-        setFormStatus(invalidDepReason, true);
+        App.ui.setFormStatus(invalidDepReason, true);
         globalYui.one('#' + buttonId).set('checked', 'yes');
         return;
       }
@@ -335,7 +335,7 @@ globalYui.one('#selectServicesSubmitButt
     var nextScreenId  = "#assignHostsCoreDivId";
     var nextScreenRenderFunction = new AssignMasters().render;
 
-    submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
+    App.transition.submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
 
 });
 
@@ -346,5 +346,5 @@ function renderSelectServicesBlock(infoI
   //////// Get the list of services and relevant information for rendering them.
   var clusterName = InstallationWizard.SelectServices.renderData.clusterName;
   var inputUrl = "../php/frontend/fetchClusterServices.php?clusterName=" + clusterName ;
-  executeStage(inputUrl, renderServiceList);
+  App.transition.executeStage(inputUrl, renderServiceList);
 }

Modified: incubator/ambari/trunk/hmc/js/showDeployAddedNodesProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/showDeployAddedNodesProgress.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/showDeployAddedNodesProgress.js (original)
+++ incubator/ambari/trunk/hmc/js/showDeployAddedNodesProgress.js Tue Jul 10 20:02:25 2012
@@ -20,4 +20,4 @@
 */
 
 /* Main() */
-executeStage( '../php/frontend/deployAddedNodes.php?clusterName=' + clusterName, renderDeployAddedNodesProgress );
+App.transition.executeStage( '../php/frontend/deployAddedNodes.php?clusterName=' + App.props.clusterName, renderDeployAddedNodesProgress );

Modified: incubator/ambari/trunk/hmc/js/showDeployProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/showDeployProgress.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/showDeployProgress.js (original)
+++ incubator/ambari/trunk/hmc/js/showDeployProgress.js Tue Jul 10 20:02:25 2012
@@ -20,4 +20,4 @@
 */
 
 /* Main() */
-executeStage( '../php/frontend/deploy.php?clusterName=' + clusterName, renderDeployProgress );
+App.transition.executeStage( '../php/frontend/deploy.php?clusterName=' + App.props.clusterName, renderDeployProgress );

Modified: incubator/ambari/trunk/hmc/js/showManageServicesProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/showManageServicesProgress.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/showManageServicesProgress.js (original)
+++ incubator/ambari/trunk/hmc/js/showManageServicesProgress.js Tue Jul 10 20:02:25 2012
@@ -20,4 +20,4 @@
 */
 
 /* Main() */
-executeStage( '../php/frontend/manageServices.php?clusterName=' + clusterName, renderManageServicesProgress );
+App.transition.executeStage( '../php/frontend/manageServices.php?clusterName=' + App.props.clusterName, renderManageServicesProgress );

Modified: incubator/ambari/trunk/hmc/js/showUninstallProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/showUninstallProgress.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/showUninstallProgress.js (original)
+++ incubator/ambari/trunk/hmc/js/showUninstallProgress.js Tue Jul 10 20:02:25 2012
@@ -20,4 +20,4 @@
 */
 
 /* Main() */
-executeStage( '../php/frontend/uninstall.php?clusterName=' + clusterName, renderUninstallProgress );
+App.transition.executeStage( '../php/frontend/uninstall.php?clusterName=' + App.props.clusterName, renderUninstallProgress );

Modified: incubator/ambari/trunk/hmc/js/txnUtils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/txnUtils.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/txnUtils.js (original)
+++ incubator/ambari/trunk/hmc/js/txnUtils.js Tue Jul 10 20:02:25 2012
@@ -488,7 +488,7 @@ App.ui.TxnProgressWidget = function (con
                 isLogFetched = true;
               },
               failure: function (x, o) {
-                alert("Async call failed!");
+                alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
               }
             }
           });

Modified: incubator/ambari/trunk/hmc/js/uninstall.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/uninstall.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/uninstall.js (original)
+++ incubator/ambari/trunk/hmc/js/uninstall.js Tue Jul 10 20:02:25 2012
@@ -85,23 +85,23 @@ globalYui.one('#addNodesSubmitButtonId')
 
   if (errCount != 0) {
     globalYui.one(focusId).focus();
-    setFormStatus(message, true);
+    App.ui.setFormStatus(message, true);
     return;
   }
 
-  clearFormStatus();
+  App.ui.clearFormStatus();
   
   var doWipeout = globalYui.one('#confirmWipeOutCheckId').get('checked');
   var warningMessage = doWipeout ? "All your data, in addition to services, will be deleted from all your cluster nodes.  Are you sure you want to proceed?" : "All your services will be deleted from all your cluster nodes.  Your data will not be deleted.  Are you sure you want to proceed?";
   
-  var confirmPanel = createInformationalPanel('#informationalPanelContainerDivId','Uninstall Cluster');
+  var confirmPanel = App.ui.createInfoPanel('Uninstall Cluster');
   confirmPanel.set('centered', true);
   confirmPanel.set('bodyContent', warningMessage);
   confirmPanel.addButton({
     value: 'Cancel',
     action: function (e) {
       e.preventDefault();
-      destroyInformationalPanel(confirmPanel);
+      App.ui.destroyInfoPanel(confirmPanel);
     },
     classNames: '',
     section: 'footer'
@@ -110,8 +110,9 @@ globalYui.one('#addNodesSubmitButtonId')
     value: 'Proceed with Uninstall',
     action: function (e) {
       e.preventDefault();
-      destroyInformationalPanel(confirmPanel);
-      showLoadingImg();
+      App.ui.destroyInfoPanel(confirmPanel);
+
+      App.ui.showLoadingOverlay();
 
       globalYui.log("About to upload files.");
       e.target.set('disabled', true);
@@ -161,8 +162,8 @@ globalYui.one("#fileUploadTargetId").on(
     var thisScreenId = "#addNodesCoreDivId";
     var nextScreenId = "#txnProgressCoreDivId";
     var nextScreenRenderFunction = renderUninstallProgress;
-    submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
+    App.transition.submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction);
 });
 
 /* Main() */
-hideLoadingImg();
+App.ui.hideLoadingOverlay();

Modified: incubator/ambari/trunk/hmc/js/utils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/js/utils.js?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/js/utils.js (original)
+++ incubator/ambari/trunk/hmc/js/utils.js Tue Jul 10 20:02:25 2012
@@ -19,8 +19,8 @@
  *
  */
 
-/* Allows 'this' to be bound statically.
- *
+/*
+ * Allows 'this' to be bound statically.
  * Primarily used when creating objects whose methods will be used as
  * callbacks in unknown contexts.
  */
@@ -32,396 +32,411 @@ Function.prototype.bind = function (scop
   };
 };
 
-var globalSingletonInformationalPanel;
-
-function createInformationalPanel(containerNodeId, headerContentString) {
-
-  /* XXX This should check that globalSingletonInformationalPanel is within
-   * containerNodeId, and only then perform this cleanup, but this whole
-   * panel-related section needs to be rewritten anyway - for now, we only
-   * support the one globalSingletonInformationalPanel, and passing in
-   * anything other than #informationalPanelContainerDivId as containerNodeId
-   * is not guaranteed to work.
-   */
-  if (globalSingletonInformationalPanel) {
-    destroyInformationalPanel(globalSingletonInformationalPanel);
-  }
-
-  Y.one(containerNodeId).append('<div id="informationalPanelInnerContainerDivId"></div>');
-  
-  var newPanel = new Y.Panel({
-    srcNode: '#informationalPanelInnerContainerDivId',
-    headerContent: headerContentString,
-    width: 800,
-    height: 400,
-    render: true,
-    modal: true,
-    zIndex: 100,
-    centered: true,
-    visible: false
-  });
+// Define the App namespace
+var App = App || {
+  props: {},
+  io: {},
+  ui: {},
+  util: {}
+};
 
-  globalSingletonInformationalPanel = newPanel;
+// Define App.props package
+App.props = {
+  managerServiceName: 'Ambari',
+  clusterName: '',
+  homeUrl: '/hmc/html/'
+};
 
-  return newPanel;
+// On some pages the clusterName global variable is set before
+// this file is loaded.  Remember it in the App namespace.
+if (typeof clusterName !== 'undefined') {
+  App.props.clusterName = clusterName;
 }
 
-function createInfoPanel(headerContent) {
-  return createInformationalPanel('#informationalPanelContainerDivId', headerContent);
-}
+// Define App.ui package
+(function() {
+
+  var _infoPanel = null;
 
-function destroyInformationalPanel(theInformationalPanelInstance) {
+  function createInfoPanel(headerContent) {
 
-  if (theInformationalPanelInstance) {
+    if (_infoPanel) {
+      _infoPanel.hide();
+      _infoPanel.destroy();
+    }
 
-    theInformationalPanelInstance.hide();
-    theInformationalPanelInstance.destroy();
+    var containerDiv = Y.one('#informationalPanelContainerDivId');
+    containerDiv.setHTML('<div id="informationalPanelInnerContainerDivId"></div>');
+    //Y.one('#informationalPanelContainerDivId').append();
+
+    _infoPanel = new Y.Panel({
+      srcNode: '#informationalPanelInnerContainerDivId',
+      headerContent: headerContent,
+      width: 800,
+      height: 400,
+      render: true,
+      modal: true,
+      zIndex: 100,
+      centered: true,
+      visible: false
+    });
+    return _infoPanel;
+  }
 
-    if (theInformationalPanelInstance === globalSingletonInformationalPanel) {
-      globalSingletonInformationalPanel = null;
+  // for now, there can be only one instance of info panel,
+  // so the input parameter is ignored
+  function destroyInfoPanel(infoPanel) {
+    if (_infoPanel) {
+      _infoPanel.hide();
+      _infoPanel.destroy();
+      _infoPanel = null;
     }
   }
-}
 
-function showLoadingImg() {
-  Y.one("#loadingDivId").show();
-}
+  function showLoadingOverlay() {
+    Y.one("#loadingDivId").show();
+  }
 
-function hideLoadingImg() {
-  Y.one("#loadingDivId").hide();
-}
+  function hideLoadingOverlay() {
+    Y.one("#loadingDivId").hide();
+  }
 
-function swapStageVisibilities(currentStageDivSelector, newStageDivSelector) {
+  function setFormStatus(statusString, isError, noFade) {
+    var formStatusDivCssClass;
+    if (isError) {
+      formStatusDivCssClass = 'statusError';
+    } else {
+      formStatusDivCssClass = 'statusOk';
+    }
+    var formStatusDiv = Y.all("#formStatusDivId");
+    formStatusDiv.setStyle("visibility", "visible");
+    formStatusDiv.show();
+    formStatusDiv.set('className', '');
+    formStatusDiv.addClass("formStatusBar");
+    formStatusDiv.addClass(formStatusDivCssClass);
+    formStatusDiv.setContent(statusString);
+  }
 
-  Y.log("In swapStageVisibilities: " + currentStageDivSelector + "->" + newStageDivSelector);
-  /* Hide the current stage. */
-  Y.one(currentStageDivSelector).hide();
+  function clearFormStatus() {
+    var formStatusDiv = Y.all("#formStatusDivId");
+    formStatusDiv.setStyle("visibility", "hidden");
+    formStatusDiv.hide();
+    formStatusDiv.set('className', '');
+    formStatusDiv.addClass("formStatusBar");
+  }
 
-  /* Show the new stage. */
-  Y.one(newStageDivSelector).show();
-}
+  // exports
+  App.ui = {
+    createInfoPanel: createInfoPanel,
+    destroyInfoPanel: destroyInfoPanel,
+    showLoadingOverlay: showLoadingOverlay,
+    hideLoadingOverlay: hideLoadingOverlay,
+    setFormStatus: setFormStatus,
+    clearFormStatus: clearFormStatus
+  };
+})();
 
-/* TODO XXX Consider bundling the last 3 parameters into their own NewStage object.
- * TODO XXX Do the same for the first 2 parameters and a CurrentStage object.
- */
-function transitionToNextStage(currentStageDivSelector, currentStageData, newStageDivSelector, newStageData, newStageRenderFunction) {
+// Define App.io package
+(function() {
 
-  clearFormStatus();
+  function PeriodicDataPoller(dataSourceContext, responseHandler) {
 
-  Y.one(currentStageDivSelector).hide();
+    this.dataSourceContext = dataSourceContext;
 
-  /* Render the next stage. */
-  newStageRenderFunction(newStageData);
+    /* Smoothe out the optional bits of this.dataSourceContext. */
+    if (!this.dataSourceContext.pollInterval) {
+      /* How often we poll. */
+      this.dataSourceContext.pollInterval = DEFAULT_POLLING_INTERVAL_MS;
+    }
+    if (!this.dataSourceContext.maxFailedAttempts) {
+      /* How many failed attempts before we stop polling. */
+      this.dataSourceContext.maxFailedAttempts = 25;
+    }
 
-  Y.log("In transitionToNextStage: " + currentStageDivSelector + "->" + newStageDivSelector);
+    this.responseHandler = responseHandler;
 
-  //// tshooter: No longer doing this given dynamic rendering on stages. Only hide current stage.
-  /* And make it visibly replace the currently showing one. */
-  ///// tshooter: commented: swapStageVisibilities(currentStageDivSelector, newStageDivSelector);
+    /* Of course, we're not paused when we start off. */
+    this.paused = false;
 
-  /* And now, handle the updates to addNodesWizardStages... */
+    this.dataSource = new Y.DataSource.IO({
+      source: this.dataSourceContext.source
+    });
+
+    this.dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
+      schema: this.dataSourceContext.schema
+    });
+
+    this.dataSourcePollFailureCount = 0;
+
+    /* Set when start() is invoked. */
+    this.dataSourcePollHandle = null;
+
+    this.dataSourcePollRequestContext = {
+      request: this.dataSourceContext.request,
+      callback: {
+        success: function (e) {
+          /* Avoid race conditions in JS by not processing incoming responses
+           * from the backend if the PDP is paused (which is our signal that
+           * a previous response is still in the middle of being processed).
+           */
+          if (!(this.isPaused())) {
+            /* Reset our failure count every time we succeed. */
+            this.dataSourcePollFailureCount = 0;
 
-  /* There can be only one 'current' stage at a time. */
-  var currentStage = Y.one('.installationWizardCurrentStage');
+            /* Invoke user-pluggable code. */
+            if (this.responseHandler.success) {
+              this.responseHandler.success(e, this);
+            }
+          }
+        }.bind(this),
 
-  if (currentStage) {
-    var nextStage = null;
+        failure: function (e) {
+          if (!(this.isPaused())) {
+            ++this.dataSourcePollFailureCount;
 
-    /* Check to make sure we haven't reached the last stage. */
-    if (nextStage = currentStage.next('.installationWizardUnvisitedStage')) {
+            if (this.dataSourcePollFailureCount > this.dataSourceContext.maxFailedAttempts) {
 
-      /* Mark this up-until-now 'current' stage as 'visited'. */
-      currentStage.replaceClass('installationWizardCurrentStage', 'installationWizardVisitedStage');
+              /* Invoke user-pluggable code. */
+              if (this.responseHandler.failure) {
+                this.responseHandler.failure(e, this);
+              }
 
-      /* Mark the stage after that as the new 'current' stage. */
-      nextStage.replaceClass('installationWizardUnvisitedStage', 'installationWizardCurrentStage');
-    }
+              /* No point making any more attempts. */
+              this.stop();
+            }
+          }
+        }.bind(this)
+      }
+    };
   }
-}
 
-function clearFormStatus() {
-  var formStatusDiv = Y.all("#formStatusDivId");
-  // formStatusDiv.setContent("");
-  formStatusDiv.setStyle("visibility", "hidden");
-  formStatusDiv.hide();
-  formStatusDiv.set('className', '');
-  formStatusDiv.addClass("formStatusBar");
-}
+  /* Start polling. */
+  PeriodicDataPoller.prototype.start = function () {
 
-function setFormStatus(statusString, isError, noFade) {
-  var formStatusDivCssClass;
-  if (isError) {
-    formStatusDivCssClass = 'statusError';
-  } else {
-    formStatusDivCssClass = 'statusOk';
-  }
-  var formStatusDiv = Y.all("#formStatusDivId");
-  formStatusDiv.setStyle("visibility", "visible");
-  formStatusDiv.show();
-  formStatusDiv.set('className', '');
-  formStatusDiv.addClass("formStatusBar");
-  formStatusDiv.addClass(formStatusDivCssClass);
-  formStatusDiv.setContent(statusString);
-}
+    this.dataSourcePollHandle = this.dataSource.setInterval
+      (this.dataSourceContext.pollInterval, this.dataSourcePollRequestContext);
+  };
 
-function executeStage(inputUrl, renderStageFunction) {
-  Y.io(inputUrl, {
-    method: 'GET',
-    timeout: App.io.DEFAULT_AJAX_TIMEOUT_MS,
-    on: {
-      success: function (x, o) {
-        var responseJson;
-
-        Y.log("RAW JSON DATA: " + o.responseText);
-        // Process the JSON data returned from the server
-        try {
-          responseJson = Y.JSON.parse(o.responseText);
-        }
-        catch (e) {
-          hideLoadingImg();
-          alert("JSON Parse failed!");
-          return;
-        }
+  /* Stop polling. */
+  PeriodicDataPoller.prototype.stop = function () {
 
-        Y.log("PARSED DATA: " + Y.Lang.dump(responseJson));
+    /* Always unPause() during stop(), so the next start() won't be neutered. */
+    this.unPause();
+    this.dataSource.clearInterval(this.dataSourcePollHandle);
+  };
 
-        if (responseJson.result != 0) {
-          hideLoadingImg();
-          // Error!
-          alert("Got error during getting data: " + responseJson.error);
-          return;
-        }
-        responseJson = responseJson.response;
-        renderStageFunction(responseJson);
-        hideLoadingImg();
-        return;
-      },
-      failure: function (x, o) {
-        alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
-        return;
-      }
-    }
-  });
-}
+  /* When the PDP is paused, the polling continues on its regular fixed
+   * interval, but this.responseHandler is not invoked, thus avoiding
+   * a race condition (at least) in JS.
+   *
+   * TODO XXX Improve upon this to not even make calls to the backend
+   * while not losing our periodicity.
+   */
+  PeriodicDataPoller.prototype.pause = function () {
 
-function submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction, errorHandlerFunction) {
-  App.ui.showLoadingOverlay();
+    this.paused = true;
+  };
 
-  Y.io(url, {
+  PeriodicDataPoller.prototype.unPause = function () {
 
-    method: 'POST',
-    data: Y.JSON.stringify(requestData),
-    timeout: App.io.DEFAULT_AJAX_TIMEOUT_MS,
-    on: {
-      start: function (x, o) {
-        submitButton.set('disabled', true);
-        Y.log("In start function");
-        // showLoadingImg();
-      },
-      complete: function (x, o) {
-        submitButton.set('disabled', false);
-        Y.log("In stop function");
-        // hideLoadingImg();
-      },
-      success: function (x, o) {
-        var responseJson;
-
-        submitButton.set('disabled', false);
-        Y.log("RAW JSON DATA: " + o.responseText);
-
-        // Process the JSON data returned from the server
-        try {
-          responseJson = Y.JSON.parse(o.responseText);
-        }
-        catch (e) {
-          submitButton.set('disabled', false);
-          hideLoadingImg();
-          alert("JSON Parse failed!");
-          return;
-        }
+    this.paused = false;
+  };
 
-        Y.log("PARSED DATA: " + Y.Lang.dump(responseJson));
+  PeriodicDataPoller.prototype.isPaused = function () {
 
-        if (responseJson.result != 0) {
-          submitButton.set('disabled', false);
-          // Error!
-          Y.log("Got error during submit data!" + responseJson.error);
-          if (errorHandlerFunction) {
-            Y.log("Invoking error handler function");
-            errorHandlerFunction(responseJson);
-          } else {
-            alert("Got error during submit data!" + responseJson.error);
-          }
-          App.ui.hideLoadingOverlay();
-          return;
-        }
-        responseJson = responseJson.response;
+    return this.paused;
+  };
 
-        /* Done with this stage, transition to the next. */
-        transitionToNextStage(thisScreenId, requestData, nextScreenId, responseJson, nextScreenRenderFunction);
-      },
-      failure: function (x, o) {
-        submitButton.set('disabled', false);
-        alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
-      }
-    }
-  });
-}
+  /* Perform a one-time poll.
+   *
+   * Meant to be used when the polling is not at a set frequency (as with the
+   * start()/stop() pair), and is instead meant to be under explicit
+   * control of the application.
+   */
+  PeriodicDataPoller.prototype.pollOnce = function () {
 
-function PeriodicDataPoller(dataSourceContext, responseHandler) {
+    Y.io(this.dataSourceContext.source + this.dataSourcePollRequestContext.request, {
+      on: this.dataSourcePollRequestContext.callback
+    });
+  };
 
-  this.dataSourceContext = dataSourceContext;
+  // exports
+  App.io = {
+    PeriodicDataPoller: PeriodicDataPoller,
+    DEFAULT_AJAX_TIMEOUT_MS: 10000,
+    FETCH_LOG_TIMEOUT_MS: 20000,
+    DEFAULT_POLLING_INTERVAL_MS: 5000,
+    DEFAULT_AJAX_ERROR_MESSAGE: 'Failed to retrieve information from the server'
+  };
 
-  /* Smoothe out the optional bits of this.dataSourceContext. */
-  if (!this.dataSourceContext.pollInterval) {
-    /* How often we poll. */
-    this.dataSourceContext.pollInterval = DEFAULT_POLLING_INTERVAL_MS;
-  }
-  if (!this.dataSourceContext.maxFailedAttempts) {
-    /* How many failed attempts before we stop polling. */
-    this.dataSourceContext.maxFailedAttempts = 25;
+})();
+
+// define App.util package
+(function() {
+
+  function titleCase(word) {
+    return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase();
   }
 
-  this.responseHandler = responseHandler;
+  // exports
+  App.util = {
+    titleCase: titleCase
+  };
 
-  /* Of course, we're not paused when we start off. */
-  this.paused = false;
+})();
 
-  this.dataSource = new Y.DataSource.IO({
-    source: this.dataSourceContext.source
-  });
+// Define App.transition package
+(function() {
 
-  this.dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
-    schema: this.dataSourceContext.schema
-  });
+  function transitionToNextStage(currentStageDivSelector, currentStageData, newStageDivSelector, newStageData, newStageRenderFunction) {
 
-  this.dataSourcePollFailureCount = 0;
+    App.ui.clearFormStatus();
 
-  /* Set when start() is invoked. */
-  this.dataSourcePollHandle = null;
+    Y.one(currentStageDivSelector).hide();
 
-  this.dataSourcePollRequestContext = {
-    request: this.dataSourceContext.request,
-    callback: {
-      success: function (e) {
-        /* Avoid race conditions in JS by not processing incoming responses
-         * from the backend if the PDP is paused (which is our signal that
-         * a previous response is still in the middle of being processed).
-         */
-        if (!(this.isPaused())) {
-          /* Reset our failure count every time we succeed. */
-          this.dataSourcePollFailureCount = 0;
+    /* Render the next stage. */
+    newStageRenderFunction(newStageData);
 
-          /* Invoke user-pluggable code. */
-          if (this.responseHandler.success) {
-            this.responseHandler.success(e, this);
-          }
-        }
-      }.bind(this),
+    Y.log("In transitionToNextStage: " + currentStageDivSelector + "->" + newStageDivSelector);
 
-      failure: function (e) {
-        if (!(this.isPaused())) {
-          ++this.dataSourcePollFailureCount;
+    /* There can be only one 'current' stage at a time. */
+    var currentStage = Y.one('.installationWizardCurrentStage');
 
-          if (this.dataSourcePollFailureCount > this.dataSourceContext.maxFailedAttempts) {
+    if (currentStage) {
+      var nextStage = null;
 
-            /* Invoke user-pluggable code. */
-            if (this.responseHandler.failure) {
-              this.responseHandler.failure(e, this);
-            }
+      /* Check to make sure we haven't reached the last stage. */
+      if (nextStage = currentStage.next('.installationWizardUnvisitedStage')) {
 
-            /* No point making any more attempts. */
-            this.stop();
-          }
-        }
-      }.bind(this)
-    }
-  };
-}
+        /* Mark this up-until-now 'current' stage as 'visited'. */
+        currentStage.replaceClass('installationWizardCurrentStage', 'installationWizardVisitedStage');
 
-/* Start polling. */
-PeriodicDataPoller.prototype.start = function () {
+        /* Mark the stage after that as the new 'current' stage. */
+        nextStage.replaceClass('installationWizardUnvisitedStage', 'installationWizardCurrentStage');
+      }
+    }
+  }
 
-  this.dataSourcePollHandle = this.dataSource.setInterval
-    (this.dataSourceContext.pollInterval, this.dataSourcePollRequestContext);
-};
+  function swapStageVisibilities(currentStageDivSelector, newStageDivSelector) {
 
-/* Stop polling. */
-PeriodicDataPoller.prototype.stop = function () {
+    Y.log("In swapStageVisibilities: " + currentStageDivSelector + "->" + newStageDivSelector);
+    /* Hide the current stage. */
+    Y.one(currentStageDivSelector).hide();
 
-  /* Always unPause() during stop(), so the next start() won't be neutered. */
-  this.unPause();
-  this.dataSource.clearInterval(this.dataSourcePollHandle);
-};
+    /* Show the new stage. */
+    Y.one(newStageDivSelector).show();
+  }
 
-/* When the PDP is paused, the polling continues on its regular fixed
- * interval, but this.responseHandler is not invoked, thus avoiding
- * a race condition (at least) in JS.
- *
- * TODO XXX Improve upon this to not even make calls to the backend
- * while not losing our periodicity.
- */
-PeriodicDataPoller.prototype.pause = function () {
+  function executeStage(inputUrl, renderStageFunction) {
+    Y.io(inputUrl, {
+      method: 'GET',
+      timeout: App.io.DEFAULT_AJAX_TIMEOUT_MS,
+      on: {
+        success: function (x, o) {
+          var responseJson;
+
+          Y.log("RAW JSON DATA: " + o.responseText);
+          // Process the JSON data returned from the server
+          try {
+            responseJson = Y.JSON.parse(o.responseText);
+          }
+          catch (e) {
+            App.ui.hideLoadingOverlay();
+            alert("JSON Parse failed!");
+            return;
+          }
 
-  this.paused = true;
-};
+          Y.log("PARSED DATA: " + Y.Lang.dump(responseJson));
 
-PeriodicDataPoller.prototype.unPause = function () {
+          if (responseJson.result != 0) {
+            App.ui.hideLoadingOverlay();
+            // Error!
+            alert("Got error during getting data: " + responseJson.error);
+            return;
+          }
+          responseJson = responseJson.response;
+          renderStageFunction(responseJson);
+          App.ui.hideLoadingOverlay();
+          return;
+        },
+        failure: function (x, o) {
+          alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
+          return;
+        }
+      }
+    });
+  }
 
-  this.paused = false;
-};
+  function submitDataAndProgressToNextScreen(url, requestData, submitButton, thisScreenId, nextScreenId, nextScreenRenderFunction, errorHandlerFunction) {
+    App.ui.showLoadingOverlay();
 
-PeriodicDataPoller.prototype.isPaused = function () {
+    Y.io(url, {
 
-  return this.paused;
-};
+      method: 'POST',
+      data: Y.JSON.stringify(requestData),
+      timeout: App.io.DEFAULT_AJAX_TIMEOUT_MS,
+      on: {
+        start: function (x, o) {
+          submitButton.set('disabled', true);
+          Y.log("In start function");
+          // App.ui.showLoadingOverlay();
+        },
+        complete: function (x, o) {
+          submitButton.set('disabled', false);
+          Y.log("In stop function");
+          // App.ui.hideLoadingOverlay();
+        },
+        success: function (x, o) {
+          var responseJson;
 
-/* Perform a one-time poll.
- *
- * Meant to be used when the polling is not at a set frequency (as with the
- * start()/stop() pair), and is instead meant to be under explicit
- * control of the application.
- */
-PeriodicDataPoller.prototype.pollOnce = function () {
+          submitButton.set('disabled', false);
+          Y.log("RAW JSON DATA: " + o.responseText);
 
-  Y.io(this.dataSourceContext.source + this.dataSourcePollRequestContext.request, {
-    on: this.dataSourcePollRequestContext.callback
-  });
-};
+          // Process the JSON data returned from the server
+          try {
+            responseJson = Y.JSON.parse(o.responseText);
+          }
+          catch (e) {
+            submitButton.set('disabled', false);
+            App.ui.hideLoadingOverlay();
+            alert("JSON Parse failed!");
+            return;
+          }
 
-function titleCase(word) {
-  return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase();
-}
+          Y.log("PARSED DATA: " + Y.Lang.dump(responseJson));
 
-// Create namespace and export functionality.
-// We'll remove globally defined functions and properties eventually
-// by wrapping in a closure.
-// For now we need to keep the non-namespaced global functions and properties
-// so that our existing code continues to work without major refactoring.
+          if (responseJson.result != 0) {
+            submitButton.set('disabled', false);
+            // Error!
+            Y.log("Got error during submit data!" + responseJson.error);
+            if (errorHandlerFunction) {
+              Y.log("Invoking error handler function");
+              errorHandlerFunction(responseJson);
+            } else {
+              alert("Got error during submit data!" + responseJson.error);
+            }
+            App.ui.hideLoadingOverlay();
+            return;
+          }
+          responseJson = responseJson.response;
 
-var App = App || {
-  props: {
-    managerServiceName: 'Ambari',
-    clusterName: '',
-    homeUrl: '/hmc/html/'
-  },
-  io: {
-    PeriodicDataPoller: PeriodicDataPoller,
-    DEFAULT_AJAX_TIMEOUT_MS: 10000,
-    FETCH_LOG_TIMEOUT_MS: 20000,
-    DEFAULT_POLLING_INTERVAL_MS: 5000,
-    DEFAULT_AJAX_ERROR_MESSAGE: 'Failed to retrieve information from the server'
-  },
-  ui: {
-    createInfoPanel: createInfoPanel,
-    showLoadingOverlay: showLoadingImg,
-    hideLoadingOverlay: hideLoadingImg
+          /* Done with this stage, transition to the next. */
+          transitionToNextStage(thisScreenId, requestData, nextScreenId, responseJson, nextScreenRenderFunction);
+        },
+        failure: function (x, o) {
+          submitButton.set('disabled', false);
+          alert(App.io.DEFAULT_AJAX_ERROR_MESSAGE);
+        }
+      }
+    });
   }
-};
 
-// On some pages the clusterName global variable is set before
-// this file is loaded.  Remember it in the App namespace.
-if (typeof clusterName !== 'undefined') {
-  App.props.clusterName = clusterName;
-}
+  // exports
+  App.transition = {
+    transitionToNextStage: transitionToNextStage,
+    swapStageVisibilities: swapStageVisibilities,
+    executeStage: executeStage,
+    submitDataAndProgressToNextScreen: submitDataAndProgressToNextScreen
+  };
+})();
 

Modified: incubator/ambari/trunk/hmc/php/frontend/fetchClusterServices.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/frontend/fetchClusterServices.php?rev=1359871&r1=1359870&r2=1359871&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/frontend/fetchClusterServices.php (original)
+++ incubator/ambari/trunk/hmc/php/frontend/fetchClusterServices.php Tue Jul 10 20:02:25 2012
@@ -191,7 +191,7 @@ if ($getConfigs == "true") {
             "displayName" => $propInfo["displayName"],
             "description" => $propInfo["description"],
             "type" => $propInfo["displayType"],
-        	"unit" => $propInfo["displayAttributes"]["unit"],
+            "unit" => $propInfo["displayAttributes"]["unit"],
             "value" => $value,
             "displayAttributes" => $propInfo["displayAttributes"]
           );



Mime
View raw message