Browse Source

Small cosmetic fix for the pie charts

We were showing "False X of Y" instead of "Used X of Y"

Change-Id: I8287ecdba7dc11d048a089f246a1b3437c0ace1e
changes/67/736867/2
Victoria Martinez de la Cruz 1 month ago
parent
commit
4e84942e0c
2 changed files with 9 additions and 6 deletions
  1. +3
    -1
      manila_ui/dashboards/project/shares/__init__.py
  2. +6
    -5
      manila_ui/tests/dashboards/project/tests.py

+ 3
- 1
manila_ui/dashboards/project/shares/__init__.py View File

@@ -13,6 +13,7 @@
import functools
import sys

from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _

import horizon
@@ -379,12 +380,13 @@ def get_context_data(self, **kwargs):
)
for t in types:
if t[0] in self.usage.limits and t[1] in self.usage.limits:
text = pgettext_lazy('Label in the limit summary', 'Used')
context['charts'].append({
'type': t[0],
'name': t[2],
'used': self.usage.limits[t[0]],
'max': self.usage.limits[t[1]],
'text': False,
'text': text
})
return context



+ 6
- 5
manila_ui/tests/dashboards/project/tests.py View File

@@ -48,6 +48,7 @@ class PieChartsTests(test.TestCase):
"max": 13,
"text": "fake_text",
}
text = translation.pgettext_lazy('Label in the limit summary', 'Used')

class ParentViewInstance(mock.MagicMock):
def get_context_data(self, **kwargs):
@@ -67,16 +68,16 @@ class PieChartsTests(test.TestCase):
existing_chart_name: {
"name": existing_chart_name, "used": existing_chart["used"],
"max": existing_chart["max"], "text": existing_chart["text"]},
"Shares": {"name": "Shares", "used": 1, "max": 6, "text": False},
"Shares": {"name": "Shares", "used": 1, "max": 6, "text": text},
"Share Storage": {
"name": "Share Storage", 'used': 2, "max": 7, "text": False},
"name": "Share Storage", 'used': 2, "max": 7, "text": text},
"Share Networks": {
"name": "Share Networks", "used": 3, "max": 8, "text": False},
"name": "Share Networks", "used": 3, "max": 8, "text": text},
"Share Snapshots": {
"name": "Share Snapshots", "used": 4, "max": 9, "text": False},
"name": "Share Snapshots", "used": 4, "max": 9, "text": text},
"Share Snapshots Storage": {
"name": "Share Snapshots Storage", "used": 5, "max": 10,
"text": False},
"text": text},
}
for chart in charts:
name = chart["name"].title()


Loading…
Cancel
Save