system: missing control widget from log pages

Just as a POC shuffle known service controllers into the
page making sure to correctly translate their names.

Can't be the final state but it's a start.  Should probably
move all service monitoring to a separate API under the
"correct" (well, "matching" anyway) name.
This commit is contained in:
Franco Fichtner 2020-09-15 09:54:45 +02:00
parent 7ac50f9f8d
commit 5d6aff7af2
3 changed files with 25 additions and 2 deletions

View File

@ -40,6 +40,25 @@ class LogController extends IndexController
$this->view->pick('OPNsense/Diagnostics/log');
$this->view->module = $module;
$this->view->scope = $scope;
$this->view->service = '';
$service = $module == 'core' ? $scope : $module;
/* XXX manually hook up known services for now */
switch ($service) {
case 'ipsec':
$this->view->service = 'ipsec';
break;
case 'suricata':
$this->view->service = 'ids';
break;
case 'squid':
$this->view->service = 'proxy';
break;
default:
/* no service API at the moment */
break;
}
}
public function __call($name, $arguments)

View File

@ -65,7 +65,7 @@
}
$('<a></a>').attr('href',download_link).get(0).click();
});
updateServiceControlUI('{{service}}');
});
</script>

View File

@ -93,7 +93,7 @@ function saveFormToEndpoint(url, formid, callback_ok, disable_dialog, callback_f
if ( callback_fail !== undefined ) {
// execute callback function
callback_fail(data);
}
}
} else if ( callback_ok !== undefined ) {
// execute callback function
callback_ok(data);
@ -169,6 +169,10 @@ function updateServiceStatusUI(status)
*/
function updateServiceControlUI(serviceName)
{
if (serviceName == '') {
return;
}
ajaxCall("/api/" + serviceName + "/service/status", {}, function(data) {
let status_html = '<span class="label label-opnsense label-opnsense-sm ';
let status_icon = '';