From 81fde342544ca6fd0a146fc0be3011f2abd3f07a Mon Sep 17 00:00:00 2001 From: abilashr Date: Fri, 22 Sep 2017 14:24:44 +0530 Subject: [PATCH] Rename Disks and Snapshots in Configuration tab - Rename Disks to Storage - Rename Snapshot to Storage Snapshots Reviewed-by: Joseph Nuthalapati --- actions/{disks => storage} | 0 data/etc/plinth/modules-enabled/disks | 1 - data/etc/plinth/modules-enabled/storage | 1 + plinth/modules/snapshot/__init__.py | 2 +- plinth/modules/{disks => storage}/__init__.py | 6 ++-- .../templates/storage.html} | 4 +-- .../templates/storage_expand.html} | 0 .../{disks => storage}/tests/__init__.py | 0 .../tests/test_storage.py} | 8 +++--- plinth/modules/{disks => storage}/urls.py | 4 +-- plinth/modules/{disks => storage}/views.py | 28 +++++++++---------- plinth/views.py | 2 +- setup.py | 1 + 13 files changed, 29 insertions(+), 28 deletions(-) rename actions/{disks => storage} (100%) delete mode 100644 data/etc/plinth/modules-enabled/disks create mode 100644 data/etc/plinth/modules-enabled/storage rename plinth/modules/{disks => storage}/__init__.py (97%) rename plinth/modules/{disks/templates/disks.html => storage/templates/storage.html} (96%) rename plinth/modules/{disks/templates/disks_expand.html => storage/templates/storage_expand.html} (100%) rename plinth/modules/{disks => storage}/tests/__init__.py (100%) rename plinth/modules/{disks/tests/test_disks.py => storage/tests/test_storage.py} (97%) rename plinth/modules/{disks => storage}/urls.py (87%) rename plinth/modules/{disks => storage}/views.py (84%) diff --git a/actions/disks b/actions/storage similarity index 100% rename from actions/disks rename to actions/storage diff --git a/data/etc/plinth/modules-enabled/disks b/data/etc/plinth/modules-enabled/disks deleted file mode 100644 index 6ffa3d8f9..000000000 --- a/data/etc/plinth/modules-enabled/disks +++ /dev/null @@ -1 +0,0 @@ -plinth.modules.disks diff --git a/data/etc/plinth/modules-enabled/storage b/data/etc/plinth/modules-enabled/storage new file mode 100644 index 000000000..ad62cb83a --- /dev/null +++ b/data/etc/plinth/modules-enabled/storage @@ -0,0 +1 @@ +plinth.modules.storage diff --git a/plinth/modules/snapshot/__init__.py b/plinth/modules/snapshot/__init__.py index 6962b9b33..647e47f33 100644 --- a/plinth/modules/snapshot/__init__.py +++ b/plinth/modules/snapshot/__init__.py @@ -29,7 +29,7 @@ version = 1 managed_packages = ['snapper'] -name = _('Snapshots') +name = _('Storage Snapshots') description = [ _('Snapshots allows creating and managing filesystem snapshots. These can ' diff --git a/plinth/modules/disks/__init__.py b/plinth/modules/storage/__init__.py similarity index 97% rename from plinth/modules/disks/__init__.py rename to plinth/modules/storage/__init__.py index 6c46f86a0..e14162fd4 100644 --- a/plinth/modules/disks/__init__.py +++ b/plinth/modules/storage/__init__.py @@ -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(): diff --git a/plinth/modules/disks/templates/disks.html b/plinth/modules/storage/templates/storage.html similarity index 96% rename from plinth/modules/disks/templates/disks.html rename to plinth/modules/storage/templates/storage.html index e4375c3e6..da91ed795 100644 --- a/plinth/modules/disks/templates/disks.html +++ b/plinth/modules/storage/templates/storage.html @@ -85,7 +85,7 @@ {% endblocktrans %}

- {% trans "Expand Root Partition" %}

@@ -98,7 +98,7 @@

+ href="{% url 'storage:expand' %}" role="button"> {% trans "Expand Root Partition" %}

{% endif %} diff --git a/plinth/modules/disks/templates/disks_expand.html b/plinth/modules/storage/templates/storage_expand.html similarity index 100% rename from plinth/modules/disks/templates/disks_expand.html rename to plinth/modules/storage/templates/storage_expand.html diff --git a/plinth/modules/disks/tests/__init__.py b/plinth/modules/storage/tests/__init__.py similarity index 100% rename from plinth/modules/disks/tests/__init__.py rename to plinth/modules/storage/tests/__init__.py diff --git a/plinth/modules/disks/tests/test_disks.py b/plinth/modules/storage/tests/test_storage.py similarity index 97% rename from plinth/modules/disks/tests/test_disks.py rename to plinth/modules/storage/tests/test_storage.py index 4515cbb32..d40298e0e 100644 --- a/plinth/modules/disks/tests/test_disks.py +++ b/plinth/modules/storage/tests/test_storage.py @@ -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) diff --git a/plinth/modules/disks/urls.py b/plinth/modules/storage/urls.py similarity index 87% rename from plinth/modules/disks/urls.py rename to plinth/modules/storage/urls.py index cbe3dc982..f3c98eedb 100644 --- a/plinth/modules/disks/urls.py +++ b/plinth/modules/storage/urls.py @@ -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'), ] diff --git a/plinth/modules/disks/views.py b/plinth/modules/storage/views.py similarity index 84% rename from plinth/modules/disks/views.py rename to plinth/modules/storage/views.py index 9352bc9c8..45d16077a 100644 --- a/plinth/modules/disks/views.py +++ b/plinth/modules/storage/views.py @@ -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.') diff --git a/plinth/views.py b/plinth/views.py index c544a1ea8..1620a3cb6 100644 --- a/plinth/views.py +++ b/plinth/views.py @@ -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 diff --git a/setup.py b/setup.py index fc06637ba..1fac1ded0 100755 --- a/setup.py +++ b/setup.py @@ -56,6 +56,7 @@ DISABLED_APPS_TO_REMOVE = [ 'owncloud', 'system', 'xmpp', + 'disks', ] LOCALE_PATHS = [