diff --git a/actions/power b/actions/power index 5de6b5371..c21a4858c 100755 --- a/actions/power +++ b/actions/power @@ -29,14 +29,14 @@ def parse_arguments(): parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest='subcommand', help='Sub command') - subparsers.add_parser('reboot', help='Reboot the system') + subparsers.add_parser('restart', help='Restart the system') subparsers.add_parser('shutdown', help='Shut down the system') return parser.parse_args() -def subcommand_reboot(_): - """Reboot the system.""" +def subcommand_restart(_): + """Restart the system.""" subprocess.call('reboot') diff --git a/plinth/modules/power/templates/power.html b/plinth/modules/power/templates/power.html index 376715ad5..642aea911 100644 --- a/plinth/modules/power/templates/power.html +++ b/plinth/modules/power/templates/power.html @@ -26,19 +26,15 @@

{{ title }}

- {% blocktrans trimmed %} - From here, it is possible to reboot or shut down the system. - {% endblocktrans %} + {% blocktrans trimmed %}Restart or shut down the system.{% endblocktrans %}

- - {% trans "Reboot..." %} -

+ + {% trans "Restart »" %} -

- - {% trans "Shut Down..." %} + + {% trans "Shut Down »" %}

{% endblock %} diff --git a/plinth/modules/power/templates/power_reboot.html b/plinth/modules/power/templates/power_restart.html similarity index 82% rename from plinth/modules/power/templates/power_reboot.html rename to plinth/modules/power/templates/power_restart.html index 4733a095d..d4f001c26 100644 --- a/plinth/modules/power/templates/power_reboot.html +++ b/plinth/modules/power/templates/power_restart.html @@ -1,4 +1,4 @@ -\{% extends "base.html" %} +{% extends "base.html" %} {% comment %} # # This file is part of Plinth. @@ -27,7 +27,9 @@

{% blocktrans trimmed %} - Are you sure you want to reboot? + Are you sure you want to restart? You will not be able to access + this web interface for a few minutes until the system is + restarted. {% endblocktrans %}

@@ -37,8 +39,7 @@ {{ form|bootstrap }} - + value="{% trans "Restart Now" %}"/> {% endblock %} diff --git a/plinth/modules/power/templates/power_shutdown.html b/plinth/modules/power/templates/power_shutdown.html index 8b66bfbba..fea041ea3 100644 --- a/plinth/modules/power/templates/power_shutdown.html +++ b/plinth/modules/power/templates/power_shutdown.html @@ -27,7 +27,8 @@

{% blocktrans trimmed %} - Are you sure you want to shut down? + Are you sure you want to shut down? You will not be able to + access this web interface after shut down. {% endblocktrans %}

@@ -37,7 +38,7 @@ {{ form|bootstrap }} + value="{% trans "Shut Down Now" %}"/> diff --git a/plinth/modules/power/urls.py b/plinth/modules/power/urls.py index d37708ca5..465426ba2 100644 --- a/plinth/modules/power/urls.py +++ b/plinth/modules/power/urls.py @@ -24,6 +24,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( 'plinth.modules.power.views', url(r'^sys/power/$', 'index', name='index'), - url(r'^sys/power/reboot$', 'reboot', name='reboot'), + url(r'^sys/power/restart$', 'restart', name='restart'), url(r'^sys/power/shutdown$', 'shutdown', name='shutdown'), ) diff --git a/plinth/modules/power/views.py b/plinth/modules/power/views.py index 007233a5a..e1d835f6a 100644 --- a/plinth/modules/power/views.py +++ b/plinth/modules/power/views.py @@ -20,6 +20,8 @@ Plinth module for power module. """ from django.forms import Form +from django.core.urlresolvers import reverse +from django.shortcuts import redirect from django.template.response import TemplateResponse from django.utils.translation import ugettext as _ @@ -28,21 +30,21 @@ from plinth import actions def index(request): """Serve power controls page.""" - return TemplateResponse(request, 'power.html', - {'title': _('Power Control')}) + return TemplateResponse(request, 'power.html', {'title': _('Power')}) -def reboot(request): - """Serve reboot confirmation page.""" +def restart(request): + """Serve start confirmation page.""" form = None if request.method == 'POST': - actions.superuser_run('power', ['reboot']) + actions.superuser_run('power', ['restart'], async=True) + return redirect(reverse('apps:index')) else: form = Form(prefix='power') - return TemplateResponse(request, 'power_reboot.html', - {'title': _('Power Control'), + return TemplateResponse(request, 'power_restart.html', + {'title': _('Power'), 'form': form}) @@ -51,10 +53,11 @@ def shutdown(request): form = None if request.method == 'POST': - actions.superuser_run('power', ['shutdown']) + actions.superuser_run('power', ['shutdown'], async=True) + return redirect(reverse('apps:index')) else: form = Form(prefix='power') return TemplateResponse(request, 'power_shutdown.html', - {'title': _('Power Control'), + {'title': _('Power'), 'form': form})