mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +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']
|
||||
|
||||
name = _('Snapshots')
|
||||
name = _('Storage Snapshots')
|
||||
|
||||
description = [
|
||||
_('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 _
|
||||
@ -30,7 +30,7 @@ from plinth.menu import main_menu
|
||||
|
||||
version = 1
|
||||
|
||||
name = _('Disks')
|
||||
name = _('Storage')
|
||||
|
||||
description = []
|
||||
|
||||
@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
|
||||
def init():
|
||||
"""Intialize the module."""
|
||||
menu = main_menu.get('system')
|
||||
menu.add_urlname(name, 'glyphicon-hdd', 'disks:index')
|
||||
menu.add_urlname(name, 'glyphicon-hdd', 'storage:index')
|
||||
|
||||
|
||||
def get_disks():
|
||||
@ -85,7 +85,7 @@
|
||||
{% endblocktrans %}
|
||||
</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">
|
||||
{% trans "Expand Root Partition" %}</a>
|
||||
</p>
|
||||
@ -98,7 +98,7 @@
|
||||
</p>
|
||||
<p>
|
||||
<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>
|
||||
</p>
|
||||
{% endif %}
|
||||
@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Test module for disks module operations.
|
||||
Test module for storage module operations.
|
||||
"""
|
||||
|
||||
import os
|
||||
@ -121,7 +121,7 @@ class Disk():
|
||||
|
||||
|
||||
class TestActions(unittest.TestCase):
|
||||
"""Test all actions related to disks."""
|
||||
"""Test all actions related to storage."""
|
||||
@unittest.skipUnless(euid == 0, 'Needs to be root')
|
||||
def test_simple_case(self):
|
||||
"""Test a simple with no complications"""
|
||||
@ -199,14 +199,14 @@ class TestActions(unittest.TestCase):
|
||||
def assert_free_space(self, partition_number, space=True):
|
||||
"""Verify that free is available/not available after a parition."""
|
||||
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)
|
||||
|
||||
def expand_partition(self, partition_number, success=True):
|
||||
"""Expand a partition."""
|
||||
self.assert_aligned(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.assert_aligned(partition_number)
|
||||
|
||||
@ -25,6 +25,6 @@ from . import views
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^sys/disks/$', views.index, name='index'),
|
||||
url(r'^sys/disks/expand$', views.expand, name='expand'),
|
||||
url(r'^sys/storage/$', views.index, name='index'),
|
||||
url(r'^sys/storage/expand$', views.expand, name='expand'),
|
||||
]
|
||||
@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
"""
|
||||
Views for disks module.
|
||||
Views for storage module.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -25,7 +25,7 @@ from django.shortcuts import redirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse
|
||||
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
|
||||
|
||||
|
||||
@ -34,31 +34,31 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
def index(request):
|
||||
"""Show connection list."""
|
||||
disks = disks_module.get_disks()
|
||||
root_device = disks_module.get_root_device(disks)
|
||||
expandable_root_size = disks_module.is_expandable(root_device)
|
||||
disks = storage_module.get_disks()
|
||||
root_device = storage_module.get_root_device(disks)
|
||||
expandable_root_size = storage_module.is_expandable(root_device)
|
||||
expandable_root_size = _format_bytes(expandable_root_size)
|
||||
|
||||
warn_about_low_disk_space(request)
|
||||
|
||||
return TemplateResponse(request, 'disks.html',
|
||||
{'title': _('Disks'),
|
||||
return TemplateResponse(request, 'storage.html',
|
||||
{'title': _('Storage'),
|
||||
'disks': disks,
|
||||
'expandable_root_size': expandable_root_size})
|
||||
|
||||
|
||||
def expand(request):
|
||||
"""Warn and expand the root partition."""
|
||||
disks = disks_module.get_disks()
|
||||
root_device = disks_module.get_root_device(disks)
|
||||
disks = storage_module.get_disks()
|
||||
root_device = storage_module.get_root_device(disks)
|
||||
|
||||
if request.method == 'POST':
|
||||
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)
|
||||
return TemplateResponse(request, 'disks_expand.html',
|
||||
return TemplateResponse(request, 'storage_expand.html',
|
||||
{'title': _('Expand Root Partition'),
|
||||
'expandable_root_size': expandable_root_size})
|
||||
|
||||
@ -66,7 +66,7 @@ def expand(request):
|
||||
def expand_partition(request, device):
|
||||
"""Expand the partition."""
|
||||
try:
|
||||
disks_module.expand_partition(device)
|
||||
storage_module.expand_partition(device)
|
||||
except Exception as exception:
|
||||
messages.error(request, _('Error expanding partition: {exception}')
|
||||
.format(exception=exception))
|
||||
@ -79,7 +79,7 @@ def warn_about_low_disk_space(request):
|
||||
if not is_user_admin(request, cached=True):
|
||||
return
|
||||
|
||||
disks = disks_module.get_disks()
|
||||
disks = storage_module.get_disks()
|
||||
list_root = [disk for disk in disks if disk['mountpoint'] == '/']
|
||||
if not list_root:
|
||||
logger.error('Error getting information about root partition.')
|
||||
@ -31,7 +31,7 @@ import time
|
||||
from . import forms, frontpage
|
||||
import plinth
|
||||
from plinth import actions
|
||||
from plinth.modules.disks import views as disk_views
|
||||
from plinth.modules.storage import views as disk_views
|
||||
|
||||
|
||||
@public
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user