web proxy: synchronous service start, no delay, session closed for #1954

This commit is contained in:
Franco Fichtner 2017-11-24 07:54:39 +00:00
parent 91c8493068
commit 7ccfe1ba9f
2 changed files with 14 additions and 8 deletions

View File

@ -45,8 +45,11 @@ class ServiceController extends ApiControllerBase
public function startAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
$response = $backend->configdRun("proxy start", true);
$response = $backend->configdRun("proxy start");
return array("response" => $response);
} else {
return array("response" => array());
@ -60,6 +63,9 @@ class ServiceController extends ApiControllerBase
public function stopAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
$response = $backend->configdRun("proxy stop");
return array("response" => $response);
@ -75,6 +81,9 @@ class ServiceController extends ApiControllerBase
public function restartAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
$response = $backend->configdRun("proxy restart");
return array("response" => $response);
@ -108,7 +117,6 @@ class ServiceController extends ApiControllerBase
$status = "unkown";
}
return array("status" => $status);
}

View File

@ -169,12 +169,10 @@ POSSIBILITY OF SUCH DAMAGE.
draggable: true
});
} else {
// request service status after successful save and update status box (wait a few seconds before update)
setTimeout(function(){
ajaxCall(url="/api/proxy/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
},3000);
// request service status after successful save and update status box
ajaxCall(url="/api/proxy/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
}
});
});