mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Rename Disks and Snapshots in Configuration tab
- Rename Disks to Storage - Rename Snapshot to Storage Snapshots Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
87001a7cd6
commit
81fde34254
@ -1 +0,0 @@
|
|||||||
plinth.modules.disks
|
|
||||||
1
data/etc/plinth/modules-enabled/storage
Normal file
1
data/etc/plinth/modules-enabled/storage
Normal file
@ -0,0 +1 @@
|
|||||||
|
plinth.modules.storage
|
||||||
@ -29,7 +29,7 @@ version = 1
|
|||||||
|
|
||||||
managed_packages = ['snapper']
|
managed_packages = ['snapper']
|
||||||
|
|
||||||
name = _('Snapshots')
|
name = _('Storage Snapshots')
|
||||||
|
|
||||||
description = [
|
description = [
|
||||||
_('Snapshots allows creating and managing filesystem snapshots. These can '
|
_('Snapshots allows creating and managing filesystem snapshots. These can '
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Plinth module to manage disks.
|
Plinth module to manage storage.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
@ -30,7 +30,7 @@ from plinth.menu import main_menu
|
|||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
name = _('Disks')
|
name = _('Storage')
|
||||||
|
|
||||||
description = []
|
description = []
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
|
|||||||
def init():
|
def init():
|
||||||
"""Intialize the module."""
|
"""Intialize the module."""
|
||||||
menu = main_menu.get('system')
|
menu = main_menu.get('system')
|
||||||
menu.add_urlname(name, 'glyphicon-hdd', 'disks:index')
|
menu.add_urlname(name, 'glyphicon-hdd', 'storage:index')
|
||||||
|
|
||||||
|
|
||||||
def get_disks():
|
def get_disks():
|
||||||
@ -85,7 +85,7 @@
|
|||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a class="btn btn-primary btn-md" href="{% url 'disks:expand' %}"
|
<a class="btn btn-primary btn-md" href="{% url 'storage:expand' %}"
|
||||||
role="button">
|
role="button">
|
||||||
{% trans "Expand Root Partition" %}</a>
|
{% trans "Expand Root Partition" %}</a>
|
||||||
</p>
|
</p>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a class="btn btn-primary btn-md disabled"
|
<a class="btn btn-primary btn-md disabled"
|
||||||
href="{% url 'disks:expand' %}" role="button">
|
href="{% url 'storage:expand' %}" role="button">
|
||||||
{% trans "Expand Root Partition" %}</a>
|
{% trans "Expand Root Partition" %}</a>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Test module for disks module operations.
|
Test module for storage module operations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -121,7 +121,7 @@ class Disk():
|
|||||||
|
|
||||||
|
|
||||||
class TestActions(unittest.TestCase):
|
class TestActions(unittest.TestCase):
|
||||||
"""Test all actions related to disks."""
|
"""Test all actions related to storage."""
|
||||||
@unittest.skipUnless(euid == 0, 'Needs to be root')
|
@unittest.skipUnless(euid == 0, 'Needs to be root')
|
||||||
def test_simple_case(self):
|
def test_simple_case(self):
|
||||||
"""Test a simple with no complications"""
|
"""Test a simple with no complications"""
|
||||||
@ -199,14 +199,14 @@ class TestActions(unittest.TestCase):
|
|||||||
def assert_free_space(self, partition_number, space=True):
|
def assert_free_space(self, partition_number, space=True):
|
||||||
"""Verify that free is available/not available after a parition."""
|
"""Verify that free is available/not available after a parition."""
|
||||||
device = _get_partition_device(self.device, partition_number)
|
device = _get_partition_device(self.device, partition_number)
|
||||||
result = self.run_action(['disks', 'is-partition-expandable', device])
|
result = self.run_action(['storage', 'is-partition-expandable', device])
|
||||||
self.assertEqual(result, space)
|
self.assertEqual(result, space)
|
||||||
|
|
||||||
def expand_partition(self, partition_number, success=True):
|
def expand_partition(self, partition_number, success=True):
|
||||||
"""Expand a partition."""
|
"""Expand a partition."""
|
||||||
self.assert_aligned(partition_number)
|
self.assert_aligned(partition_number)
|
||||||
device = _get_partition_device(self.device, partition_number)
|
device = _get_partition_device(self.device, partition_number)
|
||||||
result = self.run_action(['disks', 'expand-partition', device])
|
result = self.run_action(['storage', 'expand-partition', device])
|
||||||
self.assertEqual(result, success)
|
self.assertEqual(result, success)
|
||||||
self.assert_aligned(partition_number)
|
self.assert_aligned(partition_number)
|
||||||
|
|
||||||
@ -25,6 +25,6 @@ from . import views
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^sys/disks/$', views.index, name='index'),
|
url(r'^sys/storage/$', views.index, name='index'),
|
||||||
url(r'^sys/disks/expand$', views.expand, name='expand'),
|
url(r'^sys/storage/expand$', views.expand, name='expand'),
|
||||||
]
|
]
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Views for disks module.
|
Views for storage module.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -25,7 +25,7 @@ from django.shortcuts import redirect
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from plinth.modules import disks as disks_module
|
from plinth.modules import storage as storage_module
|
||||||
from plinth.utils import format_lazy, is_user_admin
|
from plinth.utils import format_lazy, is_user_admin
|
||||||
|
|
||||||
|
|
||||||
@ -34,31 +34,31 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Show connection list."""
|
"""Show connection list."""
|
||||||
disks = disks_module.get_disks()
|
disks = storage_module.get_disks()
|
||||||
root_device = disks_module.get_root_device(disks)
|
root_device = storage_module.get_root_device(disks)
|
||||||
expandable_root_size = disks_module.is_expandable(root_device)
|
expandable_root_size = storage_module.is_expandable(root_device)
|
||||||
expandable_root_size = _format_bytes(expandable_root_size)
|
expandable_root_size = _format_bytes(expandable_root_size)
|
||||||
|
|
||||||
warn_about_low_disk_space(request)
|
warn_about_low_disk_space(request)
|
||||||
|
|
||||||
return TemplateResponse(request, 'disks.html',
|
return TemplateResponse(request, 'storage.html',
|
||||||
{'title': _('Disks'),
|
{'title': _('Storage'),
|
||||||
'disks': disks,
|
'disks': disks,
|
||||||
'expandable_root_size': expandable_root_size})
|
'expandable_root_size': expandable_root_size})
|
||||||
|
|
||||||
|
|
||||||
def expand(request):
|
def expand(request):
|
||||||
"""Warn and expand the root partition."""
|
"""Warn and expand the root partition."""
|
||||||
disks = disks_module.get_disks()
|
disks = storage_module.get_disks()
|
||||||
root_device = disks_module.get_root_device(disks)
|
root_device = storage_module.get_root_device(disks)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
expand_partition(request, root_device)
|
expand_partition(request, root_device)
|
||||||
return redirect(reverse('disks:index'))
|
return redirect(reverse('storage:index'))
|
||||||
|
|
||||||
expandable_root_size = disks_module.is_expandable(root_device)
|
expandable_root_size = storage_module.is_expandable(root_device)
|
||||||
expandable_root_size = _format_bytes(expandable_root_size)
|
expandable_root_size = _format_bytes(expandable_root_size)
|
||||||
return TemplateResponse(request, 'disks_expand.html',
|
return TemplateResponse(request, 'storage_expand.html',
|
||||||
{'title': _('Expand Root Partition'),
|
{'title': _('Expand Root Partition'),
|
||||||
'expandable_root_size': expandable_root_size})
|
'expandable_root_size': expandable_root_size})
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ def expand(request):
|
|||||||
def expand_partition(request, device):
|
def expand_partition(request, device):
|
||||||
"""Expand the partition."""
|
"""Expand the partition."""
|
||||||
try:
|
try:
|
||||||
disks_module.expand_partition(device)
|
storage_module.expand_partition(device)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
messages.error(request, _('Error expanding partition: {exception}')
|
messages.error(request, _('Error expanding partition: {exception}')
|
||||||
.format(exception=exception))
|
.format(exception=exception))
|
||||||
@ -79,7 +79,7 @@ def warn_about_low_disk_space(request):
|
|||||||
if not is_user_admin(request, cached=True):
|
if not is_user_admin(request, cached=True):
|
||||||
return
|
return
|
||||||
|
|
||||||
disks = disks_module.get_disks()
|
disks = storage_module.get_disks()
|
||||||
list_root = [disk for disk in disks if disk['mountpoint'] == '/']
|
list_root = [disk for disk in disks if disk['mountpoint'] == '/']
|
||||||
if not list_root:
|
if not list_root:
|
||||||
logger.error('Error getting information about root partition.')
|
logger.error('Error getting information about root partition.')
|
||||||
@ -31,7 +31,7 @@ import time
|
|||||||
from . import forms, frontpage
|
from . import forms, frontpage
|
||||||
import plinth
|
import plinth
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth.modules.disks import views as disk_views
|
from plinth.modules.storage import views as disk_views
|
||||||
|
|
||||||
|
|
||||||
@public
|
@public
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user