From fae7cf312d3a5a6f6339b445fcbba7f006937c77 Mon Sep 17 00:00:00 2001 From: Rich Hagarty Date: Tue, 17 Nov 2015 10:35:18 -0800 Subject: [PATCH] Use "GiB" and "gibibyte" labels in share panels Data storage sizes are typically measured in gibibytes (GiB). To avoid confusion, Manila-ui panels should use these terms instead of gigabytes and GB. Change-Id: I98a0be1397fbf937c26fa033b96c2e8bcf5d4e27 Closes-bug: #1516839 --- manila_ui/dashboards/admin/shares/tables.py | 2 +- .../shares/_snapshot_detail_overview.html | 2 +- .../dashboards/project/shares/shares/forms.py | 16 ++++++++-------- .../dashboards/project/shares/shares/tables.py | 2 +- .../dashboards/project/shares/shares/tests.py | 2 +- .../project/shares/snapshots/tables.py | 2 +- .../dashboards/project/shares/snapshots/tests.py | 2 +- .../shares/shares/_detail_overview.html | 2 +- .../templates/shares/shares/_extend_limits.html | 4 ++-- .../shares/templates/shares/shares/_limits.html | 4 ++-- .../shares/snapshots/_limits_snapshots.html | 4 ++-- .../snapshots/_snapshot_detail_overview.html | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manila_ui/dashboards/admin/shares/tables.py b/manila_ui/dashboards/admin/shares/tables.py index 2045f38d..f85b8fdd 100644 --- a/manila_ui/dashboards/admin/shares/tables.py +++ b/manila_ui/dashboards/admin/shares/tables.py @@ -28,7 +28,7 @@ from manila_ui.dashboards.project.shares.snapshots \ def get_size(share): - return _("%sGB") % share.size + return _("%sGiB") % share.size class CreateShareType(tables.LinkAction): diff --git a/manila_ui/dashboards/admin/shares/templates/shares/_snapshot_detail_overview.html b/manila_ui/dashboards/admin/shares/templates/shares/_snapshot_detail_overview.html index b6287a81..90760c2f 100644 --- a/manila_ui/dashboards/admin/shares/templates/shares/_snapshot_detail_overview.html +++ b/manila_ui/dashboards/admin/shares/templates/shares/_snapshot_detail_overview.html @@ -27,7 +27,7 @@
{% trans "Size" %}
-
{{ snapshot.size }} {% trans "GB" %}
+
{{ snapshot.size }} {% trans "GiB" %}
{% trans "Created" %}
{{ snapshot.created_at|parse_date }}
diff --git a/manila_ui/dashboards/project/shares/shares/forms.py b/manila_ui/dashboards/project/shares/shares/forms.py index 282c9f52..31b04f5e 100644 --- a/manila_ui/dashboards/project/shares/shares/forms.py +++ b/manila_ui/dashboards/project/shares/shares/forms.py @@ -40,7 +40,7 @@ class CreateForm(forms.SelfHandlingForm): label=_("Description"), required=False, widget=forms.Textarea(attrs={'rows': 3})) share_proto = forms.ChoiceField(label=_("Share Protocol"), required=True) - size = forms.IntegerField(min_value=1, label=_("Size (GB)")) + size = forms.IntegerField(min_value=1, label=_("Size (GiB)")) share_type = forms.ChoiceField( label=_("Share Type"), required=True, widget=forms.Select( @@ -94,7 +94,7 @@ class CreateForm(forms.SelfHandlingForm): 'data-switch-on': 'source', 'data-source-snapshot': _('Snapshot')}, data_attrs=('size', 'name'), - transform=lambda x: "%s (%sGB)" % (x.name, x.size)), + transform=lambda x: "%s (%sGiB)" % (x.name, x.size)), required=False) self.fields['metadata'] = forms.CharField( label=_("Metadata"), required=False, @@ -120,7 +120,7 @@ class CreateForm(forms.SelfHandlingForm): pass self.fields['size'].help_text = _( 'Share size must be equal to or greater than the snapshot ' - 'size (%sGB)') % snapshot.size + 'size (%sGiB)') % snapshot.size del self.fields['share_source_type'] except Exception: exceptions.handle(request, @@ -191,7 +191,7 @@ class CreateForm(forms.SelfHandlingForm): snapshot_id = snapshot.id if (data['size'] < snapshot.size): error_message = _('The share size cannot be less than the ' - 'snapshot size (%sGB)') % snapshot.size + 'snapshot size (%sGiB)') % snapshot.size raise ValidationError(error_message) else: if type(data['size']) is str: @@ -345,13 +345,13 @@ class ExtendForm(forms.SelfHandlingForm): ) orig_size = forms.IntegerField( - label=_("Current Size (GB)"), + label=_("Current Size (GiB)"), widget=forms.TextInput(attrs={'readonly': 'readonly'}), required=False, ) new_size = forms.IntegerField( - label=_("New Size (GB)"), + label=_("New Size (GiB)"), ) def clean(self): @@ -368,8 +368,8 @@ class ExtendForm(forms.SelfHandlingForm): availableGB = (usages['maxTotalShareGigabytes'] - usages['totalShareGigabytesUsed']) if availableGB < (new_size - orig_size): - message = _('Share cannot be extended to %(req)iGB as ' - 'you only have %(avail)iGB of your quota ' + message = _('Share cannot be extended to %(req)iGiB as ' + 'you only have %(avail)iGiB of your quota ' 'available.') params = {'req': new_size, 'avail': availableGB + orig_size} self._errors["new_size"] = self.error_class([message % params]) diff --git a/manila_ui/dashboards/project/shares/shares/tables.py b/manila_ui/dashboards/project/shares/shares/tables.py index 953333cb..f529ae92 100644 --- a/manila_ui/dashboards/project/shares/shares/tables.py +++ b/manila_ui/dashboards/project/shares/shares/tables.py @@ -157,7 +157,7 @@ class UpdateRow(tables.Row): def get_size(share): - return _("%sGB") % share.size + return _("%sGiB") % share.size class SharesTableBase(tables.DataTable): diff --git a/manila_ui/dashboards/project/shares/shares/tests.py b/manila_ui/dashboards/project/shares/shares/tests.py index 1d0dc41f..0adbcbf7 100644 --- a/manila_ui/dashboards/project/shares/shares/tests.py +++ b/manila_ui/dashboards/project/shares/shares/tests.py @@ -153,7 +153,7 @@ class ShareViewTests(test.TestCase): self.assertContains(res, "
%s
" % share.name, 1, 200) self.assertContains(res, "
%s
" % share.id, 1, 200) - self.assertContains(res, "
%s GB
" % share.size, 1, 200) + self.assertContains(res, "
%s GiB
" % share.size, 1, 200) self.assertContains(res, "
%s
" % share.share_proto, 1, 200) self.assertContains(res, "
%s
" % share.availability_zone, 1, 200) diff --git a/manila_ui/dashboards/project/shares/snapshots/tables.py b/manila_ui/dashboards/project/shares/snapshots/tables.py index f0b4e945..f380e221 100644 --- a/manila_ui/dashboards/project/shares/snapshots/tables.py +++ b/manila_ui/dashboards/project/shares/snapshots/tables.py @@ -43,7 +43,7 @@ class UpdateRow(tables.Row): def get_size(snapshot): - return _("%sGB") % snapshot.size + return _("%sGiB") % snapshot.size class CreateSnapshot(tables.LinkAction): diff --git a/manila_ui/dashboards/project/shares/snapshots/tests.py b/manila_ui/dashboards/project/shares/snapshots/tests.py index 3a4c14c6..ab582c58 100644 --- a/manila_ui/dashboards/project/shares/snapshots/tests.py +++ b/manila_ui/dashboards/project/shares/snapshots/tests.py @@ -82,7 +82,7 @@ class SnapshotSnapshotViewTests(test.TestCase): self.assertContains(res, "
%s
" % (snapshot.share_id, share.name), 1, 200) - self.assertContains(res, "
%s GB
" % snapshot.size, 1, 200) + self.assertContains(res, "
%s GiB
" % snapshot.size, 1, 200) self.assertNoMessages() diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_detail_overview.html b/manila_ui/dashboards/project/shares/templates/shares/shares/_detail_overview.html index 748c9384..9b01da84 100644 --- a/manila_ui/dashboards/project/shares/templates/shares/shares/_detail_overview.html +++ b/manila_ui/dashboards/project/shares/templates/shares/shares/_detail_overview.html @@ -42,7 +42,7 @@
{% trans "Size" %}
-
{{ share.size }} {% trans "GB" %}
+
{{ share.size }} {% trans "GiB" %}
{% trans "Protocol" %}
{{ share.share_proto }}
{% if share.share_type %} diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_extend_limits.html b/manila_ui/dashboards/project/shares/templates/shares/shares/_extend_limits.html index 6fe6d019..ab4a2eb4 100644 --- a/manila_ui/dashboards/project/shares/templates/shares/shares/_extend_limits.html +++ b/manila_ui/dashboards/project/shares/templates/shares/shares/_extend_limits.html @@ -7,8 +7,8 @@

{% trans "Share Limits" %}

- {% trans "Total Gigabytes" %} ({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GB" %}) -

{{ usages.maxTotalShareGigabytes|quota:_("GB")|intcomma }}

+ {% trans "Total Gibibytes" %} ({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GiB" %}) +

{{ usages.maxTotalShareGigabytes|quota:_("GiB")|intcomma }}

diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_limits.html b/manila_ui/dashboards/project/shares/templates/shares/shares/_limits.html index c7d9075d..5fdd6b4c 100644 --- a/manila_ui/dashboards/project/shares/templates/shares/shares/_limits.html +++ b/manila_ui/dashboards/project/shares/templates/shares/shares/_limits.html @@ -14,8 +14,8 @@

{% trans "Share Limits" %}

- {% trans "Total Gigabytes" %} ({{ usages.totalGigabytesUsed|intcomma }} {% trans "GB" %}) -

{{ usages.maxTotalShareGigabytes|quota:_("GB")|intcomma }}

+ {% trans "Total Gibibytes" %} ({{ usages.totalGigabytesUsed|intcomma }} {% trans "GiB" %}) +

{{ usages.maxTotalShareGigabytes|quota:_("GiB")|intcomma }}

diff --git a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_limits_snapshots.html b/manila_ui/dashboards/project/shares/templates/shares/snapshots/_limits_snapshots.html index 1e773058..3de67a24 100644 --- a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_limits_snapshots.html +++ b/manila_ui/dashboards/project/shares/templates/shares/snapshots/_limits_snapshots.html @@ -7,8 +7,8 @@

{% trans "Share Limits" %}

- {% trans "Total Gigabytes" %} ({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GB" %}) -

{{ usages.maxTotalShareGigabytes|quota:_("GB")|intcomma }}

+ {% trans "Total Gibibytes" %} ({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GiB" %}) +

{{ usages.maxTotalShareGigabytes|quota:_("GiB")|intcomma }}

diff --git a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html b/manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html index c5b76c5a..203c6b82 100644 --- a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html +++ b/manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html @@ -28,7 +28,7 @@
{% trans "Size" %}
-
{{ snapshot.size }} {% trans "GB" %}
+
{{ snapshot.size }} {% trans "GiB" %}
{% trans "Created" %}
{{ snapshot.created_at|parse_date }}