incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vik...@apache.org
Subject svn commit: r1346649 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/css/common.css hmc/html/head.inc
Date Tue, 05 Jun 2012 23:08:28 GMT
Author: vikram
Date: Tue Jun  5 23:08:28 2012
New Revision: 1346649

URL: http://svn.apache.org/viewvc?rev=1346649&view=rev
Log:
AMBARI-352. Add flow control - force redirects to appropriate pages based on cluster configuration
status for better usability (Contributed by Yusaku)

Added:
    incubator/ambari/branches/ambari-186/hmc/html/head.inc
Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/css/common.css

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1346649&r1=1346648&r2=1346649&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Tue Jun  5 23:08:28 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-352. Add flow control - force redirects to appropriate pages based on cluster configuration
status for better usability (Yusaku via Vikram)
+
   AMBARI-351.  Monitoring dashboard should auto refresh as regular interval (Vitthal Gogate
via Vikram)
 
   AMBARI-349. Logging in case of error during uninstall needs to be fixed. (Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/css/common.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/css/common.css?rev=1346649&r1=1346648&r2=1346649&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/css/common.css (original)
+++ incubator/ambari/branches/ambari-186/hmc/css/common.css Tue Jun  5 23:08:28 2012
@@ -276,6 +276,10 @@ td {
 	margin:40px 0 0 40px;
 }
 
+div.formElement {
+	clear:both;
+}
+
 #configureClusterAdvancedCoreDivId label,
 #deployDynamicRenderDivId label,
 #deployCoreDivId label {

Added: 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=1346649&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/head.inc (added)
+++ incubator/ambari/branches/ambari-186/hmc/html/head.inc Tue Jun  5 23:08:28 2012
@@ -0,0 +1,52 @@
+<?php
+require_once '../php/conf/MessageResources-en.inc';
+require_once '../php/util/Logger.php';
+require_once '../php//conf/Config.inc';
+require_once "../php/util/lock.php";
+require_once '../php/db/HMCDBAccessor.php';
+require_once "../php/util/clusterState.php";
+
+$logger = new HMCLogger("Interceptor");
+$db = new HMCDBAccessor($GLOBALS["DB_PATH"]);
+
+$res = $db->getAllClusters();
+$clusters = $res['clusters'];
+$baseUrl = basename(preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']));
+$logger->log_trace('basename='.$baseUrl);
+$appDir = "/hmc/html";
+
+$logger->log_trace('basename='.$baseUrl);
+if (sizeof($clusters) == 0) {
+  if ($baseUrl != 'welcome.php' && $baseUrl != 'initializeCluster.php') {
+    header("Location: $appDir/welcome.php");
+    return;
+  }
+} else {
+  foreach ($clusters as $cluster) {
+    $state = json_decode($cluster['state'], true);    
+    $logger->log_trace('cluster state='.print_r($state,1));
+    switch ($state['state']) {
+      case 'DEPLOYED':
+        if ($state['context']['status']) {
+          return;
+        } else {
+          if ($baseUrl != "reinstall.php" && $baseUrl != "uninstallWizard.php") {
+            header("Location: $appDir/reinstall.php");
+            return;
+          }
+        }
+        break;
+      case 'CONFIGURATION_IN_PROGRESS':
+        if ($baseUrl != 'initializeCluster.php') {
+          header("Location: $appDir/initializeCluster.php");
+        }
+        break;      
+      case 'DEPLOYMENT_IN_PROGRESS':
+        if ($baseUrl != 'showDeployProgress.php') {
+          header("Location: $appDir/showDeployProgress.php?clusterName=" . $cluster['clusterName']);
         
+        }
+        break;
+    } 
+  }  
+}
+?>
\ No newline at end of file



Mime
View raw message