diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js index 492fe18b..40ea2e43 100644 --- a/src/js/yunohost/controllers/services.js +++ b/src/js/yunohost/controllers/services.js @@ -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(); }); }); }); diff --git a/src/locales/en.json b/src/locales/en.json index b8840617..80811662 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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?",