diff --git a/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt b/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt index 343a4e1e7..e936938cc 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt @@ -35,7 +35,7 @@ formatTokenizersUI(); $('.selectpicker').selectpicker('refresh'); // request service status on load and update status box - updateServiceControlUI("proxy", "processing-dialog"); + updateServiceControlUI('proxy'); }); /************************************************************************************************************* @@ -165,8 +165,7 @@ draggable: true }); } else { - // request service status after successful save and update status box - updateServiceControlUI("proxy", "processing-dialog"); + updateServiceControlUI('proxy'); } }); }); @@ -265,4 +264,3 @@ {{ partial("layout_partials/base_dialog",['fields':formDialogEditBlacklist,'id':'DialogEditBlacklist','label':lang._('Edit blacklist')])}} -{{ partial("layout_partials/base_dialog_processing") }} diff --git a/src/opnsense/mvc/app/views/layouts/default.volt b/src/opnsense/mvc/app/views/layouts/default.volt index 81e0139fc..e1c704dcf 100644 --- a/src/opnsense/mvc/app/views/layouts/default.volt +++ b/src/opnsense/mvc/app/views/layouts/default.volt @@ -264,6 +264,20 @@ + + + diff --git a/src/opnsense/www/js/opnsense_ui.js b/src/opnsense/www/js/opnsense_ui.js index 676c99578..2f7721cbd 100644 --- a/src/opnsense/www/js/opnsense_ui.js +++ b/src/opnsense/www/js/opnsense_ui.js @@ -136,8 +136,8 @@ function mapDataToFormUI(data_get_map) { /** * update service status buttons in user interface */ -function updateServiceStatusUI(status) { - +function updateServiceStatusUI(status) +{ var status_html = ''; - buttons += ''; - buttons += ''; - $('#service_status_container').html(buttons); + status_html += '">'; + + $('#service_status_container').html(status_html + " " + buttons); var commands = ["start", "restart", "stop"]; commands.forEach(function(command) { $("#" + command + "Service").click(function(){ - if (processingDialog !== undefined) { - $('#' + processingDialog).modal('show'); - } + $('#OPNsenseStdWaitDialog').modal('show'); ajaxCall(url="/api/" + serviceName + "/service/" + command, sendData={},callback=function(data,status) { - if (processingDialog !== undefined) { - $('#' + processingDialog).modal('hide'); - } + $('#OPNsenseStdWaitDialog').modal('hide'); ajaxCall(url="/api/" + serviceName + "/service/status", sendData={}, callback=function(data,status) { - $("#startService").removeClass("btn-danger").removeClass("btn-success"); - if (data['status'] == "running") { - $("#startService").addClass("btn-success"); - } else if (data['status'] == "stopped") { - $("#startService").addClass("btn-danger"); - } + updateServiceControlUI(serviceName); }); }); });