From 4f88e1cff5a02c1ec1b2b14e327b712168c1b1e9 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 28 Nov 2017 20:40:20 +0000 Subject: [PATCH] net/haproxy: sync service start PR: https://github.com/opnsense/core/issues/1954 --- .../OPNsense/HAProxy/Api/ServiceController.php | 8 +++++++- .../app/controllers/OPNsense/HAProxy/IndexController.php | 2 -- .../OPNsense/HAProxy/StatisticsController.php | 1 - .../opnsense/mvc/app/views/OPNsense/HAProxy/index.volt | 9 +++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php index 235e4aa5d..b6b1e7542 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php @@ -46,8 +46,10 @@ 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("haproxy start", true); + $response = $backend->configdRun("haproxy start"); return array("response" => $response); } else { return array("response" => array()); @@ -61,6 +63,8 @@ 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("haproxy stop"); return array("response" => $response); @@ -76,6 +80,8 @@ 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("haproxy restart"); return array("response" => $response); diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/IndexController.php b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/IndexController.php index b6a91b3f4..9320f90cf 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/IndexController.php +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/IndexController.php @@ -41,8 +41,6 @@ class IndexController extends \OPNsense\Base\IndexController */ public function indexAction() { - // set page title - $this->view->title = gettext("HAProxy Load Balancer"); // include form definitions $this->view->mainForm = $this->getForm("main"); $this->view->formDialogFrontend = $this->getForm("dialogFrontend"); diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/StatisticsController.php b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/StatisticsController.php index 160f918ef..223e480d0 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/StatisticsController.php +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/StatisticsController.php @@ -37,7 +37,6 @@ class StatisticsController extends \OPNsense\Base\IndexController { public function indexAction() { - $this->view->title = gettext("HAProxy Load Balancer / Statistics"); // choose template $this->view->pick('OPNsense/HAProxy/statistics'); } diff --git a/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt b/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt index 9750fc363..a2236bf27 100644 --- a/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt +++ b/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt @@ -352,12 +352,9 @@ 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/haproxy/service/status", sendData={}, callback=function(data,status) { - updateServiceStatusUI(data['status']); - }); - },3000); + ajaxCall(url="/api/haproxy/service/status", sendData={}, callback=function(data,status) { + updateServiceStatusUI(data['status']); + }); } }); });