mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
UI: tooltip service widgets, closes https://github.com/opnsense/core/issues/4188
This commit is contained in:
parent
952637011e
commit
8f929489e4
@ -221,6 +221,13 @@ abstract class ApiMutableServiceControllerBase extends ApiControllerBase
|
||||
$status = 'unknown';
|
||||
}
|
||||
|
||||
return array('status' => $status);
|
||||
return array(
|
||||
'status' => $status,
|
||||
'widget' => array(
|
||||
'caption_stop' => gettext("stop service"),
|
||||
'caption_start' => gettext("start service"),
|
||||
'caption_restart' => gettext("restart service")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,6 +195,19 @@ function updateServiceControlUI(serviceName)
|
||||
|
||||
$('#service_status_container').html(status_html + " " + buttons);
|
||||
|
||||
if (data['widget'] !== undefined) {
|
||||
// tooltip service action widgets
|
||||
['stop', 'start', 'restart'].forEach(function(action){
|
||||
let obj = $("#" + action + "Service");
|
||||
if (obj.length > 0) {
|
||||
obj.tooltip({
|
||||
'placement': 'bottom',
|
||||
'title': data['widget']['caption_' + action]
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const commands = ["start", "restart", "stop"];
|
||||
commands.forEach(function(command) {
|
||||
$("#" + command + "Service").click(function(){
|
||||
|
||||
@ -581,7 +581,8 @@ function service_control_links($service, $xs = false)
|
||||
$service_id = isset($service['id']) ? $service['id'] : '';
|
||||
|
||||
$template = '<span data-service_id="%s" data-service_action="%s" data-service="%s" ';
|
||||
$template .= 'class="btn btn-%s btn-default %s"><i class="%s"></i></span>' . PHP_EOL;
|
||||
$template .= 'class="btn btn-%s btn-default %s" data-toggle="tooltip" data-placement="bottom" ';
|
||||
$template .= 'title="%s"><i class="%s"></i></span>' . PHP_EOL;
|
||||
|
||||
$output = '';
|
||||
|
||||
@ -593,6 +594,7 @@ function service_control_links($service, $xs = false)
|
||||
$service['name'],
|
||||
$xs ? 'xs' : 'sm',
|
||||
'srv_status_act',
|
||||
gettext("restart service"),
|
||||
'fa fa-refresh fa-fw'
|
||||
);
|
||||
if (empty($service['nocheck'])) {
|
||||
@ -603,6 +605,7 @@ function service_control_links($service, $xs = false)
|
||||
$service['name'],
|
||||
$xs ? 'xs' : 'sm',
|
||||
'srv_status_act',
|
||||
gettext("stop service"),
|
||||
'fa fa-stop fa-fw'
|
||||
);
|
||||
}
|
||||
@ -614,6 +617,7 @@ function service_control_links($service, $xs = false)
|
||||
$service['name'],
|
||||
$xs ? 'xs' : 'sm',
|
||||
'srv_status_act',
|
||||
gettext("start service"),
|
||||
'fa fa-play fa-fw'
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user