incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vik...@apache.org
Subject svn commit: r1347165 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/html/head.inc hmc/html/installFailed.php hmc/html/reinstall.php hmc/html/topnav.htmli hmc/js/deployProgress.js hmc/php/conf/MessageResources-en.inc
Date Wed, 06 Jun 2012 22:05:45 GMT
Author: vikram
Date: Wed Jun  6 22:05:45 2012
New Revision: 1347165

URL: http://svn.apache.org/viewvc?rev=1347165&view=rev
Log:
AMBARI-358. Make index.php always accessible, rather than automatically forwarding to the
action, even if there's only one action that the user can take (Contributed by Yusaku)

Added:
    incubator/ambari/branches/ambari-186/hmc/html/installFailed.php
Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/html/head.inc
    incubator/ambari/branches/ambari-186/hmc/html/reinstall.php
    incubator/ambari/branches/ambari-186/hmc/html/topnav.htmli
    incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js
    incubator/ambari/branches/ambari-186/hmc/php/conf/MessageResources-en.inc

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347165&r1=1347164&r2=1347165&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed Jun  6 22:05:45 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-358. Make index.php always accessible, rather than automatically forwarding to the
action, even if there's only one action that the user can take (Yusaku via Vikram)
+
   AMBARI-390. Handle multiple ZooKeeper service masters in Assign Masters page (Yusaku via
Vikram)
 
   AMBARI-389. Do not allow invalid chars for database name and user name for hive (Hitesh
via Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/html/head.inc
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/head.inc?rev=1347165&r1=1347164&r2=1347165&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/head.inc (original)
+++ incubator/ambari/branches/ambari-186/hmc/html/head.inc Wed Jun  6 22:05:45 2012
@@ -6,21 +6,35 @@ require_once "../php/util/lock.php";
 require_once '../php/db/HMCDBAccessor.php';
 require_once "../php/util/clusterState.php";
 
+/* 
+ * due to the way include files are scoped,
+ * we return the string to be eval'd, rather than
+ * executing them.
+ */
+function redirectToPage($requestPage, $targetPage) {
+  // if the page is index.php or the root app directory, don't redirect... simply include
+  if ($requestPage != 'index.php' && $requestPage != 'html') {
+    return "header('Location: /hmc/html/$targetPage');";
+  } else {
+    return "require('$targetPage');";
+  }
+}
+
 $logger = new HMCLogger("Interceptor");
 $db = new HMCDBAccessor($GLOBALS["DB_PATH"]);
+$appDir = "/hmc/html";
 
 $res = $db->getAllClusters();
 $clusters = $res['clusters'];
-$baseUrl = basename(preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']));
-$logger->log_trace('basename='.$baseUrl);
-$appDir = "/hmc/html";
+$requestPage = basename(preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']));
+$logger->log_trace('requestPage='.$requestPage);
 
-$logger->log_trace('basename='.$baseUrl);
 if (sizeof($clusters) == 0) {
-  if ($baseUrl != 'welcome.php' && $baseUrl != 'initializeCluster.php') {
-    header("Location: $appDir/welcome.php");
-    return;
+  if ($requestPage != 'welcome.php' && $requestPage != 'initializeCluster.php') {
+    eval(redirectToPage($requestPage, 'welcome.php'));
+    exit;
   }
+  $clusterState = 'NOT_CONFIGURED';
 } else {
   foreach ($clusters as $cluster) {
     $state = json_decode($cluster['state'], true);    
@@ -28,23 +42,31 @@ if (sizeof($clusters) == 0) {
     switch ($state['state']) {
       case 'DEPLOYED':
         if ($state['context']['status']) {
-          return;
+          $clusterState = 'OPERATIONAL';
         } else {
-          if ($baseUrl != "reinstall.php" && $baseUrl != "uninstallWizard.php") {
-            header("Location: $appDir/reinstall.php");
-            return;
+          if ($requestPage != 'installFailed.php' && $requestPage != 'uninstallWizard.php')
{
+            eval(redirectToPage($requestPage, 'installFailed.php'));
+            exit; 
           }
+          $clusterState = 'DEPLOY_FAILED';            
         }
         break;
       case 'CONFIGURATION_IN_PROGRESS':
-        if ($baseUrl != 'initializeCluster.php') {
-          header("Location: $appDir/initializeCluster.php");
+        if ($requestPage != 'reinstall.php' && $requestPage != 'initializeCluster.php')
{
+          $targetPage = 'reinstall.php';
+          eval(redirectToPage($requestPage, 'reinstall.php'));
+          exit;
         }
+        $clusterState = 'CONFIGURATION_IN_PROGRESS';
         break;      
       case 'DEPLOYMENT_IN_PROGRESS':
-        if ($baseUrl != 'showDeployProgress.php') {
-          header("Location: $appDir/showDeployProgress.php?clusterName=" . $cluster['clusterName']);
         
-        }
+        if ($requestPage != 'showDeployProgress.php') {
+          $targetPage = 'showDeployProgress.php?clusterName=' . $cluster['clusterName'];
+          $_GET['clusterName'] = $cluster['clusterName'];
+          eval(redirectToPage($requestPage, 'showDeployProgress.php'));
+          exit;
+        }          
+        $clusterState = 'DEPLOYMENT_IN_PROGRESS';
         break;
     } 
   }  

Added: incubator/ambari/branches/ambari-186/hmc/html/installFailed.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/installFailed.php?rev=1347165&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/installFailed.php (added)
+++ incubator/ambari/branches/ambari-186/hmc/html/installFailed.php Wed Jun  6 22:05:45 2012
@@ -0,0 +1,28 @@
+<?php require_once "./head.inc" ?>
+<html>
+  <head>
+    <title id="pageTitleId"><?php echo $RES['page.title'] ?></title>
+
+    <!-- CSS -->
+    <link type="text/css" rel="stylesheet" href="../yui-3.5.1/build/cssreset/cssreset-min.css">

+    <link type="text/css" rel="stylesheet" href="../css/bootstrap.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common3.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/selectHosts.css" media="screen"/>
+    <link rel="shortcut icon" href="../images/logo-micro.gif">
+    <!-- End CSS -->
+  </head>
+  <body class="yui3-skin-sam">
+    <?php require "./topnav.htmli"; ?>
+    <div id="ContentDivId"> 
+      <div class="container">
+        <div class="alert alert-important" style="margin-top:40px;padding:20px">
+          <h2 style="margin-bottom:10px"><?php echo $RES['installFailed.header']
?></h2>
+          <p><?php echo $RES['installFailed.body'] ?></p>
+          <a class='btn btn-large' style='margin-top:20px' href='uninstallWizard.php'><?php
echo $RES['installFailed.submit.label'] ?></a>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>
\ No newline at end of file

Modified: incubator/ambari/branches/ambari-186/hmc/html/reinstall.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/reinstall.php?rev=1347165&r1=1347164&r2=1347165&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/reinstall.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/html/reinstall.php Wed Jun  6 22:05:45 2012
@@ -20,7 +20,7 @@
         <div class="alert alert-important" style="margin-top:40px;padding:20px">
           <h2 style="margin-bottom:10px"><?php echo $RES['reinstall.header'] ?></h2>
           <p><?php echo $RES['reinstall.body'] ?></p>
-          <a class='btn btn-large' style='margin-top:20px' href='uninstallWizard.php'><?php
echo $RES['reinstall.submit.label'] ?></a>
+          <a class='btn btn-large' style='margin-top:20px' href='initializeCluster.php'><?php
echo $RES['reinstall.submit.label'] ?></a>
         </div>
       </div>
     </div>

Modified: incubator/ambari/branches/ambari-186/hmc/html/topnav.htmli
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/topnav.htmli?rev=1347165&r1=1347164&r2=1347165&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/topnav.htmli (original)
+++ incubator/ambari/branches/ambari-186/hmc/html/topnav.htmli Wed Jun  6 22:05:45 2012
@@ -1,10 +1,6 @@
 <!-- START TOPNAV -->
     <?php 
 		if (basename($_SERVER['REQUEST_URI']) == 'initializeCluster.php') {
-			$isInitWizard = true;
-			$logoUrl = 'javascript:void 0';
-        } else {
-        	$isInitWizard = false;
 			$logoUrl = '/hmc/html';
 		}
 	?>
@@ -13,7 +9,7 @@
 			<div class="container">
 				<a href="<?php echo $logoUrl ?>"><img id="logo" src="../images/logo-small.gif"></a>
 				<a class="brand" href="<?php echo $logoUrl ?>"><?php echo $RES['app.name']
?></a>
-				<?php if (!$isInitWizard) { ?> 
+				<?php if ($clusterState == 'OPERATIONAL') { ?> 
 				<ul class="nav">
 					<li class="active"><a href="/hmc/html">Cluster Management</a>
 					</li>

Modified: incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js?rev=1347165&r1=1347164&r2=1347165&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js Wed Jun  6 22:05:45 2012
@@ -123,7 +123,7 @@ function renderDeployProgress (deployPro
           '</a>'
       );          
       globalYui.one("#restartInstallationWizardLinkId").on( "click", function(e) {
-        document.location.href = 'reinstall.php';
+        document.location.href = 'installFailed.php';
       });
       globalYui.one('#txnProgressStatusActionsDivId').setStyle('display','block');
 

Modified: incubator/ambari/branches/ambari-186/hmc/php/conf/MessageResources-en.inc
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/conf/MessageResources-en.inc?rev=1347165&r1=1347164&r2=1347165&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/conf/MessageResources-en.inc (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/conf/MessageResources-en.inc Wed Jun  6 22:05:45
2012
@@ -3,9 +3,15 @@ $RES['app.name']="Hortonworks Management
 $RES['page.title']="Hortonworks Management Center";
 $RES['page.footer.body']="Hortonworks &copy; 2012";
 $RES['welcome.header']="Welcome to Hortonworks Management Center!";
-$RES['welcome.body']="<p>Hortonworks Management Center makes it really easy for you
to install, configure, and manage your Hadoop cluster.</p><p>First, we'll walk
you through the cluster set up with a 7-step wizard.</p>";
+$RES['welcome.body']="<p>Hortonworks Management Center makes it really easy for you
to install, configure, and manage your Hadoop cluster.</p><p>First, we'll walk
you through setting up your cluster with a 7-step wizard.</p>";
 $RES['welcome.note']="Before you proceed, make sure you have performed all the pre-installation
steps (REFERENCE MATERIAL HERE).";
 $RES['welcome.submit.label']="Let's get started!";
+$RES['installFailed.header']="Cluster installation failed";
+$RES['installFailed.body']="Cluster installation failed.  To continue, you will need to uninstall
the cluster first and re-install the cluster.";
+$RES['installFailed.submit.label']="Start the uninstall process";
+$RES['reinstall.header']="You have not set up a cluster yet.";
+$RES['reinstall.body']="We'll walk you through setting up your cluster with a 7-step wizard.";
+$RES['reinstall.submit.label']="Let's get started!";
 $RES['common.sshUsername.label']="SSH Username";
 $RES['common.sshPrivateKeyFile.label']="SSH Private Key File";
 $RES['common.hostsFile.label']="Hosts File (newline-delimited list of hostnames)";
@@ -41,11 +47,11 @@ $RES['addNodesWizard.addNodes.pageSummar
 $RES['addNodesWizard.addNodes.pageSummary.body']="We'll use the SSH private key and a file
containing a list of hostnames to perform installation on your nodes.  The public key that
is paired with the private key must already be installed on all the nodes.";
 $RES['addNodesWizard.addNodes.submit.label']="Add Nodes";
 $RES['addNodesWizard.selectServices.pageSummary.header']='Which services do you want to install?';
-$RES['addNodesWizard.selectServices.pageSummary.body']="Some services are installed by default.";
+$RES['addNodesWizard.selectServices.pageSummary.body']="Some services will be installed by
default.";
 $RES['addNodesWizard.selectServices.submit.label']="Deploy";
 $RES['uninstallWizard.pageSummary.header']="Uninstall Cluster";
 $RES['uninstallWizard.pageSummary.body']="<span class='label label-important'>Warning</span>
 Proceed with caution!  This will delete all services from all of your nodes in the cluster
(and all of your data, if you choose the <i>wipe out</i> option).";
 $RES['uninstallWizard.wipeout.label']="Perform wipe out (delete all data)";
 $RES['uninstallWizard.submit.label']="Uninstall Cluster";
-
+$RES['initWizard.configureClusterAdvanced.validation.error']="We've encountered invalid settings.";
 ?>
\ No newline at end of file



Mime
View raw message