Commit af15ba13 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: uses callbacks to be sure that post requests succeed

parent 70109873
...@@ -176,8 +176,9 @@ function bindRun() { ...@@ -176,8 +176,9 @@ function bindRun() {
stopProcess(); stopProcess();
} else { } else {
if (!isRunning()) { if (!isRunning()) {
runProcess($SCRIPT_ROOT + "/runSoftwareProfile"); runProcess($SCRIPT_ROOT + "/runSoftwareProfile").then(function() {
window.location.href = $SCRIPT_ROOT + "/viewLog?logfile=software.log"; window.location.href = $SCRIPT_ROOT + "/viewLog?logfile=software.log";
});
} }
} }
return false; return false;
...@@ -187,9 +188,10 @@ function bindRun() { ...@@ -187,9 +188,10 @@ function bindRun() {
stopProcess(); stopProcess();
} else { } else {
if (!isRunning()) { if (!isRunning()) {
runProcess($SCRIPT_ROOT + "/runInstanceProfile"); runProcess($SCRIPT_ROOT + "/runInstanceProfile").then(function() {
if (window.location.pathname === "/viewLog") if (window.location.pathname === "/viewLog")
window.location.href = $SCRIPT_ROOT + "/viewLog?logfile=instance.log"; window.location.href = $SCRIPT_ROOT + "/viewLog?logfile=instance.log";
});
} }
} }
return false; return false;
...@@ -277,10 +279,11 @@ function setRunningState(data) { ...@@ -277,10 +279,11 @@ function setRunningState(data) {
function runProcess(urlfor) { function runProcess(urlfor) {
"use strict"; "use strict";
if (!isRunning()) { if (!isRunning()) {
$.post(urlfor); return $.post(urlfor).then(function() {
if ( $("#running_info").children('span').length > 0 ) { if ( $("#running_info").children('span').length > 0 ) {
$("#running_info").children('p').remove(); $("#running_info").children('p').remove();
} }
});
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment