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:15:25 UTC
svn commit: r1347253 - in /incubator/ambari/branches/ambari-186: ./ hmc/css/
hmc/html/ hmc/js/ hmc/php/orchestrator/ hmc/php/util/
Author: vikram
Date: Thu Jun 7 01:15:25 2012
New Revision: 1347253
URL: http://svn.apache.org/viewvc?rev=1347253&view=rev
Log:
AMBARI-448. Redesign progress popups (Contributed by Yusaku)
Modified:
incubator/ambari/branches/ambari-186/CHANGES.txt
incubator/ambari/branches/ambari-186/hmc/css/common.css
incubator/ambari/branches/ambari-186/hmc/css/common3.css
incubator/ambari/branches/ambari-186/hmc/html/bootstrapJs.htmli
incubator/ambari/branches/ambari-186/hmc/html/initializeCluster.php
incubator/ambari/branches/ambari-186/hmc/html/txnUtils.htmli
incubator/ambari/branches/ambari-186/hmc/js/addNodesProgress.js
incubator/ambari/branches/ambari-186/hmc/js/clustersList.js
incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js
incubator/ambari/branches/ambari-186/hmc/js/manageServices.js
incubator/ambari/branches/ambari-186/hmc/js/txnUtils.js
incubator/ambari/branches/ambari-186/hmc/js/uninstallProgress.js
incubator/ambari/branches/ambari-186/hmc/js/utils.js
incubator/ambari/branches/ambari-186/hmc/php/orchestrator/State.php
incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php
incubator/ambari/branches/ambari-186/hmc/php/util/util.php
Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Thu Jun 7 01:15:25 2012
@@ -6,6 +6,8 @@ characters wide.
Release 0.1.x - unreleased
+ AMBARI- 448. Redesign progress popups. (Yusaku via Vikram)
+
AMBARI-444, 445. Nagios checks send kicks to the agent that trigger a run. Configure nagios to send email notifications when slaves go down (Suhas via Vikram)
AMBARI-443. Nagios start fails on reinstall. Fix for previous patch. (Ramya via 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=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/css/common.css (original)
+++ incubator/ambari/branches/ambari-186/hmc/css/common.css Thu Jun 7 01:15:25 2012
@@ -55,7 +55,7 @@ select {
#blackScreenDivId, #loadingBlackScreenDivId {
position:fixed;
background-color:black;
- opacity:0.7;
+ opacity:0.8;
height:100%;
width:100%;
top:0px;
@@ -536,4 +536,141 @@ div.separator {
.navbar #logo {
float:left;
padding-top:7px;
-}
\ No newline at end of file
+}
+/* BEGIN progress box styles */
+#txnProgressBox {
+ width:auto;
+ border: 1px solid rgba(0, 0, 0, 0.10);
+ border-radius: 4px 4px 4px 4px;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;
+ background-color:#ffffff;
+ min-height:80px;
+}
+#txnProgressBox ul {
+ list-style-type:none;
+ width:500px;
+ margin:0;
+ padding:20px;
+ font-size:13px;
+}
+#txnProgressBox ul li {
+ margin-bottom:3px;
+ text-align:right;
+ clear:both;
+}
+#txnProgressBox ul label {
+ width:140px;
+ float:left;
+ margin-right:8px;
+}
+#txnProgressBox ul.wrapped li {
+ margin-bottom:18px;
+ text-align:left;
+ clear:both;
+}
+#txnProgressBox ul.wrapped li:last-child {
+ margin-bottom:0px;
+}
+#txnProgressBox ul.wrapped label {
+ width:auto;
+ float:none;
+ background:none;
+ box-shadow:none;
+ margin-bottom:2px;
+}
+#txnProgressBox ul .progress {
+ /*height:10px;*/
+ width:240px;
+}
+#txnProgressBox ul.wrapped .progress {
+ width:100%;
+}
+#txnProgressBox #buttonArea {
+ background-color:#fefefe;
+ padding:6px 20px;
+}
+#txnProgressBox ul .progress {
+ height:12px;
+ margin-top:3px;
+ margin-bottom:0;
+ float:left;
+}
+#txnProgressBox ul.wrapped .progress {
+ margin-bottom:0;
+ float:none;
+}
+#txnProgressBox label.txnProgressStatePending {
+ color:#999;
+}
+#txnProgressBox label.txnProgressStateDone {
+}
+#txnProgressBox label.txnProgressStateError {
+ color:red;
+}
+#txnProgressBox label.txnProgressStateInProgress {
+ color:#333;
+ font-weight:bold;
+}
+#txnProgressBox .progress .bar {
+ width:0;
+}
+#txnProgressBox .progress.active .bar {
+ width:auto;
+}
+#txnProgressBox .progress.progress-success .bar {
+ width:auto;
+}
+#txnProgressBox .progress.progress-danger .bar {
+ width:auto;
+}
+#txnProgressBox .status {
+ margin-left:8px;
+ float:left;
+}
+#txnProgressBox .status.txnProgressStatePending {
+ color:#999;
+}
+#txnProgressBox .status.txnProgressStateDone {
+ color:green;
+}
+#txnProgressBox .status.txnProgressStateInProgress {
+ color:#149BDF;
+ font-weight:bold;
+}
+#txnProgressBox .status.txnProgressStateError {
+ color:red;
+}
+#txnProgressBox #successInfoLinkId {
+ margin-left:20px;
+}
+#txnProgressHeader {
+ background-color:#f0f0f0;
+ border-bottom: 1px solid #DDDDDD;
+ box-shadow: 0 1px 0 #FFFFFF inset;
+ color:#333333;
+ font-size:18px;
+ font-weight:bold;
+ padding:9px 15px;
+ min-width:500px;
+}
+#activeProgressBar.wrapped {
+ width:500px;
+ height:12px;
+ float:none;
+}
+#activeProgressBar {
+ margin-top:3px;
+ width:240px;
+ height:12px;
+ float:none;
+}
+.wrapped #activeProgressBarContainer {
+ height:12px;
+ float:none;
+}
+#activeProgressBarContainer {
+ height:12px;
+ float:left;
+}
+
+/* END progress popup styles */
\ No newline at end of file
Modified: incubator/ambari/branches/ambari-186/hmc/css/common3.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/css/common3.css?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/css/common3.css (original)
+++ incubator/ambari/branches/ambari-186/hmc/css/common3.css Thu Jun 7 01:15:25 2012
@@ -71,68 +71,6 @@ span.installationWizardStageNumber {
-webkit-border-radius:4px;
}
-#txnProgressStatesListId {
- margin:0;
- padding:20px;
- list-style:none;
-}
-
-#txnProgressStatesListId li div {
- height: 2em;
- color: black;
- border-style: solid;
- border-width: 2px;
-
- background-color:#F0F0E8;
- /*
- background-color: #c5c5c5;
- background-color:white;
- background-color:#F0F0E8;
- */
- text-align: center;
- margin-bottom: 10px;
- border-radius:4px;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
- padding-top: 1em;
- font-size: larger;
-}
-
-.txnProgressStateDone {
- border-color: rgb(50,205,50);
- background-image: url(../images/green_check.png);
- background-repeat: no-repeat;
- background-position: 95% center;
- /*background-size: contain;*/
- background-size: 24px 24px;
-}
-
-.txnProgressStateInProgress {
- /*border-color: #FFDF00;*/
- border-color: #FA6A0C;
- /*text-decoration: blink;*/
- /*color: #FFDF00;*/
- background-image: url(../images/orange-loader.gif);
- background-repeat: no-repeat;
- background-position: 95% center;
- /*background-size: contain;*/
- background-size: 24px 24px;
-}
-
-.txnProgressStateError {
- border-color: #F53907;
- background-image: url(../images/red_cross.png);
- background-repeat: no-repeat;
- background-position: 95% center;
- /*background-size: contain;*/
- background-size: 24px 24px;
-}
-
-.txnProgressStatePending {
- border-color: gray;
- color: gray;
-}
-
.txnNoOpMsg {
padding: 4px;
font-weight: bolder;
@@ -159,17 +97,19 @@ span.installationWizardStageNumber {
#txnProgressStatusDivId {
width: auto;
+ max-width:500px;
/-*height: 2em;*-/
border-style: solid;
border-width: 2px;
border-radius:2px;
-moz-border-radius:2px;
-webkit-border-radius:2px;
- padding-top: 4px;
- padding-bottom: 4px;
- font-size: larger;
- text-align: center;
+ padding-top: 6px;
+ padding-bottom: 6px;
+ font-size: 13px;
+ /*text-align: center;*/
margin-bottom:0;
+ text-align:right;
}
.formStatusBar {
@@ -179,7 +119,7 @@ span.installationWizardStageNumber {
color: #C09853;
font-size:14px;
margin-bottom: 18px;
- padding: 8px 35px 8px 14px;
+ padding: 8px 20px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
@@ -191,14 +131,12 @@ span.installationWizardStageNumber {
}
#txnProgressCoreDivId {
- width:50%;
- top:30%;
- left:0;
- margin-left:25%;
-
/* Float above all else*/
z-index:15;
position:absolute;
+ top:180px;
+ left:50%;
+ margin-left:-270px;
/* Leave some space at the bootom for long progress-lists */
padding-bottom:100px;
@@ -206,7 +144,8 @@ span.installationWizardStageNumber {
#txnProgressStatusDivId p {
font-size:14px;
- margin-top:10px;
+ margin:0;
+ /*margin-top:10px;*/
}
#txnProgressFieldSetId {
@@ -232,22 +171,22 @@ span.installationWizardStageNumber {
*/
#informationalPanelContainerDivId .yui3-widget-bd {
max-height:400px;
- min-height:100px;
+ min-height:80px;
padding:15px;
overflow-x:hidden;
overflow-y:auto;
}
#informationalPanelContainerDivId .yui3-widget-hd {
- background: #f0f0f0;
- border-bottom: 1px solid #DDDDDD;
- box-shadow: 0 1px 0 #FFFFFF inset;
- border-radius:6px 6px 0 0;
- padding: 9px 15px;
- font-size: 18px;
- line-height: 27px;
- color:#333333;
- font-weight:bold;
+ background: #f0f0f0;
+ border-bottom: 1px solid #DDDDDD;
+ box-shadow: 0 1px 0 #FFFFFF inset;
+ border-radius:6px 6px 0 0;
+ padding: 9px 15px;
+ font-size: 18px;
+ line-height: 27px;
+ color:#333333;
+ font-weight:bold;
}
#informationalPanelContainerDivId .yui3-widget-ft {
@@ -385,7 +324,7 @@ span.installationWizardStageNumber {
#configureClusterInputContainerDivId {
float:left;
width:400px;
- margin:20px 0 0 40px;
+ margin:20px 0 0 80px;
}
#configureClusterDisplayDivId {
Modified: incubator/ambari/branches/ambari-186/hmc/html/bootstrapJs.htmli
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/bootstrapJs.htmli?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/bootstrapJs.htmli (original)
+++ incubator/ambari/branches/ambari-186/hmc/html/bootstrapJs.htmli Thu Jun 7 01:15:25 2012
@@ -28,7 +28,7 @@
"node", "io", "dump", "json", "panel", "event", "arraysort",
"array-extras", "datasource", "datasource-io", "datasource-jsonschema",
"datasource-polling", "stylesheet", "dd-drop", "dd-constrain",
- "dd-proxy", "transition", "node-event-simulate", function (Y) {
+ "dd-proxy", "transition", "overlay", "node-event-simulate", function (Y) {
/* Kick off the sequential loading. */
loadNextJsFile();
Modified: incubator/ambari/branches/ambari-186/hmc/html/initializeCluster.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/initializeCluster.php?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/initializeCluster.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/html/initializeCluster.php Thu Jun 7 01:15:25 2012
@@ -153,7 +153,7 @@
<h2><?php echo $RES['initWizard.selectServices.pageSummary.header'] ?></h2>
<p><?php echo $RES['initWizard.selectServices.pageSummary.body'] ?></p>
</div>
- <div style="width:100%;height:40px">
+ <div style="width:400px;height:40px;float:right;">
<div id="formStatusDivId" class="formStatusBar" style="display:none">
</div>
</div>
@@ -178,7 +178,7 @@
</div>
</div>
</fieldset>
- <a href="javascript:void 0" class="btn btn-large" style="margin:20px 0 0 60px" id="selectServicesSubmitButtonId" class="submitButton"><?php echo $RES['initWizard.selectServices.submit.label'] ?></a>
+ <a href="javascript:void 0" class="btn btn-large" style="margin:10px 0 0 60px" id="selectServicesSubmitButtonId" class="submitButton"><?php echo $RES['initWizard.selectServices.submit.label'] ?></a>
</div>
<!-- End of selectServicesCoreDivId -->
@@ -310,7 +310,7 @@
var jsFilesToLoad = [
'../js/ext/jquery.min.js',
- '../js/ext/bootstrap.min.js',
+ '../js/ext/bootstrap.min.js',
'../js/utils.js',
'../js/txnUtils.js',
'../js/installationWizard.js',
@@ -323,7 +323,7 @@
'../js/configureServicesUtils.js',
'../js/configureServices.js',
'../js/reviewAndDeploy.js',
- '../js/deployProgress.js'
+ '../js/deployProgress.js'
];
</script>
Modified: incubator/ambari/branches/ambari-186/hmc/html/txnUtils.htmli
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/html/txnUtils.htmli?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/html/txnUtils.htmli (original)
+++ incubator/ambari/branches/ambari-186/hmc/html/txnUtils.htmli Thu Jun 7 01:15:25 2012
@@ -1,13 +1,12 @@
<div id="txnProgressCoreDivId" style="display:none">
-
- <!-- Used to render informational/status messages (error, success reports and such like) -->
- <div id="txnProgressStatusDivId" class="formStatusBar" style="display:none">
- <div id="txnProgressStatusMessageDivId"></div>
- <div id="txnProgressStatusActionsDivId"></div>
+ <div id="txnProgressBox">
+ <div id="txnProgressHeader"></div>
+ <div id="txnProgressContentDivId"></div>
+ <!-- Used to render informational/status messages (error, success reports and such like) -->
+ <div id="txnProgressStatusDivId" class="formStatusBar" style="display:none">
+ <div id="txnProgressStatusMessageDivId"></div>
+ <div id="txnProgressStatusActionsDivId"></div>
+ </div>
</div>
-
- <fieldset id="txnProgressFieldSetId">
- <div id="txnProgressDynamicRenderDivId"></div>
- </fieldset>
</div>
<!-- End of txnProgressCoreDivId -->
Modified: incubator/ambari/branches/ambari-186/hmc/js/addNodesProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/addNodesProgress.js?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/addNodesProgress.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/addNodesProgress.js Thu Jun 7 01:15:25 2012
@@ -1,120 +1,60 @@
-/*
-function cleanupInstall ()
-{
- alert("We will cleanup the cluster now!");
- var cleanupRequestData = {
- "ClusterDeployUser" : globalYui.Lang.trim(globalYui.one("#clusterDeployUserId").get('value'))
- }
- var url = "../php/frontend/nodesAction.php?clusterName=" + InstallationWizard.AddNodes.renderData.clusterName + "&action=uninstall";
- globalYui.io(url, {
- method: 'POST',
- data: cleanupRequestData,
- timeout : 10000,
- on: {
- success: function (x,o) {
- globalYui.log("RAW JSON DATA: " + o.responseText);
- // Process the JSON data returned from the server
- try {
- setupNodesJson = globalYui.JSON.parse(o.responseText);
- } catch (e) {
- alert("JSON Parse failed!");
- return;
- }
-
- globalYui.log("PARSED DATA: " + globalYui.Lang.dump(setupNodesJson));
- if (setupNodesJson.result != 0) {
- // Error!
- alert("Got error!" + setupNodesJson.error);
- return;
- }
-
- setupNodesJson = setupNodesJson.response;
- hideLoadingImg();
-
- globalYui.one("#blackScreenDivId").setStyle("display", "block");
- renderProgress( setupNodesJson, "uninstall" );
-
- },
-
- failure: function (x,o) {
- alert("Async call failed!");
- }
- }
- });
+function cleanUpTxnProgress () {
+ globalYui.one('#installationWizardProgressBarDivId').setStyle('display', 'block');
+ globalYui.one('#txnProgressStatusMessageDivId').setContent('');
+ globalYui.one('#blackScreenDivId').setStyle('display', 'none');
+ globalYui.one('#txnProgressStatusDivId').setStyle('display', 'none');
+ globalYui.one('#addNodesCoreDivId').setStyle('display', 'none');
+ globalYui.one('#txnProgressCoreDivId').setStyle('display', 'none');
+ //globalYui.one('#txnProgressContentDivId').setContent
+ // ( '<img id=txnProgressLoadingImgId class=loadingImg src=../images/loading.gif />' );
}
-*/
-
-function getProgressStateCssClass (opStatus)
-{
-
- var cssMarkup;
- var error;
- switch (opStatus) {
+function generateSingleDiscoverProgressStateMarkup(discoverProgressStateTitle, progressState) {
+ var stateClass;
+ var barClass;
+
+ switch (progressState) {
case "SUCCESS":
- cssMarkup = 'txnProgressStateDone';
- error = false;
+ stateClass = 'txnProgressStateDone';
+ barClass = 'progress progress-success';
break;
+ case "STARTING":
case "STARTED":
- cssMarkup = 'txnProgressStateInProgress';
- error = false
+ case "IN_PROGRESS":
+ stateClass = 'txnProgressStateInProgress';
+ //barClass = 'progress progress-striped active';
+ barClass = 'progress';
break;
case "FAILED":
- cssMarkup = 'txnProgressStateError';
- error = true;
- break;
-
case "TOTALFAILURE":
- cssMarkup = 'txnProgressStateError';
- error = true;
+ stateClass = 'txnProgressStateError';
+ barClass = 'progress progress-danger';
break;
- default:
- cssMarkup = 'txnProgressStatePending';
- error = false;
+ default: // PENDING
+ stateClass = 'txnProgressStatePending';
+ barClass = 'progress';
break;
}
-
- var cssMarkupAndError = {
- 'cssMarkup' : cssMarkup,
- 'error' : error
- };
-
- return cssMarkupAndError;
-}
-
-function cleanUpTxnProgress ()
-{
- globalYui.one('#installationWizardProgressBarDivId').setStyle('display', 'block');
- globalYui.one('#txnProgressStatusMessageDivId').setContent('');
- globalYui.one('#blackScreenDivId').setStyle('display', 'none');
- globalYui.one('#txnProgressStatusDivId').setStyle('display', 'none');
- globalYui.one('#addNodesCoreDivId').setStyle('display', 'none');
- globalYui.one('#txnProgressFieldSetId').setStyle("display", "block");
- //globalYui.one('#txnProgressDynamicRenderDivId').setContent
- // ( '<img id=txnProgressLoadingImgId class=loadingImg src=../images/loading.gif />' );
-}
-
-function generateSingleDiscoverProgressStateMarkup( discoverProgressStateTitle, discoverProgressStateCssClass ) {
-
- globalYui.log( 'Generating: ' + discoverProgressStateTitle + '-' + discoverProgressStateCssClass );
-
- var markup =
- '<li>' +
- '<div class=' + discoverProgressStateCssClass + '>' +
- discoverProgressStateTitle +
- '</div>' +
- '</li>';
-
- globalYui.log("XXX" + markup);
+
+ var barMarkup = '<div class="' + barClass + '"><div class="bar"></div></div>';
+ if (stateClass == 'txnProgressStateInProgress') {
+ barMarkup = '<div id="activeProgressBarContainer">' + barMarkup + '</div>';
+ }
+
+ var markup = '<li><label class="' + stateClass + '">' + discoverProgressStateTitle + '</label>' + barMarkup + '</li>';
+ //globalYui.log('progress state=' + progressState + ', markup=' + markup);
return markup;
}
function renderProgress (discoverProgressInfo) {
+ var txnProgressShown = false;
+ var pollingStopped = false;
+
var discoverProgressDataSource = new globalYui.DataSource.IO ({
source: '../php/frontend/nodesActionProgress.php'
});
@@ -129,201 +69,245 @@ function renderProgress (discoverProgres
}
}
});
-
- var discoverProgressPollHandle = discoverProgressDataSource.setInterval( 3000, {
- request: '?clusterName=' + discoverProgressInfo.clusterName + '&txnId=' + discoverProgressInfo.txnId + '&action=addNodes',
- callback: {
- success: function (e) {
-
- var stateInfo = e.response.meta.stateInfo;
- var discoverProgressStates = e.response.meta.progressStates;
- var stateInfoLength = 0;
- var count = 0;
- var lastTxnId = 0;
- var discoverProgressMarkup = '<ul id=txnProgressStatesListId>';
-
- var overallFail = false;
- var numSubTxns = 0;
- for (txnId in stateInfo.subTxns) {
- numSubTxns++;
- }
- if (numSubTxns == 0) {
- var errorInfoPanelBodyContent =
- '<img id=errorInfoPanelLoadingImgId class=loadingImg src=../images/loading.gif />';
-
- // globalYui.log('About to generate markup: ' + discoverProgressMarkup);
- globalYui.one('#txnProgressDynamicRenderDivId').setContent( errorInfoPanelBodyContent );
- globalYui.one("#txnProgressCoreDivId").setStyle("display", "block");
- return;
- }
-
- for (txnId in stateInfo.subTxns) {
- var currentProgressStateCssClass = getProgressStateCssClass(stateInfo.subTxns[txnId].opStatus);
- var cssMarkup = currentProgressStateCssClass.cssMarkup ;
- // If all states are in pending or just the first one, let's mark the first one as in progress
- if (numSubTxns == 1 && cssMarkup != 'txnProgressStateError') {
- cssMarkup = 'txnProgressStateInProgress';
+
+ function clearActiveProgressBar() {
+ var bar = globalYui.one('#activeProgressBar');
+ if (bar != null) {
+ bar.remove();
+ }
+ globalYui.on('windowresize', function(e) {
+ setActiveProgressBarInPlace();
+ });
+ }
+
+ function setActiveProgressBarInPlace() {
+ // Puts an active progress bar where the placeholder with the DIV ID of "activeProgressBarSpot" is located.
+ // Creates an instance of the active progress bar if one does not already exist
+ // so that we can keep reusing it and moving it in place, rather than dynamically rendering it
+ // on every successful callback to avoid flickering/disconnect due to animation.
+
+ var bar = globalYui.one('#activeProgressBar');
+ var barContainer = globalYui.one('#activeProgressBarContainer');
+
+ if (barContainer != null) {
+ if (bar == null) {
+ globalYui.one("body").append('<div id="activeProgressBar" class="wrapped progress progress-striped active" style="position:absolute;top:-50px;left:0;z-index:99;"><div style="width:100%" class="bar"></div></div>');
+ bar = globalYui.one('#activeProgressBar');
+ }
+ bar.setStyle('display', 'block');
+ if (bar.getX() != barContainer.getX() || bar.getY() != barContainer.getY()) {
+ bar.setXY(barContainer.getXY());
+ }
+ } else if (bar != null) {
+ bar.setStyle('display', 'none');
+ }
+ }
+
+ function runPollTask() {
+ discoverProgressDataSource.sendRequest({
+ request: '?clusterName=' + discoverProgressInfo.clusterName + '&txnId=' + discoverProgressInfo.txnId + '&action=addNodes',
+ callback: {
+ success: function (e) {
+
+ if (pollingStopped) {
+ return;
+ }
+
+ globalYui.one("#txnProgressHeader").setContent('Node Discovery and Preparation');
+
+ var stateInfo = e.response.meta.stateInfo;
+ var discoverProgressStates = e.response.meta.progressStates;
+ var stateInfoLength = 0;
+ var count = 0;
+ var lastTxnId = 0;
+ var discoverProgressMarkup = '<ul id="steps" class="wrapped">';
+
+ var overallFail = false;
+ var numSubTxns = 0;
+ for (txnId in stateInfo.subTxns) {
+ numSubTxns++;
}
- discoverProgressMarkup +=
- generateSingleDiscoverProgressStateMarkup(
- stateInfo.subTxns[txnId].description + " " + stateInfo.subTxns[txnId].progress,
-// discoverProgressStates[stateInfoLength],
- cssMarkup);
- stateInfoLength++;
- count++;
- lastTxnId = txnId;
- overallFail |= currentProgressStateCssClass.error;
- }
-
- // Render the remaining stages as pending
- if (stateInfoLength < discoverProgressStates.length) {
- for (; count < discoverProgressStates.length; count++ ) {
- var cssClass = 'txnProgressStatePending';
+ if (numSubTxns == 0) {
+ var errorInfoPanelBodyContent =
+ '<img id="errorInfoPanelLoadingImgId" class="loadingImg" src="../images/loading.gif" />';
+
+ globalYui.one('#txnProgressContentDivId').setContent( errorInfoPanelBodyContent );
+ globalYui.one("#txnProgressCoreDivId").setStyle("display", "block");
+ poll();
+ return;
+ }
+
+ for (var txnId in stateInfo.subTxns) {
+ var currentProgressState = stateInfo.subTxns[txnId].opStatus;
+ // If all states are in pending or just the first one, let's mark the first one as in progress
+ if (numSubTxns == 1 && currentProgressState != 'FAILED' && currentProgressState != 'TOTALFAILURE') {
+ currentProgressState = "IN_PROGRESS";
+ }
+
discoverProgressMarkup +=
generateSingleDiscoverProgressStateMarkup(
- discoverProgressStates[count],
- cssClass);
+ stateInfo.subTxns[txnId].description + stateInfo.subTxns[txnId].progress,
+ currentProgressState);
+ stateInfoLength++;
+ count++;
+ lastTxnId = txnId;
+ overallFail |= (currentProgressState == 'FAILED' || currentProgressState == 'TOTALFAILURE');
}
- }
-
- var noNeedForFurtherPolling = false;
- var totalFailure = false;
- var installationStatusDivContent = '';
- var installationStatusDivCssClass = '';
-
- if (stateInfo.subTxns[lastTxnId].opStatus == "TOTALFAILURE") {
- noNeedForFurtherPolling = true;
- totalFailure = true;
- } else if (stateInfoLength == discoverProgressStates.length) {
- if ((stateInfo.subTxns[lastTxnId].opStatus == "SUCCESS")
- || (stateInfo.subTxns[lastTxnId].opStatus == "FAILED")) {
- noNeedForFurtherPolling = true;
- } else {
- noNeedForFurtherPolling = false;
- }
- }
-
- if (overallFail == true) {
- installationStatusDivContent =
- '<p>' +
- 'An error was encountered with some of the nodes. ' +
- '<a href="javascript:void(null)" id=errorInfoLinkId>' +
- 'Take a look at the logs to see what happened.' +
- '</a>'
- '</p>';
- installationStatusDivCssClass = 'statusError';
- var linkInfo = '<a href="javascript:void(null)"' +
- 'id="errorBackNavLinkId">Back to Add Nodes</a>';
- if (totalFailure == false) {
- linkInfo += ' <a href=' +
- '"javascript:void(null)" id="errorFwdNavLinkId" style="margin-left:20px">Ignore and Continue</a>';
+
+ // Render the remaining stages as pending
+ if (stateInfoLength < discoverProgressStates.length) {
+ for (; count < discoverProgressStates.length; count++ ) {
+ discoverProgressMarkup +=
+ generateSingleDiscoverProgressStateMarkup(
+ discoverProgressStates[count],
+ 'PENDING');
+ }
}
- globalYui.one("#txnProgressStatusActionsDivId").setContent(linkInfo);
-
- // now can add the on-click feature for the links
- globalYui.one("#errorBackNavLinkId").on( "click", function(e) {
- cleanUpTxnProgress();
- errorInfoPanel.destroy();
- // give cleanup option
- // cleanupInstall();
- globalYui.one("#txnProgressStatusActionsDivId").setContent("");
- globalYui.one('#txnProgressCoreDivId').setStyle('display', 'none');
- globalYui.one("#addNodesCoreDivId").setStyle('display', 'block');
- });
-
- if (totalFailure == false) {
- globalYui.one("#errorFwdNavLinkId").on( "click", function(e) {
- cleanUpTxnProgress();
- errorInfoPanel.destroy();
- //REZYYY globalYui.one("#progressErrorInfoNavigateDivId").setContent("");
- globalYui.one("#txnProgressStatusActionsDivId").setContent("");
- transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo,
- "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
- });
+ var noNeedForFurtherPolling = false;
+ var totalFailure = false;
+ var installationStatusDivContent = '';
+
+ if (stateInfo.subTxns[lastTxnId].opStatus == "TOTALFAILURE") {
+ noNeedForFurtherPolling = true;
+ totalFailure = true;
+ } else if (stateInfoLength == discoverProgressStates.length) {
+ if ((stateInfo.subTxns[lastTxnId].opStatus == "SUCCESS")
+ || (stateInfo.subTxns[lastTxnId].opStatus == "FAILED")) {
+ noNeedForFurtherPolling = true;
+ } else {
+ noNeedForFurtherPolling = false;
+ }
}
-
- } else {
- installationStatusDivContent =
- '<p>' +
- 'Finished node discovery and preparation. ' +
- '<a href="javascript:void(null)" id=successInfoLinkId>' +
- 'Proceed to Select Services' +
- '</a>' +
- '</p>';
- installationStatusDivCssClass = 'statusOk';
- }
-
- if( noNeedForFurtherPolling ) {
-
- /* We've made all the progress we could have, so stop polling. */
- discoverProgressDataSource.clearInterval( discoverProgressPollHandle );
-
- globalYui.one('#txnProgressStatusDivId').setStyle('display', 'block');
- globalYui.one('#txnProgressStatusDivId').addClass(installationStatusDivCssClass);
- var installationStatusDiv = globalYui.one('#txnProgressStatusMessageDivId');
-
- installationStatusDiv.setContent(installationStatusDivContent);
-
- /* If we stopped polling due to error, we need to do more work. */
- if( installationStatusDivCssClass == 'statusError' ) {
-
- /* Create the panel that'll display our error info. */
- var errorInfoPanel =
- createInformationalPanel( '#informationalPanelContainerDivId',
- 'Node Discovery and Preparation Logs' );
-
- globalYui.one("#errorInfoLinkId").on( "click", function(err) {
- var bodyContent = "";
- for (subTxn in e.response.meta.stateInfo.subTxns) {
- var subTxnInfo = e.response.meta.stateInfo.subTxns[subTxn];
- var additionalInfoTable = '<table>' +
- '<thead><tr><th>Host</th><th>Info</th></tr></thead>';
- for (hostName in subTxnInfo.state) {
- additionalInfoTable += '<tr><td>' + hostName + '</td><td><pre>' +subTxnInfo.state[hostName] + '</pre></td></tr>'
- }
- additionalInfoTable += '</table>';
- bodyContent += '<div class="logEntry">' +
- '<div class="logEntryHeader">' + subTxnInfo.description + '</div>' +
- '<div class="logEntryBody">' +
- '<ul>' +
- '<li>Entry Id : ' + subTxnInfo.subTxnId + '</li>' +
- '<li>Final result : ' + subTxnInfo.opStatus + '</li>' +
- '<li>Progress at the end : ' + subTxnInfo.progress + '</li>' +
- '<li>Additional information : ' + additionalInfoTable + '</li>' +
- '</ul>' +
- '</div>' +
- '</div>';
+
+ if( noNeedForFurtherPolling ) {
+
+ /* We've made all the progress we could have, so stop polling. */
+ pollingStopped = true;
+
+ if (!overallFail) {
+ statusContent =
+ '<p>' +
+ 'Finished node discovery and preparation. ' +
+ '<a class="btn btn-large" href="javascript:void(null)" id="successInfoLinkId">' +
+ 'Proceed to Select Services' +
+ '</a>' +
+ '</p>';
+ globalYui.one('#txnProgressStatusDivId').removeClass('statusError');
+ globalYui.one('#txnProgressStatusDivId').addClass('statusOk');
+ globalYui.one('#txnProgressStatusMessageDivId').setContent(statusContent);
+ globalYui.one("#successInfoLinkId").on( "click", function(e) {
+ cleanUpTxnProgress();
+ transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo,
+ "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
+ });
+ } else {
+ statusContent =
+ '<p>' +
+ 'An error was encountered with some of the nodes.<br>' +
+ 'Take a look at the <a href="javascript:void(null)" id=errorInfoLinkId>' +
+ 'error logs</a> to see what might have happened.<br>';
+
+ statusContent += '<a class="btn btn-large" style="margin:10px 0" href="javascript:void(null)"' +
+ 'id="errorBackNavLinkId">Back to Add Nodes</a>';
+ if (totalFailure == false) {
+ statusContent += ' <a class="btn btn-large" href=' +
+ '"javascript:void(null)" id="errorFwdNavLinkId" style="margin:10px 0 10px 20px">Ignore and Continue</a>';
}
- // Set centered explicitly
- errorInfoPanel.set('centered', true);
- errorInfoPanel.set('bodyContent' , bodyContent);
- //errorInfoPanel.set( 'bodyContent', '<pre>' +
- // globalYui.JSON.stringify( e.response.meta.stateInfo, null, 4) + '</pre>' );
- errorInfoPanel.show();
- //REZYYY globalYui.one("#progressErrorInfoNavigateDivId").setStyle( 'display', 'block' );
- });
- } else {
- globalYui.one("#successInfoLinkId").on( "click", function(e) {
- cleanUpTxnProgress();
- transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo,
- "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
- });
- }
+ statusContent += '</p>';
+ globalYui.one('#txnProgressStatusDivId').removeClass('statusOk');
+ globalYui.one('#txnProgressStatusDivId').addClass('statusError');
+ globalYui.one('#txnProgressStatusMessageDivId').setContent(statusContent);
+ // now can add the on-click feature for the links
+ globalYui.one("#errorBackNavLinkId").on( "click", function(e) {
+ cleanUpTxnProgress();
+ errorInfoPanel.destroy();
+ // give cleanup option
+ // cleanupInstall();
+ globalYui.one("#txnProgressStatusActionsDivId").setContent("");
+ globalYui.one('#txnProgressCoreDivId').setStyle('display', 'none');
+ globalYui.one("#addNodesCoreDivId").setStyle('display', 'block');
+ });
+
+ if (totalFailure == false) {
+ globalYui.one("#errorFwdNavLinkId").on( "click", function(e) {
+ cleanUpTxnProgress();
+ errorInfoPanel.destroy();
+ //REZYYY globalYui.one("#progressErrorInfoNavigateDivId").setContent("");
+ globalYui.one("#txnProgressStatusActionsDivId").setContent("");
+ transitionToNextStage( "#txnProgressCoreDivId", discoverProgressInfo,
+ "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
+ });
+ }
+ /* If we stopped polling due to error, we need to do more work. */
+
+ /* Create the panel that'll display our error info. */
+ var errorInfoPanel =
+ createInformationalPanel( '#informationalPanelContainerDivId',
+ 'Node Discovery and Preparation Logs' );
+
+ globalYui.one("#errorInfoLinkId").on( "click", function(err) {
+ var bodyContent = "";
+ for (subTxn in e.response.meta.stateInfo.subTxns) {
+ var subTxnInfo = e.response.meta.stateInfo.subTxns[subTxn];
+ var additionalInfoTable = '<table>' +
+ '<thead><tr><th>Host</th><th>Info</th></tr></thead>';
+ for (hostName in subTxnInfo.state) {
+ additionalInfoTable += '<tr><td>' + hostName + '</td><td><pre>' +subTxnInfo.state[hostName] + '</pre></td></tr>'
+ }
+ additionalInfoTable += '</table>';
+ bodyContent += '<div class="logEntry">' +
+ '<div class="logEntryHeader">' + subTxnInfo.description + '</div>' +
+ '<div class="logEntryBody">' +
+ '<ul>' +
+ '<li>Entry Id : ' + subTxnInfo.subTxnId + '</li>' +
+ '<li>Final result : ' + subTxnInfo.opStatus + '</li>' +
+ '<li>Progress at the end : ' + subTxnInfo.progress + '</li>' +
+ '<li>Additional information : ' + additionalInfoTable + '</li>' +
+ '</ul>' +
+ '</div>' +
+ '</div>';
+ }
+ errorInfoPanel.set('bodyContent' , bodyContent);
+ //errorInfoPanel.set( 'bodyContent', '<pre>' +
+ // globalYui.JSON.stringify( e.response.meta.stateInfo, null, 4) + '</pre>' );
+ errorInfoPanel.show();
+ //REZYYY globalYui.one("#progressErrorInfoNavigateDivId").setStyle( 'display', 'block' );
+ });
+ } // end if error
+
+ globalYui.one('#txnProgressStatusDivId').setStyle('display', 'block');
+
+ } // end no need for further polling
+
+ discoverProgressMarkup += '</ul>';
+ globalYui.log('About to generate markup: ' + discoverProgressMarkup);
+ globalYui.one('#txnProgressContentDivId').setContent(discoverProgressMarkup);
+
+ if (!txnProgressShown) {
+ globalYui.one('#txnProgressCoreDivId').setStyle('display','block');
+ txnProgressShown = true;
+ }
+ setActiveProgressBarInPlace();
+ if (!pollingStopped) {
+ poll();
+ }
+ },
+ failure: function (e) {
+ alert('Failed to fetch more progress!');
+ /* No point making any more attempts. */
+ pollingStopped = true;
}
+ }
+ });
+ }
- discoverProgressMarkup += '</ul>';
+ function poll() {
+ window.setTimeout(runPollTask, 3000);
+ }
+
+ clearActiveProgressBar();
-// globalYui.log('About to generate markup: ' + discoverProgressMarkup);
- globalYui.one('#txnProgressDynamicRenderDivId').setContent( discoverProgressMarkup );
- globalYui.one("#txnProgressCoreDivId").setStyle("display", "block");
- },
- failure: function (e) {
- alert('Failed to fetch more progress!');
- /* No point making any more attempts. */
- discoverProgressDataSource.clearInterval( discoverProgressPollHandle );
- }
- }
- });
+ runPollTask();
}
Modified: incubator/ambari/branches/ambari-186/hmc/js/clustersList.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/clustersList.js?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/clustersList.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/clustersList.js Thu Jun 7 01:15:25 2012
@@ -214,9 +214,6 @@ function renderClusterList() {
/* Done with this stage, hide it. */
globalYui.one("#clustersListDivId").setStyle('display','none');
- /* Render the next stage. */
- getServicesStatus(globalYui, clusterId);
-
/* Show off our rendering. */
globalYui.one("#displayServiceStatusCoreDivId").setStyle('display','block');
});
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=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/deployProgress.js Thu Jun 7 01:15:25 2012
@@ -101,9 +101,12 @@ function renderDeployProgress (deployPro
'</p>',
failure:
'<p>' +
- 'Failed to finish setting up the cluster. ' +
- '<a href="javascript:void(null)" id="showDeployTxnLogsLinkId">Take a look at the deploy logs</a>' +
+ 'Failed to finish setting up the cluster.<br>Take a look at the ' +
+ '<a href="javascript:void(null)" id="showDeployTxnLogsLinkId">deploy logs</a>' +
' to find out what might have gone wrong.' +
+ '<a href="javascript:void(null)" class="btn btn-large" style="margin-top:10px" id="restartInstallationWizardLinkId">' +
+ 'Reinstall Cluster' +
+ '</a>' +
'</p>'
};
@@ -117,15 +120,9 @@ function renderDeployProgress (deployPro
},
failure: function( txnProgressWidget ) {
- globalYui.one('#txnProgressStatusActionsDivId').setContent(
- '<a href="javascript:void(null)" id=restartInstallationWizardLinkId>' +
- 'Reinstall Cluster' +
- '</a>'
- );
globalYui.one("#restartInstallationWizardLinkId").on( "click", function(e) {
document.location.href = 'installFailed.php';
});
- globalYui.one('#txnProgressStatusActionsDivId').setStyle('display','block');
/* Create the panel that'll display our error info. */
var errorInfoPanel =
@@ -133,7 +130,7 @@ function renderDeployProgress (deployPro
/* Prime the panel to start off showing our stock loading image. */
var errorInfoPanelBodyContent =
- '<img id=errorInfoPanelLoadingImgId class=loadingImg src=../images/loading.gif />';
+ '<img id="errorInfoPanelLoadingImgId" class="loadingImg" src="../images/loading.gif" />';
/* Make the call to our backend to fetch the report for this txnId. */
globalYui.io('../php/frontend/fetchTxnLogs.php?clusterName=' +
@@ -178,7 +175,7 @@ function renderDeployProgress (deployPro
*/
globalYui.one("#showDeployTxnLogsLinkId").on( "click", function(e) {
errorInfoPanel.set('centered', true);
- errorInfoPanel.set( 'bodyContent', errorInfoPanelBodyContent );
+ errorInfoPanel.set('bodyContent', errorInfoPanelBodyContent );
errorInfoPanel.show();
});
@@ -186,7 +183,7 @@ function renderDeployProgress (deployPro
};
var deployProgressWidget = new TxnProgressWidget
- ( deployProgressInfo, deployProgressStatusMessage, deployProgressPostCompletionFixup );
+ ( deployProgressInfo, 'Cluster Deploy', deployProgressStatusMessage, deployProgressPostCompletionFixup );
deployProgressWidget.show();
}
Modified: incubator/ambari/branches/ambari-186/hmc/js/manageServices.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/manageServices.js?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/manageServices.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/manageServices.js Thu Jun 7 01:15:25 2012
@@ -354,16 +354,19 @@ function performServiceManagement( actio
success:
'<p>' +
'Successfully completed the operation. ' +
- '<a href="javascript:void(null)" id=closeManageServicesProgressWidgetLinkId>' +
+ '<a href="javascript:void(null)" style="margin-left:10px;" id="closeManageServicesProgressWidgetLinkId">' +
'Continue' +
'</a>' +
'</p>',
failure:
'<p>' +
- 'Failed to complete the operation. Please ' +
- '<a href="javascript:void(null)" id=showManageServicesTxnLogsLinkId>take a look at Operation Logs</a>' +
+ 'Failed to complete the operation.<br>Take a look at ' +
+ '<a href="javascript:void(null)" id=showManageServicesTxnLogsLinkId>Operation Logs</a>' +
' to see what might have gone wrong.' +
+ '<a href="javascript:void(null)" class="btn btn-large" style="margin:5px 0" id="closeManageServicesProgressWidgetLinkId">' +
+ 'Continue' +
+ '</a>' +
'</p>'
};
@@ -381,7 +384,6 @@ function performServiceManagement( actio
* click-handler must also be re-registered each time 'round.
*/
globalYui.one("#closeManageServicesProgressWidgetLinkId").on( "click", function(e) {
-
txnProgressWidget.hide();
});
@@ -390,7 +392,12 @@ function performServiceManagement( actio
},
failure: function( txnProgressWidget ) {
+
+ globalYui.one("#closeManageServicesProgressWidgetLinkId").on( "click", function(e) {
+ txnProgressWidget.hide();
+ });
+
/* <-------------------- REZXXX BEGIN -----------------------> */
/* Create the panel that'll display our error info. */
@@ -452,20 +459,6 @@ function performServiceManagement( actio
errorInfoPanel.set( 'bodyContent', errorInfoPanelBodyContent );
errorInfoPanel.show();
- if( firstTimeShowingErrorInfoPanel ) {
-
- globalYui.one('#txnProgressStatusActionsDivId').setContent(
- '<a href="javascript:void(null)" id=closeManageServicesProgressWidgetLinkId>' +
- 'Close' +
- '</a>' );
-
- globalYui.one("#closeManageServicesProgressWidgetLinkId").on( "click", function(e) {
-
- txnProgressWidget.hide();
- });
-
- firstTimeShowingErrorInfoPanel = false;
- }
});
/* <--------------------- REZXXX END ------------------------> */
@@ -477,7 +470,7 @@ function performServiceManagement( actio
};
var manageServicesProgressWidget = new TxnProgressWidget
- ( manageServicesResponseJson, manageServicesProgressStatusMessage, manageServicesProgressPostCompletionFixup );
+ ( manageServicesResponseJson, 'Performing Service Operation', manageServicesProgressStatusMessage, manageServicesProgressPostCompletionFixup );
/* And now that confirmationDataPanel is hidden, show manageServicesProgressWidget. */
manageServicesProgressWidget.show();
Modified: incubator/ambari/branches/ambari-186/hmc/js/txnUtils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/txnUtils.js?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/txnUtils.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/txnUtils.js Thu Jun 7 01:15:25 2012
@@ -1,5 +1,6 @@
-function TxnProgressWidget( txnProgressContext, txnProgressStatusMessage, txnProgressPostCompletionFixup ) {
+function TxnProgressWidget( txnProgressContext, txnProgressTitle, txnProgressStatusMessage, txnProgressPostCompletionFixup ) {
+
/**************************** Private methods ********************************/
var txnProgressStateShouldBeSkipped = function( txnProgressState ) {
@@ -18,17 +19,46 @@ function TxnProgressWidget( txnProgressC
return skipIt;
}
- var generateSingleTxnProgressStateMarkup = function( txnProgressStateTitle, txnProgressStateCssClass ) {
+ var generateSingleTxnProgressStateMarkup = function( txnProgressStateTitle, txnProgressState ) {
- globalYui.log( 'Generating: ' + txnProgressStateTitle + '-' + txnProgressStateCssClass );
+ var stateClass;
+ var barClass;
+ var status;
+
+ switch (txnProgressState) {
+ case 'COMPLETED':
+ stateClass = 'txnProgressStateDone';
+ barClass = 'progress progress-success';
+ status = 'Completed';
+ break;
+
+ case 'IN_PROGRESS':
+ stateClass = 'txnProgressStateInProgress';
+ //barClass = 'progress progress-striped active';
+ barClass = 'progress';
+ status = 'In Progress';
+ break;
+
+ case 'FAILED':
+ stateClass = 'txnProgressStateError';
+ barClass = 'progress progress-danger';
+ status = 'Failed';
+ break;
+
+ default:
+ stateClass = 'txnProgressStatePending';
+ barClass = 'progress';
+ status = 'Pending';
+ break;
+ }
- var markup =
- '<li>' +
- '<div class=' + txnProgressStateCssClass + '>' +
- /* TODO XXX Format this nicer by camel-casing and putting the status in parentheses. */
- txnProgressStateTitle +
- '</div>' +
- '</li>';
+ var barMarkup = '<div class="' + barClass + '"><div class="bar"></div></div>';
+
+ if (stateClass == 'txnProgressStateInProgress') {
+ barMarkup = '<div id="activeProgressBarContainer">' + barMarkup + '</div>';
+ }
+
+ var markup = '<li class="clearfix"><label class="' + stateClass + '">' + txnProgressStateTitle + '</label>' + barMarkup + '<div class="status ' + stateClass + '">' + status + '</div>' + '</li>';
globalYui.log("XXX" + markup);
return markup;
@@ -38,6 +68,7 @@ function TxnProgressWidget( txnProgressC
globalYui.log( 'Got txnId:' + txnProgressContext.txnId );
this.txnProgressContext = txnProgressContext;
+ this.txnProgressTitle = txnProgressTitle;
this.txnProgressStatusMessage = txnProgressStatusMessage;
this.txnProgressPostCompletionFixup = txnProgressPostCompletionFixup;
var requestStr = '?clusterName=' + this.txnProgressContext.clusterName + '&txnId=' + this.txnProgressContext.txnId;
@@ -58,6 +89,39 @@ function TxnProgressWidget( txnProgressC
pollInterval: 3000,
maxFailedAttempts: 5
};
+
+ this.clearActiveProgressBar = function() {
+ var bar = globalYui.one('#activeProgressBar');
+ if (bar != null) {
+ bar.remove();
+ }
+ globalYui.on('windowresize', function(e) {
+ setActiveProgressBarInPlace();
+ });
+ };
+
+ function setActiveProgressBarInPlace() {
+ var bar = globalYui.one('#activeProgressBar');
+ var barContainer = globalYui.one('#activeProgressBarContainer');
+ var marginTop = 3;
+
+ // Puts an active progress bar where the placeholder with the DIV ID of "activeProgressBarSpot" is located.
+ // Creates an instance of the active progress bar if one does not already exist
+ // so that we can keep reusing it and moving it in place, rather than dynamically rendering it
+ // on every successful callback to avoid flickering/disconnect due to animation.
+ if (barContainer != null) {
+ if (bar == null) {
+ globalYui.one("body").append('<div id="activeProgressBar" class="progress progress-striped active" style="position:absolute;top:-50px;left:0;z-index:99;"><div style="width:100%" class="bar"></div></div>');
+ bar = globalYui.one('#activeProgressBar');
+ }
+ bar.setStyle('display', 'block');
+ if (bar.getX() != barContainer.getX() || bar.getY() != barContainer.getY() + marginTop) {
+ bar.setXY([ barContainer.getX(), barContainer.getY() + marginTop ]);
+ }
+ } else if (bar != null) {
+ bar.setStyle('display', 'none');
+ }
+ }
var pdpResponseHandler = {
success: function (e, pdp) {
@@ -90,7 +154,7 @@ function TxnProgressWidget( txnProgressC
var txnProgressStates = txnProgress.subTxns || [];
globalYui.log(globalYui.Lang.dump(txnProgressStates));
- txnProgressMarkup = '<ul id=txnProgressStatesListId>';
+ txnProgressMarkup = '<ul>';
var progressStateIndex = 0;
@@ -112,7 +176,7 @@ function TxnProgressWidget( txnProgressC
globalYui.log( 'Done loop - ' + progressStateIndex );
txnProgressMarkup += generateSingleTxnProgressStateMarkup
- ( presentTxnProgressState.description, 'txnProgressStateDone' );
+ ( presentTxnProgressState.description, 'COMPLETED' );
globalYui.log("Currently, markup is:" + txnProgressMarkup );
}
@@ -148,7 +212,7 @@ function TxnProgressWidget( txnProgressC
* the fitting .txnProgressStateError, else just annoint it with
* .txnProgressStateInProgress
*/
- var currentProgressStateCssClass = 'txnProgressStateInProgress';
+ var currentProgressState = 'IN_PROGRESS';
/* The 2 possible indications of error are:
*
@@ -159,12 +223,12 @@ function TxnProgressWidget( txnProgressC
if( (txnProgress.encounteredError) ||
(presentTxnProgressState.progress == 'FAILED') ) {
- currentProgressStateCssClass = 'txnProgressStateError';
+ currentProgressState = 'FAILED';
}
/* And generate markup for this "in-progress" state. */
txnProgressMarkup += generateSingleTxnProgressStateMarkup
- ( presentTxnProgressState.description, currentProgressStateCssClass );
+ ( presentTxnProgressState.description, currentProgressState );
/* It's important to manually increment progressStateIndex here,
* to set it up correctly for the upcoming loop.
@@ -191,8 +255,10 @@ function TxnProgressWidget( txnProgressC
}
globalYui.log( 'Pending loop - ' + progressStateIndex );
+
txnProgressMarkup += generateSingleTxnProgressStateMarkup
- ( presentTxnProgressState.description, 'txnProgressStatePending' );
+ ( presentTxnProgressState.description, 'PENDING' );
+
}
txnProgressMarkup += '</ul>';
@@ -212,7 +278,7 @@ function TxnProgressWidget( txnProgressC
txnProgressMarkup =
'<br/>' +
'<div class=txnNoOpMsg>' +
- 'Nothing to do for this transaction; enjoy the freebie!' +
+ 'There are no tasks for this transaction.' +
'</div>' +
'<br/>';
}
@@ -254,7 +320,8 @@ function TxnProgressWidget( txnProgressC
* future state of pdp.
*/
globalYui.log('About to generate markup: ' + txnProgressMarkup);
- globalYui.one('#txnProgressDynamicRenderDivId').setContent( txnProgressMarkup );
+ globalYui.one('#txnProgressContentDivId').setContent( txnProgressMarkup );
+ setActiveProgressBarInPlace();
/* And before checking out, decide whether we're done with this txn
* or whether any more polling is required.
@@ -298,13 +365,14 @@ function TxnProgressWidget( txnProgressC
}
TxnProgressWidget.prototype.show = function() {
-
+
/* Start with a clean slate for #txnProgressStatusDivId, regardless of
* the mess previous uses might have left it in.
*/
var txnProgressStatusDiv = globalYui.one('#txnProgressStatusDivId');
txnProgressStatusDiv.one('#txnProgressStatusMessageDivId').setContent('');
txnProgressStatusDiv.one('#txnProgressStatusActionsDivId').setContent('');
+ globalYui.one('#txnProgressHeader').setContent('');
/* Remove the CSS statusOk/statusError classes from txnProgressStatusDiv
* as well - sure would be nice to remove all classes that match a
* pattern, but oh well.
@@ -312,10 +380,15 @@ TxnProgressWidget.prototype.show = funct
txnProgressStatusDiv.removeClass('statusOk');
txnProgressStatusDiv.removeClass('statusError');
- /* Similarly, set a clean slate for #txnProgressDynamicRenderDivId as well. */
- globalYui.one('#txnProgressDynamicRenderDivId').setContent
- ( '<img id=txnProgressLoadingImgId class=loadingImg src=../images/loading.gif />' );
+ /* Similarly, set a clean slate for #txnProgressContentDivId as well. */
+ globalYui.one('#txnProgressContentDivId').setContent
+ ( '<ul class="wrapped"><li><img id=txnProgressLoadingImgId class=loadingImg src=../images/loading.gif /></li></ul>' );
+ // clear active progress bar if one already exists
+ this.clearActiveProgressBar();
+
+ globalYui.one("#txnProgressHeader").setContent(this.txnProgressTitle);
+
globalYui.one('#blackScreenDivId').setStyle('display', 'block');
globalYui.one('#txnProgressCoreDivId').setStyle('display','block');
@@ -325,7 +398,7 @@ TxnProgressWidget.prototype.show = funct
TxnProgressWidget.prototype.hide = function() {
this.periodicDataPoller.stop();
-
+
globalYui.one('#txnProgressStatusDivId').setStyle('display', 'none');
globalYui.one('#txnProgressCoreDivId').setStyle('display','none');
globalYui.one('#blackScreenDivId').setStyle('display', 'none');
Modified: incubator/ambari/branches/ambari-186/hmc/js/uninstallProgress.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/uninstallProgress.js?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/uninstallProgress.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/uninstallProgress.js Thu Jun 7 01:15:25 2012
@@ -68,17 +68,20 @@ function renderUninstallProgress (uninst
var uninstallProgressStatusMessage = {
success:
- '<p style=\"text-align:center\">' +
- 'Uninstalled the cluster successfully.<br/>' +
- '<a href="javascript:void(null)" id=clustersListLinkId>' +
+ '<p>' +
+ 'Uninstalled the cluster successfully.' +
+ '<a href="javascript:void(null)" style="margin-left:20px" class="btn btn-large" id="clustersListLinkId">' +
'Continue' +
'</a>' +
'</p>',
failure:
'<p>' +
- 'There was a problem with uninstall. Take a look at ' +
- '<a href="javascript:void(null)" id=showUninstallTxnLogsLinkId>Uninstall Logs</a>' +
- ' to see what might have happened.' +
+ 'There was a problem with uninstall.<br />Take a look at ' +
+ '<a href="javascript:void(null)" id="showUninstallTxnLogsLinkId">Uninstall Logs</a>' +
+ ' to see what might have happened.<br>' +
+ '<a href="javascript:void(null)" class="btn btn-large" style="margin-top:10px" id="clustersListLinkId">' +
+ 'Close' +
+ '</a>' +
'</p>'
};
@@ -87,12 +90,16 @@ function renderUninstallProgress (uninst
success: function( txnProgressWidget ) {
globalYui.one("#clustersListLinkId").on( "click", function(e) {
- window.open( generateClustersListUrl(txnProgressWidget.txnProgressContext.clusterName) );
+ document.location.href = generateClustersListUrl(txnProgressWidget.txnProgressContext.clusterName);
});
},
failure: function( txnProgressWidget ) {
+ globalYui.one("#clustersListLinkId").on( "click", function(e) {
+ document.location.href = generateClustersListUrl(txnProgressWidget.txnProgressContext.clusterName);
+ });
+
/* Create the panel that'll display our error info. */
var errorInfoPanel =
createInformationalPanel( '#informationalPanelContainerDivId', 'Uninstall Logs' );
@@ -139,35 +146,17 @@ function renderUninstallProgress (uninst
}
});
- var firstTimeShowingErrorInfoPanel = true;
- /* Register a click-handler for #showUninstallTxnLogsLinkId to render
- * the contents inside errorInfoPanel (and make it visible).
- */
globalYui.one("#showUninstallTxnLogsLinkId").on( "click", function(e) {
errorInfoPanel.set( 'centered', true);
errorInfoPanel.set( 'bodyContent', errorInfoPanelBodyContent );
errorInfoPanel.show();
-
- if( firstTimeShowingErrorInfoPanel ) {
-
- globalYui.one('#txnProgressStatusActionsDivId').setContent(
- '<a href="javascript:void(null)" id=clustersListLinkId>' +
- 'Restart the installation wizard' +
- '</a>' );
-
- globalYui.one("#clustersListLinkId").on( "click", function(e) {
- document.location.href = generateClustersListUrl(txnProgressWidget.txnProgressContext.clusterName);
- });
-
- firstTimeShowingErrorInfoPanel = false;
- }
});
}
};
var uninstallProgressWidget = new TxnProgressWidget
- ( uninstallProgressInfo, uninstallProgressStatusMessage, uninstallProgressPostCompletionFixup );
+ ( uninstallProgressInfo, 'Uninstall Cluster', uninstallProgressStatusMessage, uninstallProgressPostCompletionFixup );
uninstallProgressWidget.show();
}
Modified: incubator/ambari/branches/ambari-186/hmc/js/utils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/utils.js?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/utils.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/utils.js Thu Jun 7 01:15:25 2012
@@ -49,6 +49,7 @@ function createInformationalPanel( conta
render: true,
modal: true,
zIndex: 100,
+ centered: true,
visible: false
});
@@ -459,3 +460,4 @@ PeriodicDataPoller.prototype.pollOnce =
function titleCase(word){
return word.substr(0,1).toUpperCase() + word.substr(1).toLowerCase();
}
+
Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/State.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/State.php?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/State.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/State.php Thu Jun 7 01:15:25 2012
@@ -157,6 +157,7 @@ function getTransactionProgressFromState
}
function getActionDescription($name, $action, $state) {
+ /*
$stateInfo = "";
if ($state == "PENDING") {
$stateInfo = "is $state";
@@ -166,6 +167,8 @@ function getActionDescription($name, $ac
$stateInfo = "has $state";
}
$description = $name . " " . strtolower($action) . " " . strtolower($stateInfo);
+ */
+ $description = $name.' '.strtolower($action);
return $description;
}
?>
Modified: incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php Thu Jun 7 01:15:25 2012
@@ -165,7 +165,7 @@ foreach ($stagesInfo as $stage => $stage
// create a new subtransaction for each stage
$mySubTxnId = 100 + $count;
- $state = ""; $description = $stagesInfo[$stage]["description"]; $progress = " ( starting )"; $subTxnType = "";
+ $state = ""; $description = $stagesInfo[$stage]["description"]; $progress = ": starting"; $subTxnType = "";
$subTransactionReturnValue = $dbHandle->insertOrUpdateSubTransaction($clusterName, $orchestratorTxnId, $mySubTxnId, $orchestratorTxnId, $state, $description, $progress, $subTxnType );
if ($subTransactionReturnValue["result"] != 0 ) {
$logger->log_error("Got error while creating subTxn: ".$subTransactionReturnValue["error"]);
Modified: incubator/ambari/branches/ambari-186/hmc/php/util/util.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/util.php?rev=1347253&r1=1347252&r2=1347253&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/util.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/util.php Thu Jun 7 01:15:25 2012
@@ -8,12 +8,12 @@ function generateNodeActionProgress ($nu
// This means all nodes are done.
if ($numTotalNodes == $numNodesSucceeded) {
// Meaning all nodes have succeeded
- $progressString = "( All nodes($numTotalNodes) $finalGoodState )";
+ $progressString = ": All $numTotalNodes nodes $finalGoodState";
} else if ($numNodesSucceeded != 0) {
// Some succeeded, some failed
- $progressString = "( Of $numTotalNodes nodes, $numNodesSucceeded $finalGoodState and $numNodesFailed failed )";
+ $progressString = ": Of $numTotalNodes nodes, $numNodesSucceeded $finalGoodState and $numNodesFailed failed";
} else {
- $progressString = "( All nodes($numTotalNodes) failed! )";
+ $progressString = ": All $numTotalNodes nodes failed!";
// All nodes have failed
}
} else {
@@ -22,19 +22,19 @@ function generateNodeActionProgress ($nu
// Some nodes in progress, no failed nodes
if ($numNodesSucceeded != 0) {
// Some in progress, some succeeded, no failed
- $progressString = " ( $numNodesInProgress / $numTotalNodes in progress, $numNodesSucceeded $finalGoodState. )";
+ $progressString = ": $numNodesInProgress / $numTotalNodes in progress, $numNodesSucceeded $finalGoodState";
} else {
// All nodes are in progress
- $progressString = " ( $numNodesInProgress / $numTotalNodes in progress. )";
+ $progressString = ": $numNodesInProgress / $numTotalNodes in progress";
}
} else {
// Some in progress, some failed
if ($numNodesSucceeded != 0) {
// Some in progress, some succeeded and some failed
- $progressString = " ( $numNodesInProgress / $numTotalNodes in progress, $numNodesSucceeded $finalGoodState and $numNodesFailed failed. )";
+ $progressString = ": $numNodesInProgress / $numTotalNodes in progress; $numNodesSucceeded $finalGoodState and $numNodesFailed failed";
} else {
// Some in progress, some failed, none succeeded
- $progressString = " ( $numNodesInProgress / $numTotalNodes in progress, $numNodesFailed failed. )";
+ $progressString = ": $numNodesInProgress / $numTotalNodes in progress; $numNodesFailed failed";
}
}
}