mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Services: minor cleanup
- remove Service.description (not used anymore) - remove datetime template (use default service.html instead)
This commit is contained in:
parent
398e6d7b14
commit
895f329654
@ -1,25 +0,0 @@
|
|||||||
{% extends "service.html" %}
|
|
||||||
{% comment %}
|
|
||||||
#
|
|
||||||
# This file is part of Plinth.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block diagnostics %}
|
|
||||||
<p>
|
|
||||||
{% include "diagnostics_button.html" with module="datetime" %}
|
|
||||||
</p>
|
|
||||||
{% endblock %}
|
|
||||||
@ -35,7 +35,7 @@ class DateTimeServiceView(ServiceView):
|
|||||||
description = datetime.description
|
description = datetime.description
|
||||||
form_class = DateTimeForm
|
form_class = DateTimeForm
|
||||||
service_id = datetime.managed_services[0]
|
service_id = datetime.managed_services[0]
|
||||||
template_name = "datetime.html"
|
diagnostics_module_name = "datetime"
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
return {'is_enabled': self.service.is_enabled(),
|
return {'is_enabled': self.service.is_enabled(),
|
||||||
|
|||||||
@ -39,16 +39,14 @@ class Service(object):
|
|||||||
- service_id: unique service name. If possible this should be the name of
|
- service_id: unique service name. If possible this should be the name of
|
||||||
the service on operating system level (as in /etc/init.d/).
|
the service on operating system level (as in /etc/init.d/).
|
||||||
- name: service name as to be displayed in the GUI
|
- name: service name as to be displayed in the GUI
|
||||||
- description (optional): list of paragraphs that describe the service
|
|
||||||
- is_enabled (optional): Boolean, or a Function returning Boolean
|
- is_enabled (optional): Boolean, or a Function returning Boolean
|
||||||
- enable (optional): Function
|
- enable (optional): Function
|
||||||
- disable (optional): Function
|
- disable (optional): Function
|
||||||
- is_running (optional): Boolean, or a Function returning Boolean
|
- is_running (optional): Boolean, or a Function returning Boolean
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, service_id, name, ports=None, description=None,
|
def __init__(self, service_id, name, ports=None, is_external=False,
|
||||||
is_external=False, is_enabled=None, enable=None, disable=None,
|
is_enabled=None, enable=None, disable=None, is_running=None):
|
||||||
is_running=None):
|
|
||||||
if ports is None:
|
if ports is None:
|
||||||
ports = [service_id]
|
ports = [service_id]
|
||||||
|
|
||||||
@ -57,7 +55,6 @@ class Service(object):
|
|||||||
|
|
||||||
self.service_id = service_id
|
self.service_id = service_id
|
||||||
self.name = name
|
self.name = name
|
||||||
self.description = description
|
|
||||||
self.ports = ports
|
self.ports = ports
|
||||||
self.is_external = is_external
|
self.is_external = is_external
|
||||||
self._is_enabled = is_enabled
|
self._is_enabled = is_enabled
|
||||||
|
|||||||
@ -38,7 +38,7 @@ def index(request):
|
|||||||
|
|
||||||
|
|
||||||
class ServiceView(FormView):
|
class ServiceView(FormView):
|
||||||
"""A generic view for configuring simple modules."""
|
"""A generic view for configuring simple services."""
|
||||||
service_id = None
|
service_id = None
|
||||||
form_class = forms.ServiceForm
|
form_class = forms.ServiceForm
|
||||||
template_name = 'service.html'
|
template_name = 'service.html'
|
||||||
@ -70,7 +70,7 @@ class ServiceView(FormView):
|
|||||||
return service
|
return service
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
"""Return the status of the module to fill in the form."""
|
"""Return the status of the service to fill in the form."""
|
||||||
return {'is_enabled': self.service.is_enabled(),
|
return {'is_enabled': self.service.is_enabled(),
|
||||||
'is_running': self.service.is_running()}
|
'is_running': self.service.is_running()}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user