diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/ServiceController.php b/src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/ServiceController.php index d3cfa889f..1da1f0a70 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/ServiceController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/ServiceController.php @@ -56,6 +56,23 @@ class ServiceController extends ApiMutableServiceControllerBase (!empty((string)$mdlProxy->general->cache->local->enabled) != $prev_cache_active); } + /** + * reload template only (for example PAC does not need to change squid configuration) + * @return array + */ + public function resetAction() + { + if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); + $backend = new Backend(); + return array('status' => $backend->configdRun('proxy reset')); + } else { + return array('error' => 'This API endpoint must be called via POST', + 'status' => 'error'); + } + } + /** * reload template only (for example PAC does not need to change squid configuration) * @return array diff --git a/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt b/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt index 9249dbcc9..af45ec130 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Proxy/index.volt @@ -268,6 +268,33 @@ }); }); + $("#resetAct").click(function() { + + BootstrapDialog.show({ + type:BootstrapDialog.TYPE_DANGER, + title: '{{ lang._('Reset') }} ', + message: '{{ lang._('Are you sure you want to flush all generated content and restart the proxy?') }}', + buttons: [{ + label: '{{ lang._('Yes') }}', + cssClass: 'btn-primary', + action: function(dlg){ + dlg.close(); + $("#resetAct_progress").addClass("fa fa-spinner fa-pulse"); + ajaxCall("/api/proxy/service/reset", {}, function(data,status) { + $("#resetAct_progress").removeClass("fa fa-spinner fa-pulse"); + updateServiceControlUI('proxy'); + }); + } + }, { + label: '{{ lang._('No') }}', + action: function(dlg){ + dlg.close(); + } + }] + }); + + }); + // update history on tab state and implement navigation if(window.location.hash != "") { $('a[href="' + window.location.hash + '"]').click() @@ -301,6 +328,7 @@
| {{ lang._('Action')}} | ++ |
|---|---|
| + + | ++ {{ lang._('Reset all generated content (cached files and certificates included) and restart the proxy.') }} + | +