Forgot to finish implementing service restart...

This commit is contained in:
Alexandre Aubin 2020-04-14 18:48:24 +02:00
parent a955e201c1
commit e7d914882a
2 changed files with 19 additions and 9 deletions

View file

@ -59,18 +59,29 @@
c.view('service/service_info', data, function() {
// Configure behavior for enable/disable and start/stop buttons
$('button[data-action="start"], button[data-action="stop"]').on('click', function() {
$('button[data-action="start"], button[data-action="restart"], button[data-action="stop"]').on('click', function() {
var service = $(this).data('service');
var action = $(this).data('action');
c.confirm("Service", y18n.t('confirm_service_' + action, [service]), function(){
c.confirm(y18n.t("services"), y18n.t('confirm_service_' + action, [service]), function(){
var method = null,
endurl = service;
method = action === "start" ? 'PUT' : 'DELETE';
c.api(method, '/services/'+ endurl, {}, function() { c.refresh(); });
if (action == "start")
{
var method = "PUT";
var url = "/services/" + service;
}
else if (action == "restart")
{
var method = "PUT";
var url = "/services/" + service + "/restart";
}
else
{
var method = "DELETE";
var url = "/services/" + service;
}
c.api(method, url, {}, function() { c.refresh(); });
});
});

View file

@ -61,10 +61,9 @@
"confirm_migrations_skip": "Skipping migrations is not recommended. Are you sure you want to do that?",
"confirm_postinstall": "You are about to launch the post-installation process on the domain %s. It may take a few minutes, *do not interrupt the operation*.",
"confirm_restore": "Are you sure you want to restore %s?",
"confirm_service_restart": "Are you sure you want to restart %s?",
"confirm_service_start": "Are you sure you want to start %s?",
"confirm_service_stop": "Are you sure you want to stop %s?",
"confirm_service_enable": "Are you sure you want to enable %s?",
"confirm_service_disable": "Are you sure you want to disable %s?",
"confirm_uninstall": "Are you sure you want to uninstall %s?",
"confirm_update_apps": "Are you sure you want to update all applications?",
"confirm_update_system": "Are you sure you want to update all system packages?",