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
This commit is contained in:
Rich Hagarty 2015-11-17 10:35:18 -08:00
parent 3ee0ed698d
commit fae7cf312d
12 changed files with 22 additions and 22 deletions

View File

@ -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):

View File

@ -27,7 +27,7 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Size" %}</dt>
<dd>{{ snapshot.size }} {% trans "GB" %}</dd>
<dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
<dt>{% trans "Created" %}</dt>
<dd>{{ snapshot.created_at|parse_date }}</dd>
</dl>

View File

@ -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])

View File

@ -157,7 +157,7 @@ class UpdateRow(tables.Row):
def get_size(share):
return _("%sGB") % share.size
return _("%sGiB") % share.size
class SharesTableBase(tables.DataTable):

View File

@ -153,7 +153,7 @@ class ShareViewTests(test.TestCase):
self.assertContains(res, "<dd>%s</dd>" % share.name, 1, 200)
self.assertContains(res, "<dd>%s</dd>" % share.id, 1, 200)
self.assertContains(res, "<dd>%s GB</dd>" % share.size, 1, 200)
self.assertContains(res, "<dd>%s GiB</dd>" % share.size, 1, 200)
self.assertContains(res, "<dd>%s</dd>" % share.share_proto, 1, 200)
self.assertContains(res, "<dd>%s</dd>" % share.availability_zone, 1,
200)

View File

@ -43,7 +43,7 @@ class UpdateRow(tables.Row):
def get_size(snapshot):
return _("%sGB") % snapshot.size
return _("%sGiB") % snapshot.size
class CreateSnapshot(tables.LinkAction):

View File

@ -82,7 +82,7 @@ class SnapshotSnapshotViewTests(test.TestCase):
self.assertContains(res,
"<dd><a href=\"/admin/shares/%s/\">%s</a></dd>" %
(snapshot.share_id, share.name), 1, 200)
self.assertContains(res, "<dd>%s GB</dd>" % snapshot.size, 1, 200)
self.assertContains(res, "<dd>%s GiB</dd>" % snapshot.size, 1, 200)
self.assertNoMessages()

View File

@ -42,7 +42,7 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Size" %}</dt>
<dd>{{ share.size }} {% trans "GB" %}</dd>
<dd>{{ share.size }} {% trans "GiB" %}</dd>
<dt>{% trans "Protocol" %}</dt>
<dd>{{ share.share_proto }}</dd>
{% if share.share_type %}

View File

@ -7,8 +7,8 @@
<h3>{% trans "Share Limits" %}</h3>
<div class="quota_title clearfix">
<strong>{% trans "Total Gigabytes" %} <span>({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GB" %})</span></strong>
<p>{{ usages.maxTotalShareGigabytes|quota:_("GB")|intcomma }}</p>
<strong>{% trans "Total Gibibytes" %} <span>({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GiB" %})</span></strong>
<p>{{ usages.maxTotalShareGigabytes|quota:_("GiB")|intcomma }}</p>
</div>
<div id="quota_size" data-progress-indicator-for="id_size" data-quota-limit="{{ usages.maxTotalShareGigabytes }}" data-quota-used="{{ usages.totalShareGigabytesUsed }}" class="quota_bar">

View File

@ -14,8 +14,8 @@
<h3>{% trans "Share Limits" %}</h3>
<div class="quota_title clearfix">
<strong>{% trans "Total Gigabytes" %} <span>({{ usages.totalGigabytesUsed|intcomma }} {% trans "GB" %})</span></strong>
<p>{{ usages.maxTotalShareGigabytes|quota:_("GB")|intcomma }}</p>
<strong>{% trans "Total Gibibytes" %} <span>({{ usages.totalGigabytesUsed|intcomma }} {% trans "GiB" %})</span></strong>
<p>{{ usages.maxTotalShareGigabytes|quota:_("GiB")|intcomma }}</p>
</div>
<div id="quota_size" data-progress-indicator-for="id_size" data-quota-limit="{{ usages.maxTotalShareGigabytes }}" data-quota-used="{{ usages.totalGigabytesUsed }}" class="quota_bar">

View File

@ -7,8 +7,8 @@
<h3>{% trans "Share Limits" %}</h3>
<div class="quota_title clearfix">
<strong>{% trans "Total Gigabytes" %} <span>({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GB" %})</span></strong>
<p>{{ usages.maxTotalShareGigabytes|quota:_("GB")|intcomma }}</p>
<strong>{% trans "Total Gibibytes" %} <span>({{ usages.totalShareGigabytesUsed|intcomma }} {% trans "GiB" %})</span></strong>
<p>{{ usages.maxTotalShareGigabytes|quota:_("GiB")|intcomma }}</p>
</div>
<div id="quota_size" data-progress-indicator-for="id_size" data-quota-limit="{{ usages.maxTotalShareGigabytes }}" data-quota-used="{{ usages.totalShareGigabytesUsed }}" class="quota_bar">

View File

@ -28,7 +28,7 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Size" %}</dt>
<dd>{{ snapshot.size }} {% trans "GB" %}</dd>
<dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
<dt>{% trans "Created" %}</dt>
<dd>{{ snapshot.created_at|parse_date }}</dd>
</dl>