This commit is contained in:
Ad Schellevis 2021-01-08 16:00:24 +01:00
parent 952637011e
commit 8f929489e4
3 changed files with 26 additions and 2 deletions

View File

@ -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")
)
);
}
}

View File

@ -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(){

View File

@ -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'
);
}