Merge pull request #401 from opnsense/fraenki_haproxy

net/haproxy: sync service start
This commit is contained in:
Frank Wall
2017-12-05 14:42:23 +01:00
committed by GitHub
4 changed files with 10 additions and 10 deletions
@@ -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);
@@ -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");
@@ -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');
}
@@ -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']);
});
}
});
});